Skip to content

Commit

Permalink
refactor: Format strings with sugarjs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Healy committed Jan 24, 2020
1 parent e2b5056 commit f965956
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
5 changes: 4 additions & 1 deletion examples/react-graphql/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"react-scripts": "3.3.0",
"react-table": "^7.0.0-rc.15",
"rimble-ui": "^0.11.1",
"styled-components": "^5.0.0"
"styled-components": "^5.0.0",
"sugar": "^2.0.6",
"sugar-inflections": "^2.0.6"
},
"devDependencies": {
"@types/jest": "^24.0.0",
Expand All @@ -28,6 +30,7 @@
"@types/react-router-dom": "^5.1.3",
"@types/react-table": "^7.0.3",
"@types/styled-components": "^4.4.2",
"@types/sugar": "^2.0.2",
"typescript": "~3.7.2"
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react'
import { Box, Heading, Text, Icon, Avatar, QR } from 'rimble-ui'
import * as Types from '../../types'

import './Credential.css'

const S = require('sugar/string')

interface Props {
iss: Types.Identity
sub: Types.Identity
Expand Down Expand Up @@ -38,15 +39,17 @@ const Component: React.FC<Props> = ({ onClick, detailMode, fields, jwt, iss, sub
return (
<Box mb={1} key={i}>
<Box>
<Text>{field.type}</Text>
<Text caps fontSize={1}>
{S.String.titleize(field.type)}
</Text>
</Box>
<Box justifyContent={'flex-start'}>
{fieldValueImage ? (
<Box paddingTop={5}>
<Avatar source={{ uri: field.value }} type={'rounded'} gravatarType={'retro'} size={25} />
</Box>
) : (
<Text>{field.isObj ? 'Type not supported yet' : field.value}</Text>
<Text fontSize={3}>{field.isObj ? 'Type not supported yet' : field.value}</Text>
)}
</Box>
</Box>
Expand Down
26 changes: 26 additions & 0 deletions examples/react-graphql/client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,13 @@
"@types/react-native" "*"
csstype "^2.2.0"

"@types/sugar@^2.0.2":
version "2.0.2"
resolved "https://registry.npmjs.org/@types/sugar/-/sugar-2.0.2.tgz#49c8b07af4e6c86b014aa776bb437d16044d2972"
integrity sha1-SciwevTmyGsBSqd2u0N9FgRNKXI=
dependencies:
sugar "*"

"@types/testing-library__dom@*", "@types/testing-library__dom@^6.0.0":
version "6.11.1"
resolved "https://registry.yarnpkg.com/@types/testing-library__dom/-/testing-library__dom-6.11.1.tgz#6058a6ac391db679f7c60dbb27b81f0620de2dd9"
Expand Down Expand Up @@ -10375,6 +10382,25 @@ stylehacks@^4.0.0:
postcss "^7.0.0"
postcss-selector-parser "^3.0.0"

sugar-core@^2.0.0:
version "2.0.6"
resolved "https://registry.npmjs.org/sugar-core/-/sugar-core-2.0.6.tgz#785e0cd64aa7302ea54d47bc1213efe52c006270"
integrity sha512-YmLFysR3Si6RImqL1+aB6JH81EXxvXn5iXhPf2PsjfoUYEwCxFDYCQY+zC3WqviuGWzxFaSkkJvkUE05Y03L5Q==

sugar-inflections@^2.0.6:
version "2.0.6"
resolved "https://registry.npmjs.org/sugar-inflections/-/sugar-inflections-2.0.6.tgz#84df8769cde1d70b625f4c3d856a4648a8fe4c24"
integrity sha512-C9guJmDgW5ZKyO/Y3mt3rAlZ+oZLGpaqM0SReW3a0s0/h/brflPLDU5qdztcssIkU/fof8tcwLdPtv6vCZB8fA==
dependencies:
sugar-core "^2.0.0"

sugar@*, sugar@^2.0.6:
version "2.0.6"
resolved "https://registry.npmjs.org/sugar/-/sugar-2.0.6.tgz#aa08e389add27109fb35718598313e0503a4fc39"
integrity sha512-s0P2/pjJtAD9VA44+2Gqm3NdC4v+08melA6YubOxzshu628krTbn95/M2GWMrI9rYspZMpYBIrChR46fjQ7xsQ==
dependencies:
sugar-core "^2.0.0"

supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
Expand Down

0 comments on commit f965956

Please sign in to comment.