@edvisor/product-language 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +2 -0
- package/index.js +7914 -0
- package/lib/components/alert-banner/alert-banner.d.ts +11 -0
- package/lib/components/alert-banner/alert-level-flags.d.ts +13 -0
- package/lib/components/alert-banner/index.d.ts +1 -0
- package/lib/components/badge/badge-type-flags.d.ts +18 -0
- package/lib/components/badge/badge.d.ts +5 -0
- package/lib/components/badge/index.d.ts +1 -0
- package/{src/lib/components/card/atoms/card-frame.tsx → lib/components/card/atoms/card-frame.d.ts} +7 -17
- package/lib/components/card/atoms/index.d.ts +1 -0
- package/lib/components/card/card.d.ts +14 -0
- package/lib/components/card/components/card-alert-banner-slot.d.ts +5 -0
- package/lib/components/card/components/card-controls-slot.d.ts +4 -0
- package/lib/components/card/components/card-section-slot.d.ts +11 -0
- package/lib/components/card/components/index.d.ts +3 -0
- package/lib/components/card/index.d.ts +2 -0
- package/lib/components/card/molecules/index.d.ts +1 -0
- package/lib/components/card/molecules/left-right-card.d.ts +16 -0
- package/lib/components/checkbox/checkbox.d.ts +10 -0
- package/lib/components/checkbox/helpers.d.ts +12 -0
- package/lib/components/checkbox/index.d.ts +1 -0
- package/lib/components/divider/divider-type-flags.d.ts +9 -0
- package/lib/components/divider/divider.d.ts +7 -0
- package/lib/components/divider/index.d.ts +1 -0
- package/lib/components/flag/flag-size-flags.d.ts +12 -0
- package/lib/components/flag/flag.d.ts +9 -0
- package/lib/components/flag/flag.list.d.ts +781 -0
- package/lib/components/flag/index.d.ts +1 -0
- package/lib/components/icon/icon-list.d.ts +131 -0
- package/lib/components/icon/icon.d.ts +131 -0
- package/lib/components/icon/index.d.ts +1 -0
- package/lib/components/index.d.ts +17 -0
- package/lib/components/input-field/components/index.d.ts +2 -0
- package/lib/components/input-field/components/labeled-input.d.ts +10 -0
- package/lib/components/input-field/components/stepper.d.ts +7 -0
- package/lib/components/input-field/index.d.ts +3 -0
- package/lib/components/input-field/input-field.d.ts +25 -0
- package/lib/components/input-field/input-number.d.ts +18 -0
- package/lib/components/input-field/input-text.d.ts +14 -0
- package/lib/components/layout/flex.d.ts +16 -0
- package/lib/components/layout/grid-layout.d.ts +11 -0
- package/lib/components/layout/index.d.ts +3 -0
- package/lib/components/layout/left-right-layout.d.ts +34 -0
- package/lib/components/link/index.d.ts +1 -0
- package/lib/components/link/link.d.ts +14 -0
- package/lib/components/molecules/avatar/avatar-size-flags.d.ts +12 -0
- package/lib/components/molecules/avatar/avatar.d.ts +12 -0
- package/lib/components/molecules/avatar/index.d.ts +1 -0
- package/lib/components/molecules/button/button-flags.d.ts +44 -0
- package/lib/components/molecules/button/button.d.ts +12 -0
- package/lib/components/molecules/button/index.d.ts +1 -0
- package/lib/components/molecules/index.d.ts +3 -0
- package/lib/components/molecules/input-checkbox/index.d.ts +1 -0
- package/lib/components/molecules/input-checkbox/input-checkbox.d.ts +8 -0
- package/lib/components/organisms/index.d.ts +1 -0
- package/lib/components/organisms/multi-choice-list/index.d.ts +1 -0
- package/lib/components/organisms/multi-choice-list/multi-choice-list.d.ts +10 -0
- package/lib/components/spinner/index.d.ts +1 -0
- package/lib/components/spinner/spinner-size-flags.d.ts +10 -0
- package/lib/components/spinner/spinner.d.ts +9 -0
- package/lib/components/tabs/components/index.d.ts +1 -0
- package/lib/components/tabs/components/tab.d.ts +7 -0
- package/lib/components/tabs/index.d.ts +1 -0
- package/lib/components/tabs/tabs.d.ts +15 -0
- package/lib/components/tag/components/close-button.d.ts +8 -0
- package/lib/components/tag/components/index.d.ts +2 -0
- package/lib/components/tag/components/tag-label.d.ts +8 -0
- package/lib/components/tag/index.d.ts +1 -0
- package/lib/components/tag/tag.d.ts +10 -0
- package/lib/components/thumbnail/index.d.ts +1 -0
- package/lib/components/thumbnail/thumbnail-size-flags.d.ts +10 -0
- package/lib/components/thumbnail/thumbnail.d.ts +10 -0
- package/lib/components/typography/index.d.ts +1 -0
- package/lib/components/typography/typography.d.ts +24 -0
- package/lib/foundations/color-system/base-palette/base-palette.d.ts +76 -0
- package/lib/foundations/color-system/base-palette/index.d.ts +1 -0
- package/lib/foundations/color-system/color-guidelines/color-guidelines.d.ts +132 -0
- package/lib/foundations/color-system/color-guidelines/index.d.ts +1 -0
- package/lib/foundations/color-system/components/color-sample.d.ts +17 -0
- package/lib/foundations/color-system/components/index.d.ts +1 -0
- package/lib/foundations/color-system/index.d.ts +1 -0
- package/lib/foundations/index.d.ts +4 -0
- package/lib/foundations/shadows/components.d.ts +8 -0
- package/lib/foundations/shadows/index.d.ts +1 -0
- package/lib/foundations/shadows/shadows.d.ts +8 -0
- package/lib/foundations/spacing/index.d.ts +1 -0
- package/lib/foundations/spacing/spacing-guidelines.d.ts +22 -0
- package/lib/foundations/spacing/spacing.d.ts +18 -0
- package/lib/foundations/typography/constants.d.ts +22 -0
- package/lib/foundations/typography/fonts.d.ts +1 -0
- package/lib/foundations/typography/index.d.ts +1 -0
- package/lib/foundations/typography/text-aspect-flags.d.ts +19 -0
- package/lib/foundations/typography/typography.d.ts +24 -0
- package/lib/helpers/generic-types.d.ts +21 -0
- package/lib/helpers/index.d.ts +6 -0
- package/lib/helpers/nothing.d.ts +8 -0
- package/{src/lib/helpers/numbers.ts → lib/helpers/numbers.d.ts} +50 -53
- package/lib/helpers/safe-navigation.d.ts +15 -0
- package/lib/helpers/slots.d.ts +23 -0
- package/lib/helpers/strings.d.ts +1 -0
- package/package.json +12 -5
- package/.babelrc +0 -12
- package/.eslintrc.json +0 -139
- package/.storybook/main.js +0 -57
- package/.storybook/manager.js +0 -7
- package/.storybook/preview-head.html +0 -1
- package/.storybook/preview.js +0 -15
- package/.storybook/tsconfig.json +0 -30
- package/jest.config.ts +0 -15
- package/jest.setup.ts +0 -2
- package/project.json +0 -85
- package/release-it.json +0 -18
- package/src/assets/svg/example_icon.svg +0 -3
- package/src/assets/svg/example_icon_white.svg +0 -3
- package/src/assets/svg/spinner.svg +0 -3
- package/src/assets/svg/spinner_white.svg +0 -3
- package/src/helpers/index.ts +0 -3
- package/src/helpers/talesOf.tsx +0 -42
- package/src/index.ts +0 -2
- package/src/lib/components/README.md +0 -49
- package/src/lib/components/alert-banner/alert-banner.tsx +0 -34
- package/src/lib/components/alert-banner/alert-level-flags.ts +0 -77
- package/src/lib/components/alert-banner/index.ts +0 -1
- package/src/lib/components/badge/badge-type-flags.ts +0 -72
- package/src/lib/components/badge/badge.stories.tsx +0 -16
- package/src/lib/components/badge/badge.test.tsx +0 -29
- package/src/lib/components/badge/badge.tsx +0 -31
- package/src/lib/components/badge/index.ts +0 -1
- package/src/lib/components/card/atoms/index.ts +0 -1
- package/src/lib/components/card/card.test.tsx +0 -163
- package/src/lib/components/card/card.tsx +0 -78
- package/src/lib/components/card/components/card-alert-banner-slot.tsx +0 -16
- package/src/lib/components/card/components/card-controls-slot.tsx +0 -19
- package/src/lib/components/card/components/card-section-slot.tsx +0 -51
- package/src/lib/components/card/components/index.ts +0 -3
- package/src/lib/components/card/index.ts +0 -2
- package/src/lib/components/card/molecules/index.ts +0 -1
- package/src/lib/components/card/molecules/left-right-card.test.tsx +0 -89
- package/src/lib/components/card/molecules/left-right-card.tsx +0 -63
- package/src/lib/components/card/storybook/card.stories.mdx +0 -100
- package/src/lib/components/card/storybook/components.tsx +0 -240
- package/src/lib/components/checkbox/checkbox.test.tsx +0 -39
- package/src/lib/components/checkbox/checkbox.tsx +0 -124
- package/src/lib/components/checkbox/components/components.tsx +0 -59
- package/src/lib/components/checkbox/index.tsx +0 -1
- package/src/lib/components/checkbox/stories/checkbox.stories.mdx +0 -54
- package/src/lib/components/checkbox/stories/components.tsx +0 -36
- package/src/lib/components/checkbox/stories/index.tsx +0 -1
- package/src/lib/components/divider/divider-type-flags.tsx +0 -37
- package/src/lib/components/divider/divider.test.tsx +0 -34
- package/src/lib/components/divider/divider.tsx +0 -37
- package/src/lib/components/divider/index.tsx +0 -1
- package/src/lib/components/divider/stories/components.tsx +0 -13
- package/src/lib/components/divider/stories/divider.stories.mdx +0 -50
- package/src/lib/components/index.ts +0 -14
- package/src/lib/components/input-field/components/index.ts +0 -2
- package/src/lib/components/input-field/components/labeled-input.tsx +0 -61
- package/src/lib/components/input-field/components/stepper.tsx +0 -59
- package/src/lib/components/input-field/index.ts +0 -6
- package/src/lib/components/input-field/input-field.test.tsx +0 -108
- package/src/lib/components/input-field/input-field.tsx +0 -126
- package/src/lib/components/input-field/input-number.tsx +0 -41
- package/src/lib/components/input-field/input-text.tsx +0 -30
- package/src/lib/components/input-field/storybook/components.tsx +0 -334
- package/src/lib/components/input-field/storybook/input-field.stories.mdx +0 -113
- package/src/lib/components/layout/flex.tsx +0 -22
- package/src/lib/components/layout/grid-layout.tsx +0 -40
- package/src/lib/components/layout/index.ts +0 -3
- package/src/lib/components/layout/left-right-layout.tsx +0 -67
- package/src/lib/components/link/index.ts +0 -1
- package/src/lib/components/link/link.test.tsx +0 -29
- package/src/lib/components/link/link.tsx +0 -56
- package/src/lib/components/link/storybook/link.stories.mdx +0 -51
- package/src/lib/components/molecules/avatar/avatar-size-flags.tsx +0 -55
- package/src/lib/components/molecules/avatar/avatar.test.tsx +0 -114
- package/src/lib/components/molecules/avatar/avatar.tsx +0 -80
- package/src/lib/components/molecules/avatar/index.tsx +0 -1
- package/src/lib/components/molecules/avatar/stories/avatar.stories.mdx +0 -55
- package/src/lib/components/molecules/avatar/stories/components.tsx +0 -36
- package/src/lib/components/molecules/button/button-flags.tsx +0 -235
- package/src/lib/components/molecules/button/button.test.tsx +0 -77
- package/src/lib/components/molecules/button/button.tsx +0 -231
- package/src/lib/components/molecules/button/index.tsx +0 -1
- package/src/lib/components/molecules/button/stories/button.stories.mdx +0 -104
- package/src/lib/components/molecules/button/stories/components.tsx +0 -86
- package/src/lib/components/molecules/index.ts +0 -3
- package/src/lib/components/molecules/input-checkbox/index.tsx +0 -1
- package/src/lib/components/molecules/input-checkbox/input-checkbox.test.tsx +0 -34
- package/src/lib/components/molecules/input-checkbox/input-checkbox.tsx +0 -50
- package/src/lib/components/molecules/input-checkbox/stories/components.tsx +0 -36
- package/src/lib/components/molecules/input-checkbox/stories/index.tsx +0 -1
- package/src/lib/components/molecules/input-checkbox/stories/input-checkbox.stories.mdx +0 -51
- package/src/lib/components/organisms/index.ts +0 -1
- package/src/lib/components/organisms/multi-choice-list/index.tsx +0 -1
- package/src/lib/components/organisms/multi-choice-list/multi-choice-list.test.tsx +0 -33
- package/src/lib/components/organisms/multi-choice-list/multi-choice-list.tsx +0 -53
- package/src/lib/components/organisms/multi-choice-list/stories/components.tsx +0 -126
- package/src/lib/components/organisms/multi-choice-list/stories/index.tsx +0 -1
- package/src/lib/components/organisms/multi-choice-list/stories/multi-choice-list.stories.mdx +0 -99
- package/src/lib/components/spinner/index.tsx +0 -1
- package/src/lib/components/spinner/spinner-size-flags.tsx +0 -39
- package/src/lib/components/spinner/spinner.test.tsx +0 -31
- package/src/lib/components/spinner/spinner.tsx +0 -67
- package/src/lib/components/spinner/stories/components.tsx +0 -8
- package/src/lib/components/spinner/stories/spinner.stories.mdx +0 -42
- package/src/lib/components/thumbnail/index.tsx +0 -1
- package/src/lib/components/thumbnail/stories/thumbnail.stories.mdx +0 -34
- package/src/lib/components/thumbnail/thumbnail-size-flags.tsx +0 -41
- package/src/lib/components/thumbnail/thumbnail.test.tsx +0 -51
- package/src/lib/components/thumbnail/thumbnail.tsx +0 -40
- package/src/lib/components/typography/index.ts +0 -1
- package/src/lib/components/typography/storybook/components.tsx +0 -256
- package/src/lib/components/typography/storybook/typography.stories.mdx +0 -88
- package/src/lib/components/typography/typography.test.tsx +0 -93
- package/src/lib/components/typography/typography.tsx +0 -57
- package/src/lib/foundations/color-system/base-palette/base-palette.stories.tsx +0 -123
- package/src/lib/foundations/color-system/base-palette/base-palette.ts +0 -94
- package/src/lib/foundations/color-system/base-palette/index.ts +0 -1
- package/src/lib/foundations/color-system/color-guidelines/color-guidelines.stories.mdx +0 -85
- package/src/lib/foundations/color-system/color-guidelines/color-guidelines.stories.tsx +0 -231
- package/src/lib/foundations/color-system/color-guidelines/color-guidelines.ts +0 -159
- package/src/lib/foundations/color-system/color-guidelines/index.ts +0 -1
- package/src/lib/foundations/color-system/components/color-sample.tsx +0 -99
- package/src/lib/foundations/color-system/components/index.ts +0 -1
- package/src/lib/foundations/color-system/index.ts +0 -1
- package/src/lib/foundations/index.ts +0 -4
- package/src/lib/foundations/shadows/components.tsx +0 -59
- package/src/lib/foundations/shadows/index.ts +0 -1
- package/src/lib/foundations/shadows/shadows.stories.mdx +0 -71
- package/src/lib/foundations/shadows/shadows.tsx +0 -47
- package/src/lib/foundations/spacing/index.ts +0 -1
- package/src/lib/foundations/spacing/spacing-guidelines.ts +0 -24
- package/src/lib/foundations/spacing/spacing.stories.mdx +0 -51
- package/src/lib/foundations/spacing/spacing.ts +0 -18
- package/src/lib/foundations/typography/constants.ts +0 -25
- package/src/lib/foundations/typography/index.tsx +0 -1
- package/src/lib/foundations/typography/text-aspect-flags.ts +0 -54
- package/src/lib/foundations/typography/typography.tsx +0 -97
- package/src/lib/helpers/generic-types.ts +0 -44
- package/src/lib/helpers/index.ts +0 -6
- package/src/lib/helpers/nothing.tsx +0 -18
- package/src/lib/helpers/safe-navigation.ts +0 -34
- package/src/lib/helpers/slots.tsx +0 -76
- package/src/lib/helpers/strings.test.ts +0 -47
- package/src/lib/helpers/strings.ts +0 -16
- package/tsconfig.json +0 -35
- package/tsconfig.lib.json +0 -28
- package/tsconfig.spec.json +0 -21
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { getValuesBySize, SpinnerProps } from './spinner-size-flags'
|
|
2
|
-
import { FC, is } from '@helpers'
|
|
3
|
-
import styled, { keyframes } from 'styled-components'
|
|
4
|
-
import { Icons } from '@foundations'
|
|
5
|
-
|
|
6
|
-
const spinAnimation = keyframes`
|
|
7
|
-
0% {
|
|
8
|
-
transform: rotate(0deg);
|
|
9
|
-
stroke-dashoffset: 25;
|
|
10
|
-
}
|
|
11
|
-
50% {
|
|
12
|
-
transform: rotate(720deg);
|
|
13
|
-
stroke-dashoffset: 125;
|
|
14
|
-
}
|
|
15
|
-
100% {
|
|
16
|
-
transform: rotate(1080deg);
|
|
17
|
-
stroke-dashoffset: 25;
|
|
18
|
-
}
|
|
19
|
-
`
|
|
20
|
-
|
|
21
|
-
const Spin = styled.svg<{ size: string, onPrimary: boolean, onCritical: boolean }>`
|
|
22
|
-
width: ${({ size }) => size};
|
|
23
|
-
height: ${({ size }) => size};
|
|
24
|
-
fill: none;
|
|
25
|
-
path {
|
|
26
|
-
fill-rule: evenodd;
|
|
27
|
-
clip-rule: evenodd;
|
|
28
|
-
fill: ${({ onPrimary, onCritical }) => (onPrimary || onCritical) ? Icons.OnPrimary : Icons.Default};
|
|
29
|
-
stroke: ${({ onPrimary, onCritical }) => (onPrimary || onCritical) ? Icons.OnPrimary : Icons.Default};
|
|
30
|
-
-webkit-transform-origin: 20px 20 0;
|
|
31
|
-
-moz-transform-origin: 20px 20px 0;
|
|
32
|
-
-ms-transform-origin: 20px 20px 0;
|
|
33
|
-
-o-transform-origin: 20px 20px 0;
|
|
34
|
-
transform-origin: 20px 20px 0;
|
|
35
|
-
-webkit-animation: spinner 2s linear infinite;
|
|
36
|
-
-moz-animation: spinner 2s linear infinite;
|
|
37
|
-
-ms-animation: spinner 2s linear infinite;
|
|
38
|
-
-o-animation: spinner 2s linear infinite;
|
|
39
|
-
animation: spinner 2s linear infinite;
|
|
40
|
-
animation-name: ${spinAnimation};
|
|
41
|
-
}
|
|
42
|
-
`
|
|
43
|
-
|
|
44
|
-
type IProps = SpinnerProps & {
|
|
45
|
-
onPrimary?: boolean
|
|
46
|
-
onCritical?: boolean
|
|
47
|
-
className?: string
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export const Spinner : FC<IProps> = (props) => {
|
|
51
|
-
const size = getValuesBySize(props)
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<Spin
|
|
55
|
-
onPrimary={is(props.onPrimary)}
|
|
56
|
-
onCritical={is(props.onCritical)}
|
|
57
|
-
className={props.className}
|
|
58
|
-
size={size}
|
|
59
|
-
role="progressbar"
|
|
60
|
-
viewBox="0 0 40 40"
|
|
61
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
62
|
-
>
|
|
63
|
-
<path d="M20 3.5C10.8873 3.5 3.5 10.8873 3.5 20C3.5 29.1127 10.8873 36.5 20 36.5C20.2593 36.5 20.517 36.494 20.7732 36.4822C21.6007 36.4441 22.3578 37.0111 22.4704 37.8319C22.5831 38.6526 22.0089 39.4152 21.182 39.4647C20.7908 39.4881 20.3967 39.5 20 39.5C9.23045 39.5 0.5 30.7696 0.5 20C0.5 9.23045 9.23045 0.5 20 0.5C26.0299 0.5 31.4203 3.23815 34.9953 7.53374C35.5252 8.17049 35.3622 9.11117 34.6867 9.59078C34.0113 10.0704 33.0798 9.90641 32.5411 9.27701C29.5131 5.73882 25.018 3.5 20 3.5Z" />
|
|
64
|
-
</Spin>
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
|
2
|
-
import { StoryComponent, talesOf, StorybookFrame } from '@stories'
|
|
3
|
-
import { Spinner } from '../index'
|
|
4
|
-
import { ButtonPrimary, ButtonDestructive } from 'components/molecules/button'
|
|
5
|
-
|
|
6
|
-
import { WrapperStories } from './components'
|
|
7
|
-
|
|
8
|
-
<Meta title="Components/Spinner" />
|
|
9
|
-
|
|
10
|
-
# Spinner
|
|
11
|
-
|
|
12
|
-
Spinners are used to notify users that their action is being processed.
|
|
13
|
-
|
|
14
|
-
For more details, check out the guidelines on [Figma](https://www.figma.com/file/ue1CurHfZ426o2T2l8Dk64/Edvisor-Product-Language?node-id=734%3A7380)
|
|
15
|
-
|
|
16
|
-
## How to Use
|
|
17
|
-
|
|
18
|
-
```tsx
|
|
19
|
-
import { Spinner } from './index'
|
|
20
|
-
|
|
21
|
-
<Spinner />
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Size
|
|
25
|
-
|
|
26
|
-
<Canvas>
|
|
27
|
-
<Spinner small/>
|
|
28
|
-
<Spinner />
|
|
29
|
-
</Canvas>
|
|
30
|
-
|
|
31
|
-
### On primary
|
|
32
|
-
|
|
33
|
-
When rendering the spinner on a primary or critical surface, use onPrimary or onCritical.
|
|
34
|
-
|
|
35
|
-
<Canvas>
|
|
36
|
-
<ButtonPrimary>
|
|
37
|
-
<Spinner onPrimary />
|
|
38
|
-
</ButtonPrimary>
|
|
39
|
-
<ButtonDestructive primary>
|
|
40
|
-
<Spinner onCritical />
|
|
41
|
-
</ButtonDestructive>
|
|
42
|
-
</Canvas>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './thumbnail'
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
|
2
|
-
import { Thumbnail } from '../index'
|
|
3
|
-
import { SpaceAround } from '../../layout'
|
|
4
|
-
|
|
5
|
-
<Meta
|
|
6
|
-
title="Components/Thumbnail"
|
|
7
|
-
component={Thumbnail}
|
|
8
|
-
/>
|
|
9
|
-
|
|
10
|
-
# Thumbnail
|
|
11
|
-
|
|
12
|
-
For more details, check out the component page on [Figma](https://www.figma.com/file/ue1CurHfZ426o2T2l8Dk64/Edvisor-Product-Language?node-id=1545%3A4445)
|
|
13
|
-
|
|
14
|
-
## How to use
|
|
15
|
-
|
|
16
|
-
```javascript
|
|
17
|
-
// Import the component
|
|
18
|
-
import { Thumbnail } from './index'
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// Render the component sending the required parameters
|
|
22
|
-
<Thumbnail imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png'/>
|
|
23
|
-
```
|
|
24
|
-
## Good Practices
|
|
25
|
-
- You can send the `imageLabel` propertie as an `alt` propertie in order to set and alternative text to image
|
|
26
|
-
|
|
27
|
-
## Examples
|
|
28
|
-
|
|
29
|
-
<Canvas>
|
|
30
|
-
<Thumbnail large imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png'/>
|
|
31
|
-
<Thumbnail medium imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png'/>
|
|
32
|
-
<Thumbnail small imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png'/>
|
|
33
|
-
</Canvas>
|
|
34
|
-
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// this file was generated, but it is safe to modify
|
|
2
|
-
import { bitwiseOr, MappedEnum, RequireOnlyOne, PropsWithChildren } from '@helpers'
|
|
3
|
-
|
|
4
|
-
const enum ThumbnailSize {
|
|
5
|
-
small = 1,
|
|
6
|
-
medium = 2,
|
|
7
|
-
large = 4,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
type ThumbnailSizes<T> = MappedEnum<typeof ThumbnailSize, T>
|
|
11
|
-
|
|
12
|
-
function toThumbnailSize(n: number): ThumbnailSize {
|
|
13
|
-
switch (n) {
|
|
14
|
-
case ThumbnailSize.small:
|
|
15
|
-
return ThumbnailSize.small
|
|
16
|
-
case ThumbnailSize.medium:
|
|
17
|
-
return ThumbnailSize.medium
|
|
18
|
-
case ThumbnailSize.large:
|
|
19
|
-
return ThumbnailSize.large
|
|
20
|
-
default:
|
|
21
|
-
return ThumbnailSize.medium
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const ThumbnailSizeValues = {
|
|
26
|
-
[ThumbnailSize.small]: '40px',
|
|
27
|
-
[ThumbnailSize.medium]: '60px',
|
|
28
|
-
[ThumbnailSize.large]: '80px',
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export type ThumbnailSizeProps = Partial<RequireOnlyOne<ThumbnailSizes<boolean>>> &
|
|
33
|
-
PropsWithChildren
|
|
34
|
-
|
|
35
|
-
export function getValuesBySize(props: ThumbnailSizeProps): string {
|
|
36
|
-
return ThumbnailSizeValues[
|
|
37
|
-
toThumbnailSize(
|
|
38
|
-
bitwiseOr([props.small, props.medium, props.large])
|
|
39
|
-
)
|
|
40
|
-
]
|
|
41
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {render, screen } from '@testing-library/react'
|
|
2
|
-
import { Thumbnail } from './index'
|
|
3
|
-
|
|
4
|
-
describe('Thumbnail Tests', () => {
|
|
5
|
-
describe('Thumbnail Tests', () => {
|
|
6
|
-
it('should render the Thumbnail with size small', () => {
|
|
7
|
-
render(
|
|
8
|
-
<Thumbnail
|
|
9
|
-
imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png'
|
|
10
|
-
small
|
|
11
|
-
/>
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
expect(screen.getByRole('img')).toBeInTheDocument()
|
|
15
|
-
expect(screen.getByTestId('thumbnail-test')).toHaveStyle('height: 40px')
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
it('should render the Thumbnail with size medium', () => {
|
|
19
|
-
render(
|
|
20
|
-
<Thumbnail
|
|
21
|
-
imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png'
|
|
22
|
-
medium
|
|
23
|
-
/>
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
expect(screen.getByRole('img')).toBeInTheDocument()
|
|
27
|
-
expect(screen.getByTestId('thumbnail-test')).toHaveStyle('height: 60px')
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('should render the Thumbnail with size large', () => {
|
|
31
|
-
render(
|
|
32
|
-
<Thumbnail
|
|
33
|
-
imageUrl='https://blog.edvisor.io/hubfs/Edvisor%20Smi.png'
|
|
34
|
-
large
|
|
35
|
-
/>
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
expect(screen.getByRole('img')).toBeInTheDocument()
|
|
39
|
-
expect(screen.getByTestId('thumbnail-test')).toHaveStyle('height: 80px')
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
it('should not render the Thumbnail without imageUrl', () => {
|
|
43
|
-
render(
|
|
44
|
-
<Thumbnail />
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
const thumbnailElement = screen.queryByText('thumbnail-test')
|
|
48
|
-
expect(thumbnailElement).not.toBeInTheDocument()
|
|
49
|
-
})
|
|
50
|
-
})
|
|
51
|
-
})
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
2
|
-
import { FC, isNil, Nothing } from '@helpers'
|
|
3
|
-
import { Borders, Padding } from '@foundations'
|
|
4
|
-
import { SpaceAround } from '../layout/'
|
|
5
|
-
import { ThumbnailSizeProps, getValuesBySize } from './thumbnail-size-flags'
|
|
6
|
-
|
|
7
|
-
const Box = styled(SpaceAround)<{ size: string }>`
|
|
8
|
-
width: ${({ size }) => size};
|
|
9
|
-
height: ${({ size }) => size};
|
|
10
|
-
border-radius: 6px;
|
|
11
|
-
border: 1px solid ${Borders.Default};
|
|
12
|
-
padding: ${Padding.xs};
|
|
13
|
-
box-sizing: border-box;
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
const Image = styled.img`
|
|
17
|
-
width: 100%;
|
|
18
|
-
height: 100%;
|
|
19
|
-
`
|
|
20
|
-
|
|
21
|
-
interface IThumbnailProps {
|
|
22
|
-
imageUrl?: string;
|
|
23
|
-
imageLabel?: string;
|
|
24
|
-
}
|
|
25
|
-
type IProps = IThumbnailProps & ThumbnailSizeProps
|
|
26
|
-
|
|
27
|
-
export const Thumbnail: FC<IProps> = (props) => {
|
|
28
|
-
const { imageUrl, imageLabel = imageUrl } = props
|
|
29
|
-
const size = getValuesBySize(props)
|
|
30
|
-
|
|
31
|
-
if (isNil(imageUrl)) {
|
|
32
|
-
return <Nothing/>
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<Box size={size} data-testid="thumbnail-test">
|
|
37
|
-
<Image src={imageUrl} alt={imageLabel}/>
|
|
38
|
-
</Box>
|
|
39
|
-
)
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './typography'
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import { Actions, Borders, Surface, Text } from 'foundations/color-system'
|
|
2
|
-
import { Margin, Padding } from 'foundations/spacing'
|
|
3
|
-
import styled from 'styled-components'
|
|
4
|
-
import { is } from '@helpers'
|
|
5
|
-
import {
|
|
6
|
-
Display,
|
|
7
|
-
Heading1,
|
|
8
|
-
Heading2,
|
|
9
|
-
Heading3,
|
|
10
|
-
Heading4,
|
|
11
|
-
BodyLarge,
|
|
12
|
-
Body,
|
|
13
|
-
Caption,
|
|
14
|
-
Label1,
|
|
15
|
-
Label2,
|
|
16
|
-
} from '../typography'
|
|
17
|
-
import { Typography } from '@foundations'
|
|
18
|
-
import { Flex } from 'components/layout'
|
|
19
|
-
import { useState } from 'react'
|
|
20
|
-
import { StoryComponent } from '@stories'
|
|
21
|
-
|
|
22
|
-
const Table = styled.div`
|
|
23
|
-
background: ${Surface.Default};
|
|
24
|
-
border-radius: 6px;
|
|
25
|
-
`
|
|
26
|
-
|
|
27
|
-
const Row = styled.div<{ gray?: boolean }>`
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-direction: row;
|
|
30
|
-
background-color: ${(props) => (is(props.gray) ? Surface.Default.Subdued : Surface.Default)};
|
|
31
|
-
border-bottom: 1px solid ${Borders.Default.Subdued};
|
|
32
|
-
`
|
|
33
|
-
|
|
34
|
-
const Column = styled.div`
|
|
35
|
-
${Typography.Body}
|
|
36
|
-
display: flex;
|
|
37
|
-
padding: ${Padding.l};
|
|
38
|
-
flex: 1;
|
|
39
|
-
align-items: center;
|
|
40
|
-
justify-content: center;
|
|
41
|
-
justify-content: space-between;
|
|
42
|
-
&:nth-child(1) {
|
|
43
|
-
flex: 2;
|
|
44
|
-
}
|
|
45
|
-
`
|
|
46
|
-
|
|
47
|
-
const HeaderColumn = styled(Column)`
|
|
48
|
-
color: ${Text.Subdued};
|
|
49
|
-
`
|
|
50
|
-
|
|
51
|
-
export const Button = styled.div<{ critical?: boolean, primary?: boolean }>`
|
|
52
|
-
background: ${({ critical, primary }) => {
|
|
53
|
-
if (is(critical)) {
|
|
54
|
-
return Actions.Critical.Default
|
|
55
|
-
} else if (is(primary)) {
|
|
56
|
-
return Actions.Primary.Default
|
|
57
|
-
} else {
|
|
58
|
-
return Actions.Secondary.Default
|
|
59
|
-
}
|
|
60
|
-
}};
|
|
61
|
-
border: 1px solid ${({ critical, primary }) => {
|
|
62
|
-
if (is(critical)) {
|
|
63
|
-
return 'none'
|
|
64
|
-
} else if (is(primary)) {
|
|
65
|
-
return 'none'
|
|
66
|
-
} else {
|
|
67
|
-
return Borders.Default
|
|
68
|
-
}
|
|
69
|
-
}};
|
|
70
|
-
box-sizing: border-box;
|
|
71
|
-
cursor: pointer;
|
|
72
|
-
|
|
73
|
-
display: flex;
|
|
74
|
-
flex-direction: row;
|
|
75
|
-
justify-content: center;
|
|
76
|
-
align-items: center;
|
|
77
|
-
padding: ${Padding.xs} ${Padding.m};
|
|
78
|
-
|
|
79
|
-
border-radius: 6px;
|
|
80
|
-
margin-right: ${Margin.s};
|
|
81
|
-
`
|
|
82
|
-
|
|
83
|
-
const Header = () => (
|
|
84
|
-
<Row>
|
|
85
|
-
<HeaderColumn><Label1 subdued>Typographic System</Label1></HeaderColumn>
|
|
86
|
-
<HeaderColumn><Label1 subdued>Weight</Label1></HeaderColumn>
|
|
87
|
-
<HeaderColumn><Label1 subdued>Size</Label1></HeaderColumn>
|
|
88
|
-
<HeaderColumn><Label1 subdued>Line Height</Label1></HeaderColumn>
|
|
89
|
-
<HeaderColumn><Label1 subdued>Spacing</Label1></HeaderColumn>
|
|
90
|
-
</Row>
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
const toTextAspectProps = (aspect: string) => {
|
|
94
|
-
switch (aspect) {
|
|
95
|
-
case 'subdued': return { subdued: true }
|
|
96
|
-
case 'light': return { light: true }
|
|
97
|
-
case 'critical': return { critical: true }
|
|
98
|
-
case 'success': return { success: true }
|
|
99
|
-
case 'onPrimary': return { onPrimary: true }
|
|
100
|
-
case 'onCritical': return { onCritical: true }
|
|
101
|
-
default: return {}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const toButtonProps = (aspect: string) => {
|
|
106
|
-
switch (aspect) {
|
|
107
|
-
case 'onPrimary': return { primary: true }
|
|
108
|
-
case 'onCritical': return { critical: true }
|
|
109
|
-
default: return {}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export const TypographyTable: StoryComponent = () => {
|
|
114
|
-
const [aspect, setAspect] = useState('')
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<div>
|
|
118
|
-
<Flex>
|
|
119
|
-
<Button onClick={() => setAspect('default')}>
|
|
120
|
-
<Body>Default</Body>
|
|
121
|
-
</Button>
|
|
122
|
-
<Button onClick={() => setAspect('subdued')}>
|
|
123
|
-
<Body subdued>Subdued</Body>
|
|
124
|
-
</Button>
|
|
125
|
-
<Button onClick={() => setAspect('light')}>
|
|
126
|
-
<Body light>Light</Body>
|
|
127
|
-
</Button>
|
|
128
|
-
<Button onClick={() => setAspect('critical')}>
|
|
129
|
-
<Body critical>Critical</Body>
|
|
130
|
-
</Button>
|
|
131
|
-
<Button onClick={() => setAspect('success')}>
|
|
132
|
-
<Body success>Success</Body>
|
|
133
|
-
</Button>
|
|
134
|
-
<Button primary onClick={() => setAspect('onPrimary')}>
|
|
135
|
-
<Body onPrimary>OnPrimary</Body>
|
|
136
|
-
</Button>
|
|
137
|
-
<Button critical onClick={() => setAspect('onCritical')}>
|
|
138
|
-
<Body onCritical>OnCritical</Body>
|
|
139
|
-
</Button>
|
|
140
|
-
</Flex>
|
|
141
|
-
<Table>
|
|
142
|
-
<Header />
|
|
143
|
-
<Row gray>
|
|
144
|
-
<Column>
|
|
145
|
-
<Button {...toButtonProps(aspect)}>
|
|
146
|
-
<Display {...toTextAspectProps(aspect)}>Display1</Display>
|
|
147
|
-
</Button>
|
|
148
|
-
</Column>
|
|
149
|
-
<Column>Regular 400</Column>
|
|
150
|
-
<Column>36px (2.25rem)</Column>
|
|
151
|
-
<Column>44px</Column>
|
|
152
|
-
<Column>0 px</Column>
|
|
153
|
-
</Row>
|
|
154
|
-
<Row>
|
|
155
|
-
<Column>
|
|
156
|
-
<Button {...toButtonProps(aspect)}>
|
|
157
|
-
<Heading1 {...toTextAspectProps(aspect)}>Heading1</Heading1>
|
|
158
|
-
</Button>
|
|
159
|
-
</Column>
|
|
160
|
-
<Column>Semibold 600</Column>
|
|
161
|
-
<Column>28px (1.75rem)</Column>
|
|
162
|
-
<Column>32px</Column>
|
|
163
|
-
<Column>0 px</Column>
|
|
164
|
-
</Row>
|
|
165
|
-
<Row>
|
|
166
|
-
<Column>
|
|
167
|
-
<Button {...toButtonProps(aspect)}>
|
|
168
|
-
<Heading2 {...toTextAspectProps(aspect)}>Heading2</Heading2>
|
|
169
|
-
</Button>
|
|
170
|
-
</Column>
|
|
171
|
-
<Column>Semibold 600</Column>
|
|
172
|
-
<Column>20px (1.25rem)</Column>
|
|
173
|
-
<Column>28px</Column>
|
|
174
|
-
<Column>0 px</Column>
|
|
175
|
-
</Row>
|
|
176
|
-
<Row>
|
|
177
|
-
<Column>
|
|
178
|
-
<Button {...toButtonProps(aspect)}>
|
|
179
|
-
<Heading3 {...toTextAspectProps(aspect)}>Heading3</Heading3>
|
|
180
|
-
</Button>
|
|
181
|
-
</Column>
|
|
182
|
-
<Column>Semibold 600</Column>
|
|
183
|
-
<Column>16px (1 rem)</Column>
|
|
184
|
-
<Column>24px</Column>
|
|
185
|
-
<Column>0 px</Column>
|
|
186
|
-
</Row>
|
|
187
|
-
<Row>
|
|
188
|
-
<Column>
|
|
189
|
-
<Button {...toButtonProps(aspect)}>
|
|
190
|
-
<Heading4 {...toTextAspectProps(aspect)}>Heading4</Heading4>
|
|
191
|
-
</Button>
|
|
192
|
-
</Column>
|
|
193
|
-
<Column>Semibold 600</Column>
|
|
194
|
-
<Column>14px (0.875rem)</Column>
|
|
195
|
-
<Column>20px</Column>
|
|
196
|
-
<Column>0 px</Column>
|
|
197
|
-
</Row>
|
|
198
|
-
<Row gray>
|
|
199
|
-
<Column>
|
|
200
|
-
<Button {...toButtonProps(aspect)}>
|
|
201
|
-
<BodyLarge {...toTextAspectProps(aspect)}>BodyLarge</BodyLarge>
|
|
202
|
-
</Button>
|
|
203
|
-
</Column>
|
|
204
|
-
<Column>Reg 400 / Semibold 600</Column>
|
|
205
|
-
<Column>18px (1.125rem)</Column>
|
|
206
|
-
<Column>28px</Column>
|
|
207
|
-
<Column>0 px</Column>
|
|
208
|
-
</Row>
|
|
209
|
-
<Row gray>
|
|
210
|
-
<Column>
|
|
211
|
-
<Button {...toButtonProps(aspect)}>
|
|
212
|
-
<Body {...toTextAspectProps(aspect)}>Body</Body>
|
|
213
|
-
</Button>
|
|
214
|
-
</Column>
|
|
215
|
-
<Column>Reg 400 / Medium 500</Column>
|
|
216
|
-
<Column>14px (0.875rem)</Column>
|
|
217
|
-
<Column>20px</Column>
|
|
218
|
-
<Column>0 px</Column>
|
|
219
|
-
</Row>
|
|
220
|
-
<Row gray>
|
|
221
|
-
<Column>
|
|
222
|
-
<Button {...toButtonProps(aspect)}>
|
|
223
|
-
<Caption {...toTextAspectProps(aspect)}>Caption</Caption>
|
|
224
|
-
</Button>
|
|
225
|
-
</Column>
|
|
226
|
-
<Column>Regular 400</Column>
|
|
227
|
-
<Column>13px (0.8125rem)</Column>
|
|
228
|
-
<Column>16px</Column>
|
|
229
|
-
<Column>0 px</Column>
|
|
230
|
-
</Row>
|
|
231
|
-
<Row>
|
|
232
|
-
<Column>
|
|
233
|
-
<Button {...toButtonProps(aspect)}>
|
|
234
|
-
<Label1 {...toTextAspectProps(aspect)}>Label1</Label1>
|
|
235
|
-
</Button>
|
|
236
|
-
</Column>
|
|
237
|
-
<Column>Reg 400 / Medium 500</Column>
|
|
238
|
-
<Column>14px (0.875rem)</Column>
|
|
239
|
-
<Column>20px</Column>
|
|
240
|
-
<Column>0 px</Column>
|
|
241
|
-
</Row>
|
|
242
|
-
<Row>
|
|
243
|
-
<Column>
|
|
244
|
-
<Button {...toButtonProps(aspect)}>
|
|
245
|
-
<Label2 {...toTextAspectProps(aspect)}>Label2</Label2>
|
|
246
|
-
</Button>
|
|
247
|
-
</Column>
|
|
248
|
-
<Column>Regular 400</Column>
|
|
249
|
-
<Column>13px (0.8125rem)</Column>
|
|
250
|
-
<Column>16px</Column>
|
|
251
|
-
<Column>0 px</Column>
|
|
252
|
-
</Row>
|
|
253
|
-
</Table>
|
|
254
|
-
</div>
|
|
255
|
-
)
|
|
256
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { Canvas, Meta } from '@storybook/addon-docs';
|
|
2
|
-
import { TypographyTable, Button } from './components'
|
|
3
|
-
import { Heading3, Label1, Body } from '../typography'
|
|
4
|
-
|
|
5
|
-
<Meta title="Components/Typography" />
|
|
6
|
-
|
|
7
|
-
# Typography
|
|
8
|
-
|
|
9
|
-
All text that appears in the front-end should be wrapped by one of these components.
|
|
10
|
-
|
|
11
|
-
## Basic usage
|
|
12
|
-
|
|
13
|
-
When you are building from a mockup you will be clicking on elements and checking in the figma inspector to see what components you should use, and how you should configure them. With typography there are two relevant sections: Typography and Color.
|
|
14
|
-
|
|
15
|
-
### Typography: Ag
|
|
16
|
-
|
|
17
|
-
When you see text in a mockup you can click that text to see what kind of typographic component it represents. In the typography section of the figma inspector you will see a label Ag with a value like "Label1" or "Label1/emphasis". This is the name of the component you should use, and whether you should set the emphasis flag.
|
|
18
|
-
|
|
19
|
-
For example if you see "Ag Heading3".
|
|
20
|
-
|
|
21
|
-
<Canvas>
|
|
22
|
-
<Heading3>Heading 3, no modifiers</Heading3>
|
|
23
|
-
</Canvas>
|
|
24
|
-
|
|
25
|
-
If you see "Ag Label 1/emphasis" you should use a Label1 with emphasis set.
|
|
26
|
-
|
|
27
|
-
<Canvas>
|
|
28
|
-
<Label1 emphasis>Label 1, emphasis</Label1>
|
|
29
|
-
</Canvas>
|
|
30
|
-
|
|
31
|
-
### Colors: Text
|
|
32
|
-
|
|
33
|
-
Below the Typography section in the figma inspector you will see the Colors section. Here you will see a color swatch and a label like "Text/Default" or "Text/Subdued". In most cases you will see "Text/Default" and can proceed without any modifiers. When you do see a modifier you will be able to use it as is to configure your component.
|
|
34
|
-
|
|
35
|
-
<Canvas>
|
|
36
|
-
<Button><Body>Text/Default</Body></Button>
|
|
37
|
-
<Button><Body subdued>Text/Subdued</Body></Button>
|
|
38
|
-
<Button><Body light>Text/Light</Body></Button>
|
|
39
|
-
<Button primary><Body onPrimary>Text/onPrimary</Body></Button>
|
|
40
|
-
<Button critical><Body onCritical>Text/onCritical</Body></Button>
|
|
41
|
-
</Canvas>
|
|
42
|
-
|
|
43
|
-
In addition there are two less commonly used text colors: Text/Critical and Text/Success. These appear from time to time in mockups to indicate some problems (like an invalid field) or some big win (like a discount on a price).
|
|
44
|
-
|
|
45
|
-
<Canvas>
|
|
46
|
-
<Body critical>Text/Critical</Body>
|
|
47
|
-
<Body success>Text/Success</Body>
|
|
48
|
-
</Canvas>
|
|
49
|
-
|
|
50
|
-
## Recommended usage with i18n
|
|
51
|
-
|
|
52
|
-
In practice you will not be using these typographic components without i18n. In our previous projects i18n has usually looked something like this:
|
|
53
|
-
|
|
54
|
-
```tsx
|
|
55
|
-
<Body critical><T.Trans>YOU_LOSE</T.Trans></Body>
|
|
56
|
-
<Body success><T.Trans>YOU_WIN</T.Trans></Body>
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Or like this,
|
|
60
|
-
|
|
61
|
-
```tsx
|
|
62
|
-
<Body critical>{t(YOU_LOSE)}</Body>
|
|
63
|
-
<Body success>{t(YOU_WIN)}</Body>
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Instead we recommend wrapping the typographic components with i18n helpers and re-exporting them in your project.
|
|
67
|
-
|
|
68
|
-
```tsx
|
|
69
|
-
// my/typography.tsx
|
|
70
|
-
import { Body as _Body, IBodyProps } from '@edvisor/product-language'
|
|
71
|
-
import { useI18n } from 'your-i18n-library'
|
|
72
|
-
|
|
73
|
-
// something like this:
|
|
74
|
-
export const Body = (props: IBodyProps) => {
|
|
75
|
-
const { t } = useI18n()
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<_Body {...props}>{t(props.children)}</_Body>
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// then you can use it like this:
|
|
83
|
-
<Body success>YOU_WIN</Body>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Typography Table
|
|
87
|
-
|
|
88
|
-
<TypographyTable />
|