fix typography (#481)

* upgrade storybook

* fix letter spacing

* add sizes

* add changeset
This commit is contained in:
Felicio Mununga 2023-09-25 12:30:14 +02:00 committed by GitHub
parent a43b5a6a02
commit 19384e1027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 2034 additions and 1057 deletions

View File

@ -0,0 +1,7 @@
---
'@status-im/components': minor
---
- upgrade storybook
- fix text letter spacing
- add text sizes

View File

@ -53,12 +53,12 @@
"zustand": "^4.3.7" "zustand": "^4.3.7"
}, },
"devDependencies": { "devDependencies": {
"@storybook/addon-essentials": "7.0.2", "@storybook/addon-essentials": "7.4.3",
"@storybook/addon-interactions": "7.0.2", "@storybook/addon-interactions": "7.4.3",
"@storybook/addon-links": "7.0.2", "@storybook/addon-links": "7.4.3",
"@storybook/blocks": "7.0.2", "@storybook/blocks": "7.4.3",
"@storybook/react": "7.0.2", "@storybook/react": "7.4.3",
"@storybook/react-vite": "7.0.2", "@storybook/react-vite": "7.4.3",
"@storybook/testing-library": "^0.1.0", "@storybook/testing-library": "^0.1.0",
"@tamagui/vite-plugin": "1.36.4", "@tamagui/vite-plugin": "1.36.4",
"@vitejs/plugin-react-swc": "^3.2.0", "@vitejs/plugin-react-swc": "^3.2.0",
@ -67,8 +67,8 @@
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-native-svg": "^13.8.0", "react-native-svg": "^13.8.0",
"react-native-web": "^0.19.5", "react-native-web": "^0.19.5",
"storybook": "7.0.2", "storybook": "7.4.3",
"storybook-addon-designs": "7.0.0-beta.2", "storybook-addon-designs": "7.0.0-beta.1",
"storybook-dark-mode": "^3.0.0", "storybook-dark-mode": "^3.0.0",
"vite": "^4.2.1" "vite": "^4.2.1"
}, },

View File

@ -23,11 +23,33 @@ const meta: Meta = {
export const Default: StoryObj<typeof Text> = { export const Default: StoryObj<typeof Text> = {
render: args => ( render: args => (
<Stack gap={24}> <Stack gap={24}>
<Stack gap={8}>
<Text {...args} size={88} weight="regular" />
<Text {...args} size={88} weight="medium" />
<Text {...args} size={88} weight="semibold" />
<Text {...args} size={88} weight="bold" />
</Stack>
<Stack gap={8}>
<Text {...args} size={64} weight="regular" />
<Text {...args} size={64} weight="medium" />
<Text {...args} size={64} weight="semibold" />
<Text {...args} size={64} weight="bold" />
</Stack>
<Stack gap={8}>
<Text {...args} size={40} weight="regular" />
<Text {...args} size={40} weight="medium" />
<Text {...args} size={40} weight="semibold" />
<Text {...args} size={40} weight="bold" />
</Stack>
<Stack gap={8}> <Stack gap={8}>
<Text {...args} size={27} weight="regular" /> <Text {...args} size={27} weight="regular" />
<Text {...args} size={27} weight="medium" /> <Text {...args} size={27} weight="medium" />
<Text {...args} size={27} weight="semibold" /> <Text {...args} size={27} weight="semibold" />
</Stack> </Stack>
<Stack gap={8}> <Stack gap={8}>
<Text {...args} size={19} weight="regular" /> <Text {...args} size={19} weight="regular" />
<Text {...args} size={19} weight="medium" /> <Text {...args} size={19} weight="medium" />

View File

@ -16,11 +16,19 @@ type Props = {
truncate?: boolean truncate?: boolean
wrap?: false wrap?: false
} & ( } & (
| { size: 27; weight?: Weight } | { size: 88; weight?: Weight }
| { size: 19; weight?: Weight } | { size: 64; weight?: Weight }
| { size: 15; weight?: Weight; type?: Type } | { size: 40; weight?: Weight }
| { size: 13; weight?: Weight; type?: Type } | { size: 27; weight?: Exclude<Weight, 'bold'> }
| { size: 11; weight?: Weight; type?: Type; uppercase?: boolean } | { size: 19; weight?: Exclude<Weight, 'bold'> }
| { size: 15; weight?: Exclude<Weight, 'bold'>; type?: Type }
| { size: 13; weight?: Exclude<Weight, 'bold'>; type?: Type }
| {
size: 11
weight?: Exclude<Weight, 'bold'>
type?: Type
uppercase?: boolean
}
) )
// TODO: monospace should be used only for variant. Extract to separate <Address> component? // TODO: monospace should be used only for variant. Extract to separate <Address> component?
@ -44,30 +52,45 @@ const Base = styled(BaseText, {
}, },
size: { size: {
88: {
fontSize: 88,
lineHeight: 84,
letterSpacing: -1.848,
},
64: {
fontSize: 64,
lineHeight: 68,
letterSpacing: -1.28,
},
40: {
fontSize: 40,
lineHeight: 44,
letterSpacing: -0.8,
},
27: { 27: {
fontSize: 27, fontSize: 27,
lineHeight: 32, lineHeight: 32,
letterSpacing: -0.021, letterSpacing: -0.567,
}, },
19: { 19: {
fontSize: 19, fontSize: 19,
lineHeight: 26, lineHeight: 28,
letterSpacing: -0.016, letterSpacing: -0.304,
}, },
15: { 15: {
fontSize: 15, fontSize: 15,
lineHeight: 22, lineHeight: 21.75,
letterSpacing: -0.009, letterSpacing: -0.135,
}, },
13: { 13: {
fontSize: 13, fontSize: 13,
lineHeight: 18, lineHeight: 18.2,
letterSpacing: -0.003, letterSpacing: -0.039,
}, },
11: { 11: {
fontSize: 11, fontSize: 11,
lineHeight: 18, lineHeight: 15.62,
letterSpacing: -0.003, letterSpacing: -0.055,
}, },
}, },
@ -81,6 +104,9 @@ const Base = styled(BaseText, {
semibold: { semibold: {
fontWeight: '600', fontWeight: '600',
}, },
bold: {
fontWeight: '700',
},
}, },
uppercase: { uppercase: {

2992
yarn.lock

File diff suppressed because it is too large Load Diff