@nypl/design-system-react-components 0.25.5 → 0.25.9
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/CHANGELOG.md +91 -1
- package/README.md +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -0
- package/dist/components/Button/Button.d.ts +6 -6
- package/dist/components/Button/ButtonTypes.d.ts +0 -1
- package/dist/components/Card/Card.d.ts +6 -4
- package/dist/components/Checkbox/Checkbox.d.ts +3 -2
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +3 -2
- package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +8 -2
- package/dist/components/DatePicker/DatePicker.d.ts +3 -2
- package/dist/components/Form/Form.d.ts +2 -2
- package/dist/components/Heading/Heading.d.ts +7 -3
- package/dist/components/Heading/HeadingTypes.d.ts +6 -6
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +5 -2
- package/dist/components/HorizontalRule/HorizontalRule.d.ts +2 -2
- package/dist/components/Icons/Icon.d.ts +4 -4
- package/dist/components/Icons/IconSvgs.d.ts +1 -21
- package/dist/components/Icons/IconTypes.d.ts +1 -23
- package/dist/components/Image/Image.d.ts +11 -3
- package/dist/components/Image/ImageTypes.d.ts +3 -1
- package/dist/components/Link/LinkTypes.d.ts +1 -0
- package/dist/components/Logo/Logo.d.ts +28 -0
- package/dist/components/Logo/LogoSvgs.d.ts +18 -0
- package/dist/components/Logo/LogoTypes.d.ts +30 -0
- package/dist/components/Modal/Modal.d.ts +0 -4
- package/dist/components/Notification/Notification.d.ts +4 -2
- package/dist/components/Placeholder/Placeholder.d.ts +3 -5
- package/dist/components/Radio/Radio.d.ts +6 -5
- package/dist/components/RadioGroup/RadioGroup.d.ts +3 -2
- package/dist/components/SearchBar/SearchBar.d.ts +10 -2
- package/dist/components/Select/Select.d.ts +5 -2
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +8 -4
- package/dist/components/Slider/Slider.d.ts +3 -2
- package/dist/components/StatusBadge/StatusBadge.d.ts +2 -1
- package/dist/components/StructuredContent/StructuredContent.d.ts +41 -0
- package/dist/components/StructuredContent/StructuredContentTypes.d.ts +5 -0
- package/dist/components/Table/Table.d.ts +23 -0
- package/dist/components/Template/Template.d.ts +8 -3
- package/dist/components/Text/Text.d.ts +2 -2
- package/dist/components/TextInput/TextInput.d.ts +4 -3
- package/dist/components/Toggle/Toggle.d.ts +48 -0
- package/dist/components/Toggle/ToggleSizes.d.ts +4 -0
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +17 -6
- package/dist/design-system-react-components.cjs.development.js +5989 -5490
- package/dist/design-system-react-components.cjs.development.js.map +1 -1
- package/dist/design-system-react-components.cjs.production.min.js +1 -1
- package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
- package/dist/design-system-react-components.esm.js +6057 -5551
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +11 -4
- package/dist/styles.css +2 -2
- package/dist/theme/components/breadcrumb.d.ts +9 -0
- package/dist/theme/components/button.d.ts +0 -12
- package/dist/theme/components/card.d.ts +14 -2
- package/dist/theme/components/customTable.d.ts +47 -0
- package/dist/theme/components/fieldset.d.ts +2 -2
- package/dist/theme/components/global.d.ts +1 -1
- package/dist/theme/components/heading.d.ts +4 -0
- package/dist/theme/components/label.d.ts +1 -1
- package/dist/theme/components/link.d.ts +14 -1
- package/dist/theme/components/list.d.ts +0 -2
- package/dist/theme/components/logo.d.ts +4 -0
- package/dist/theme/components/notification.d.ts +8 -4
- package/dist/theme/components/searchBar.d.ts +7 -13
- package/dist/theme/components/select.d.ts +1 -0
- package/dist/theme/components/structuredContent.d.ts +33 -0
- package/dist/theme/components/template.d.ts +10 -10
- package/dist/theme/components/textInput.d.ts +2 -0
- package/dist/theme/components/toggle.d.ts +71 -0
- package/dist/theme/foundations/spacing.d.ts +2 -0
- package/dist/utils/utils.d.ts +10 -0
- package/package.json +2 -3
- package/src/__tests__/utils/utils.test.ts +23 -1
- package/src/components/Accordion/Accordion.stories.mdx +15 -14
- package/src/components/Autosuggest/Autosuggest.stories.mdx +2 -1
- package/src/components/Autosuggest/Autosuggest.stories.tsx +24 -48
- package/src/components/Autosuggest/_Autosuggest.scss +2 -6
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +50 -14
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +20 -0
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +198 -0
- package/src/components/Button/Button.stories.mdx +93 -48
- package/src/components/Button/Button.test.tsx +0 -12
- package/src/components/Button/Button.tsx +7 -8
- package/src/components/Button/ButtonTypes.tsx +0 -1
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +0 -12
- package/src/components/Card/Card.stories.mdx +246 -64
- package/src/components/Card/Card.test.tsx +45 -22
- package/src/components/Card/Card.tsx +26 -13
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +75 -37
- package/src/components/Chakra/Box.stories.mdx +3 -3
- package/src/components/Chakra/Center.stories.mdx +5 -5
- package/src/components/Chakra/Grid.stories.mdx +14 -17
- package/src/components/Chakra/Stack.stories.mdx +2 -2
- package/src/components/Checkbox/Checkbox.stories.mdx +37 -15
- package/src/components/Checkbox/Checkbox.tsx +13 -8
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +48 -16
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +14 -10
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +6 -3
- package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +151 -0
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +36 -23
- package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +85 -0
- package/src/components/DatePicker/DatePicker.stories.mdx +63 -18
- package/src/components/DatePicker/DatePicker.test.tsx +8 -6
- package/src/components/DatePicker/DatePicker.tsx +10 -6
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +41 -22
- package/src/components/Fieldset/Fieldset.stories.mdx +19 -8
- package/src/components/Form/Form.stories.mdx +49 -41
- package/src/components/Form/Form.tsx +5 -4
- package/src/components/Grid/SimpleGrid.stories.mdx +26 -26
- package/src/components/Heading/Heading.stories.mdx +59 -23
- package/src/components/Heading/Heading.test.tsx +82 -18
- package/src/components/Heading/Heading.tsx +31 -31
- package/src/components/Heading/HeadingTypes.tsx +6 -6
- package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +71 -0
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +55 -27
- package/src/components/HelperErrorText/HelperErrorText.test.tsx +42 -15
- package/src/components/HelperErrorText/HelperErrorText.tsx +24 -24
- package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +41 -4
- package/src/components/Hero/Hero.stories.mdx +72 -53
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +9 -8
- package/src/components/HorizontalRule/HorizontalRule.tsx +2 -4
- package/src/components/Icons/Icon.stories.mdx +77 -75
- package/src/components/Icons/Icon.tsx +4 -5
- package/src/components/Icons/IconSvgs.tsx +2 -42
- package/src/components/Icons/IconTypes.tsx +1 -24
- package/src/components/Image/Image.stories.mdx +214 -104
- package/src/components/Image/Image.test.tsx +10 -0
- package/src/components/Image/Image.tsx +21 -10
- package/src/components/Image/ImageTypes.ts +2 -0
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +24 -8
- package/src/components/Label/Label.stories.mdx +21 -20
- package/src/components/Link/Link.stories.mdx +103 -53
- package/src/components/Link/Link.test.tsx +108 -7
- package/src/components/Link/Link.tsx +58 -19
- package/src/components/Link/LinkTypes.tsx +1 -0
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +261 -0
- package/src/components/List/List.stories.mdx +36 -24
- package/src/components/Logo/Logo.stories.mdx +220 -0
- package/src/components/Logo/Logo.test.tsx +98 -0
- package/src/components/Logo/Logo.tsx +97 -0
- package/src/components/Logo/LogoSvgs.tsx +34 -0
- package/src/components/Logo/LogoTypes.tsx +32 -0
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +71 -0
- package/src/components/Modal/Modal.stories.mdx +20 -5
- package/src/components/Modal/Modal.tsx +2 -8
- package/src/components/Notification/Notification.stories.mdx +96 -40
- package/src/components/Notification/Notification.test.tsx +62 -16
- package/src/components/Notification/Notification.tsx +26 -9
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +121 -0
- package/src/components/Pagination/Pagination.stories.mdx +18 -8
- package/src/components/Pagination/Pagination.tsx +1 -1
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +42 -0
- package/src/components/Placeholder/Placeholder.tsx +7 -14
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +74 -46
- package/src/components/Radio/Radio.stories.mdx +39 -19
- package/src/components/Radio/Radio.tsx +13 -9
- package/src/components/RadioGroup/RadioGroup.stories.mdx +50 -16
- package/src/components/RadioGroup/RadioGroup.tsx +15 -11
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +6 -3
- package/src/components/SearchBar/SearchBar.Test.tsx +114 -22
- package/src/components/SearchBar/SearchBar.stories.mdx +111 -33
- package/src/components/SearchBar/SearchBar.tsx +57 -33
- package/src/components/Select/Select.stories.mdx +177 -66
- package/src/components/Select/Select.test.tsx +2 -2
- package/src/components/Select/Select.tsx +22 -12
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +50 -16
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +8 -4
- package/src/components/Slider/Slider.stories.mdx +74 -23
- package/src/components/Slider/Slider.test.tsx +35 -0
- package/src/components/Slider/Slider.tsx +22 -11
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +60 -30
- package/src/components/StatusBadge/StatusBadge.stories.mdx +33 -18
- package/src/components/StatusBadge/StatusBadge.tsx +2 -1
- package/src/components/StructuredContent/StructuredContent.stories.mdx +427 -0
- package/src/components/StructuredContent/StructuredContent.test.tsx +376 -0
- package/src/components/StructuredContent/StructuredContent.tsx +153 -0
- package/src/components/StructuredContent/StructuredContentTypes.tsx +5 -0
- package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +283 -0
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +32 -83
- package/src/components/StyleGuide/Breakpoints.stories.mdx +1 -11
- package/src/components/StyleGuide/Buttons.stories.mdx +3 -18
- package/src/components/StyleGuide/ColorCard.tsx +1 -2
- package/src/components/StyleGuide/Colors.stories.mdx +3 -11
- package/src/components/StyleGuide/DesignTokens.stories.mdx +3 -8
- package/src/components/StyleGuide/Forms.stories.mdx +2 -10
- package/src/components/StyleGuide/Iconography.stories.mdx +8 -34
- package/src/components/StyleGuide/Spacing.stories.mdx +3 -14
- package/src/components/StyleGuide/Typography.stories.mdx +64 -76
- package/src/components/Table/Table.stories.mdx +66 -0
- package/src/components/Table/Table.test.tsx +60 -0
- package/src/components/Table/Table.tsx +116 -0
- package/src/components/Tabs/Tabs.stories.mdx +19 -13
- package/src/components/Tabs/Tabs.test.tsx +1 -1
- package/src/components/Template/Template.stories.mdx +57 -49
- package/src/components/Template/Template.test.tsx +65 -5
- package/src/components/Template/Template.tsx +35 -5
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +76 -0
- package/src/components/Text/Text.stories.mdx +33 -11
- package/src/components/Text/Text.tsx +2 -2
- package/src/components/TextInput/TextInput.stories.mdx +84 -17
- package/src/components/TextInput/TextInput.test.tsx +96 -0
- package/src/components/TextInput/TextInput.tsx +12 -8
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +240 -0
- package/src/components/Toggle/Toggle.stories.mdx +200 -0
- package/src/components/Toggle/Toggle.test.tsx +140 -0
- package/src/components/Toggle/Toggle.tsx +123 -0
- package/src/components/Toggle/ToggleSizes.tsx +4 -0
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +255 -0
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +96 -25
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +103 -1
- package/src/components/VideoPlayer/VideoPlayer.tsx +72 -22
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +57 -3
- package/src/docs/Chakra.stories.mdx +5 -8
- package/src/docs/Intro.stories.mdx +2 -2
- package/src/index.ts +13 -4
- package/src/styles/base/_03-base.scss +1 -1
- package/src/styles/base/_place-holder.scss +7 -7
- package/src/styles.scss +1 -5
- package/src/theme/components/breadcrumb.ts +14 -4
- package/src/theme/components/button.ts +5 -12
- package/src/theme/components/card.ts +9 -7
- package/src/theme/components/checkbox.ts +1 -1
- package/src/theme/components/customTable.ts +50 -0
- package/src/theme/components/datePicker.ts +1 -1
- package/src/theme/components/global.ts +7 -7
- package/src/theme/components/heading.ts +13 -11
- package/src/theme/components/helperErrorText.ts +1 -1
- package/src/theme/components/icon.ts +2 -2
- package/src/theme/components/image.ts +9 -1
- package/src/theme/components/link.ts +17 -5
- package/src/theme/components/list.ts +1 -3
- package/src/theme/components/logo.ts +54 -0
- package/src/theme/components/notification.ts +9 -7
- package/src/theme/components/searchBar.ts +7 -13
- package/src/theme/components/select.ts +1 -0
- package/src/theme/components/statusBadge.ts +1 -1
- package/src/theme/components/structuredContent.ts +54 -0
- package/src/theme/components/template.ts +10 -10
- package/src/theme/components/text.ts +6 -6
- package/src/theme/components/textInput.ts +1 -0
- package/src/theme/components/toggle.ts +69 -0
- package/src/theme/components/videoPlayer.ts +0 -2
- package/src/theme/foundations/global.ts +2 -2
- package/src/theme/foundations/spacing.ts +3 -0
- package/src/theme/foundations/typography.ts +84 -12
- package/src/theme/index.ts +8 -0
- package/src/utils/componentCategories.ts +4 -2
- package/src/utils/utils.ts +17 -0
- package/dist/__tests__/utils/bem.test.d.ts +0 -1
- package/dist/components/CardEdition/CardEdition.d.ts +0 -21
- package/dist/components/CardEdition/CardEdition.stories.d.ts +0 -27
- package/dist/components/Input/Input.d.ts +0 -36
- package/dist/components/Input/Input.stories.d.ts +0 -29
- package/dist/components/Input/InputTypes.d.ts +0 -6
- package/dist/components/StyleGuide/UIDocCard.d.ts +0 -11
- package/dist/helpers/CSSVariablesHelper.d.ts +0 -3
- package/dist/helpers/getCSSVariable.d.ts +0 -1
- package/dist/interfaces.d.ts +0 -3
- package/dist/utils/bem.d.ts +0 -1
- package/src/__tests__/utils/bem.test.ts +0 -37
- package/src/components/CardEdition/CardEdition.stories.tsx +0 -122
- package/src/components/CardEdition/CardEdition.test.tsx +0 -395
- package/src/components/CardEdition/CardEdition.tsx +0 -60
- package/src/components/CardEdition/_CardEdition.scss +0 -137
- package/src/components/Input/Input.stories.tsx +0 -133
- package/src/components/Input/Input.test.tsx +0 -266
- package/src/components/Input/Input.tsx +0 -81
- package/src/components/Input/InputTypes.tsx +0 -8
- package/src/components/Input/_Input.scss +0 -78
- package/src/components/StyleGuide/UIDocCard.tsx +0 -36
- package/src/helpers/CSSVariablesHelper.tsx +0 -34
- package/src/helpers/getCSSVariable.tsx +0 -5
- package/src/interfaces.ts +0 -3
- package/src/utils/bem.ts +0 -44
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Meta,
|
|
3
|
-
Story,
|
|
4
|
-
Canvas,
|
|
5
2
|
ArgsTable,
|
|
3
|
+
Canvas,
|
|
6
4
|
Description,
|
|
7
|
-
|
|
5
|
+
Meta,
|
|
6
|
+
Story,
|
|
7
|
+
} from "@storybook/addon-docs";
|
|
8
8
|
import { withDesign } from "storybook-addon-designs";
|
|
9
9
|
|
|
10
10
|
import { Tabs, TabList, Tab, TabPanels, TabPanel } from "./Tabs";
|
|
@@ -18,17 +18,21 @@ import DSProvider from "../../theme/provider";
|
|
|
18
18
|
parameters={{
|
|
19
19
|
design: {
|
|
20
20
|
type: "figma",
|
|
21
|
-
url:
|
|
22
|
-
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=36835%3A26464",
|
|
21
|
+
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=36835%3A26464",
|
|
23
22
|
},
|
|
24
23
|
jest: ["Tabs.test.tsx"],
|
|
25
24
|
}}
|
|
26
25
|
argTypes={{
|
|
27
26
|
children: { table: { disable: true } },
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
contentData: { control: false },
|
|
28
|
+
defaultIndex: {
|
|
29
|
+
table: { defaultValue: { summary: 0 } },
|
|
30
|
+
},
|
|
31
|
+
id: { control: false },
|
|
32
|
+
onChange: { control: false },
|
|
33
|
+
useHash: {
|
|
34
|
+
table: { defaultValue: { summary: false } },
|
|
35
|
+
},
|
|
32
36
|
}}
|
|
33
37
|
/>
|
|
34
38
|
|
|
@@ -89,18 +93,20 @@ export const animalCrossing = [
|
|
|
89
93
|
|
|
90
94
|
<Canvas withToolbar>
|
|
91
95
|
<Story
|
|
92
|
-
name="
|
|
96
|
+
name="Tabs with Controls"
|
|
93
97
|
args={{
|
|
98
|
+
contentData: animalCrossing,
|
|
94
99
|
defaultIndex: 0,
|
|
100
|
+
id: "tabs-id",
|
|
101
|
+
onChange: undefined,
|
|
95
102
|
useHash: false,
|
|
96
|
-
contentData: animalCrossing,
|
|
97
103
|
}}
|
|
98
104
|
>
|
|
99
105
|
{(args) => <Tabs {...args} />}
|
|
100
106
|
</Story>
|
|
101
107
|
</Canvas>
|
|
102
108
|
|
|
103
|
-
<ArgsTable story="
|
|
109
|
+
<ArgsTable story="Tabs with Controls" />
|
|
104
110
|
|
|
105
111
|
## Composing with a Data Object
|
|
106
112
|
|
|
@@ -208,7 +208,7 @@ describe("Tabs", () => {
|
|
|
208
208
|
expect(selectedIndex).toEqual(1);
|
|
209
209
|
});
|
|
210
210
|
|
|
211
|
-
it("should throw warning when both the 'data'
|
|
211
|
+
it("should throw warning when both the 'data' prop and children are passed", () => {
|
|
212
212
|
const warn = jest.spyOn(console, "warn");
|
|
213
213
|
render(
|
|
214
214
|
<Tabs contentData={animalCrossing}>
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Meta,
|
|
3
|
-
Story,
|
|
4
|
-
Canvas,
|
|
5
2
|
ArgsTable,
|
|
3
|
+
Canvas,
|
|
6
4
|
Description,
|
|
7
|
-
|
|
5
|
+
Meta,
|
|
6
|
+
Story,
|
|
7
|
+
} from "@storybook/addon-docs";
|
|
8
8
|
import { withDesign } from "storybook-addon-designs";
|
|
9
9
|
|
|
10
|
+
import Accordion from "../Accordion/Accordion";
|
|
11
|
+
import { faqContent } from "../Accordion/Accordion.stories.mdx";
|
|
12
|
+
import Breadcrumbs from "../Breadcrumbs/Breadcrumbs";
|
|
13
|
+
import Button from "../Button/Button";
|
|
14
|
+
import Card, { CardHeading, CardContent, CardActions } from "../Card/Card";
|
|
15
|
+
import Form, { FormRow, FormField } from "../Form/Form";
|
|
16
|
+
import Heading from "../Heading/Heading";
|
|
17
|
+
import { HeadingLevels } from "../Heading/HeadingTypes";
|
|
18
|
+
import Hero from "../Hero/Hero";
|
|
19
|
+
import HorizontalRule from "../HorizontalRule/HorizontalRule";
|
|
20
|
+
import { HeroTypes } from "../Hero/HeroTypes";
|
|
21
|
+
import Image from "../Image/Image";
|
|
22
|
+
import { ImageRatios, ImageSizes } from "../Image/ImageTypes";
|
|
23
|
+
import Link from "../Link/Link";
|
|
24
|
+
import Notification, {
|
|
25
|
+
NotificationContent,
|
|
26
|
+
NotificationHeading,
|
|
27
|
+
NotificationProps,
|
|
28
|
+
} from "../Notification/Notification";
|
|
29
|
+
import Placeholder from "../Placeholder/Placeholder";
|
|
10
30
|
import {
|
|
11
31
|
Template,
|
|
12
32
|
TemplateHeader,
|
|
@@ -18,27 +38,7 @@ import {
|
|
|
18
38
|
TemplateFooter,
|
|
19
39
|
TemplateAppContainer,
|
|
20
40
|
} from "./Template";
|
|
21
|
-
import Placeholder from "../Placeholder/Placeholder";
|
|
22
|
-
import Hero from "../Hero/Hero";
|
|
23
|
-
import { HeroTypes } from "../Hero/HeroTypes";
|
|
24
|
-
import Image from "../Image/Image";
|
|
25
|
-
import { ImageRatios, ImageSizes } from "../Image/ImageTypes";
|
|
26
|
-
import Breadcrumbs from "../Breadcrumbs/Breadcrumbs";
|
|
27
|
-
import HorizontalRule from "../HorizontalRule/HorizontalRule";
|
|
28
|
-
import Heading from "../Heading/Heading";
|
|
29
|
-
import { HeadingLevels } from "../Heading/HeadingTypes";
|
|
30
|
-
import Notification, {
|
|
31
|
-
NotificationContent,
|
|
32
|
-
NotificationHeading,
|
|
33
|
-
NotificationProps,
|
|
34
|
-
} from "../Notification/Notification";
|
|
35
|
-
import Form, { FormRow, FormField } from "../Form/Form";
|
|
36
41
|
import TextInput from "../TextInput/TextInput";
|
|
37
|
-
import Button from "../Button/Button";
|
|
38
|
-
import Link from "../Link/Link";
|
|
39
|
-
import Card, { CardHeading, CardContent, CardActions } from "../Card/Card";
|
|
40
|
-
import Accordion from "../Accordion/Accordion";
|
|
41
|
-
import { faqContent } from "../Accordion/Accordion.stories.mdx";
|
|
42
42
|
import { NotificationTypes } from "../Notification/NotificationTypes";
|
|
43
43
|
import { getCategory } from "../../utils/componentCategories";
|
|
44
44
|
|
|
@@ -49,8 +49,7 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
49
49
|
parameters={{
|
|
50
50
|
design: {
|
|
51
51
|
type: "figma",
|
|
52
|
-
url:
|
|
53
|
-
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11982%3A47778",
|
|
52
|
+
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11982%3A47778",
|
|
54
53
|
},
|
|
55
54
|
}}
|
|
56
55
|
/>
|
|
@@ -60,23 +59,26 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
60
59
|
| Component Version | DS Version |
|
|
61
60
|
| ----------------- | ---------- |
|
|
62
61
|
| Added | `0.3.6` |
|
|
63
|
-
| Latest | `0.25.
|
|
62
|
+
| Latest | `0.25.9` |
|
|
64
63
|
|
|
65
64
|
## TemplateAppContainer Component
|
|
66
65
|
|
|
67
66
|
<Description of={TemplateAppContainer} />
|
|
68
67
|
|
|
68
|
+
If you have a custom `Footer` component that _already_ renders an HTML `<footer>`
|
|
69
|
+
element, set `renderFooterElement` to false so only one `<footer>` element is rendered.
|
|
70
|
+
|
|
69
71
|
<b>This is the recommended way to render an app page template.</b>
|
|
70
72
|
|
|
71
73
|
```jsx
|
|
72
74
|
import { TemplateAppContainer } from "@nypl/design-system-react-components";
|
|
73
75
|
|
|
74
76
|
<TemplateAppContainer
|
|
75
|
-
header={<Placeholder
|
|
77
|
+
header={<Placeholder variant="short">NYPL Header</Placeholder>}
|
|
76
78
|
breakout={
|
|
77
79
|
<>
|
|
78
|
-
<Placeholder
|
|
79
|
-
<Placeholder
|
|
80
|
+
<Placeholder variant="short">Breadcrumbs</Placeholder>
|
|
81
|
+
<Placeholder variant="short">Hero</Placeholder>
|
|
80
82
|
</>
|
|
81
83
|
}
|
|
82
84
|
sidebar="left"
|
|
@@ -85,10 +87,10 @@ import { TemplateAppContainer } from "@nypl/design-system-react-components";
|
|
|
85
87
|
contentPrimary={
|
|
86
88
|
<>
|
|
87
89
|
<Placeholder>Main Content</Placeholder>
|
|
88
|
-
<Placeholder
|
|
90
|
+
<Placeholder variant="short">More Content</Placeholder>
|
|
89
91
|
</>
|
|
90
92
|
}
|
|
91
|
-
footer={<Placeholder
|
|
93
|
+
footer={<Placeholder variant="short">Footer</Placeholder>}
|
|
92
94
|
/>;
|
|
93
95
|
```
|
|
94
96
|
|
|
@@ -96,31 +98,36 @@ import { TemplateAppContainer } from "@nypl/design-system-react-components";
|
|
|
96
98
|
<Story
|
|
97
99
|
name="TemplateAppContainer Component"
|
|
98
100
|
args={{
|
|
99
|
-
header: <Placeholder modifiers={["short"]}>NYPL Header</Placeholder>,
|
|
100
101
|
breakout: (
|
|
101
102
|
<>
|
|
102
|
-
<Placeholder
|
|
103
|
-
<Placeholder
|
|
103
|
+
<Placeholder variant="short">Breadcrumbs</Placeholder>
|
|
104
|
+
<Placeholder variant="short">Hero</Placeholder>
|
|
104
105
|
</>
|
|
105
106
|
),
|
|
106
|
-
sidebar: "left",
|
|
107
|
-
contentTop: <Placeholder>Content Top</Placeholder>,
|
|
108
|
-
contentSidebar: <Placeholder>Left Sidebar</Placeholder>,
|
|
109
107
|
contentPrimary: (
|
|
110
108
|
<>
|
|
111
109
|
<Placeholder>Main Content</Placeholder>
|
|
112
|
-
<Placeholder
|
|
110
|
+
<Placeholder variant="short">More Content</Placeholder>
|
|
113
111
|
</>
|
|
114
112
|
),
|
|
115
|
-
|
|
113
|
+
contentSidebar: <Placeholder>Left Sidebar</Placeholder>,
|
|
114
|
+
contentTop: <Placeholder>Content Top</Placeholder>,
|
|
115
|
+
footer: <Placeholder variant="short">Footer</Placeholder>,
|
|
116
|
+
header: <Placeholder variant="short">NYPL Header</Placeholder>,
|
|
117
|
+
sidebar: "left",
|
|
118
|
+
renderFooterElement: true,
|
|
116
119
|
}}
|
|
117
120
|
argTypes={{
|
|
118
|
-
header: { control: false },
|
|
119
121
|
breakout: { control: false },
|
|
120
|
-
contentTop: { control: false },
|
|
121
|
-
contentSidebar: { control: false },
|
|
122
122
|
contentPrimary: { control: false },
|
|
123
|
+
contentSidebar: { control: false },
|
|
124
|
+
contentTop: { control: false },
|
|
123
125
|
footer: { control: false },
|
|
126
|
+
header: { control: false },
|
|
127
|
+
sidebar: {
|
|
128
|
+
control: false,
|
|
129
|
+
table: { defaultValue: { summary: "none" } },
|
|
130
|
+
},
|
|
124
131
|
}}
|
|
125
132
|
>
|
|
126
133
|
{(args) => <TemplateAppContainer {...args} />}
|
|
@@ -160,7 +167,7 @@ import {
|
|
|
160
167
|
</TemplateBreakout>
|
|
161
168
|
</TemplateHeader>
|
|
162
169
|
|
|
163
|
-
<TemplateContent>
|
|
170
|
+
<TemplateContent sidebar="...">
|
|
164
171
|
<TemplateContentTop>
|
|
165
172
|
// ...
|
|
166
173
|
</TemplateContentTop>
|
|
@@ -189,15 +196,16 @@ import {
|
|
|
189
196
|
contentTop: { table: { disable: true } },
|
|
190
197
|
footer: { table: { disable: true } },
|
|
191
198
|
header: { table: { disable: true } },
|
|
199
|
+
sidebar: { description: "Only used in Storybook." },
|
|
192
200
|
}}
|
|
193
201
|
>
|
|
194
202
|
{(args) => (
|
|
195
203
|
<Template>
|
|
196
204
|
<TemplateHeader>
|
|
197
|
-
<Placeholder
|
|
205
|
+
<Placeholder variant="short">NYPL Header</Placeholder>
|
|
198
206
|
<TemplateBreakout>
|
|
199
|
-
<Placeholder
|
|
200
|
-
<Placeholder
|
|
207
|
+
<Placeholder variant="short">Breadcrumbs</Placeholder>
|
|
208
|
+
<Placeholder variant="short">Hero</Placeholder>
|
|
201
209
|
</TemplateBreakout>
|
|
202
210
|
</TemplateHeader>
|
|
203
211
|
<TemplateContent sidebar={args.sidebar}>
|
|
@@ -211,7 +219,7 @@ import {
|
|
|
211
219
|
)}
|
|
212
220
|
<TemplateContentPrimary>
|
|
213
221
|
<Placeholder>Main Content</Placeholder>
|
|
214
|
-
<Placeholder
|
|
222
|
+
<Placeholder variant="short">More Content</Placeholder>
|
|
215
223
|
</TemplateContentPrimary>
|
|
216
224
|
{args.sidebar === "right" && (
|
|
217
225
|
<TemplateContentSidebar>
|
|
@@ -220,7 +228,7 @@ import {
|
|
|
220
228
|
)}
|
|
221
229
|
</TemplateContent>
|
|
222
230
|
<TemplateFooter>
|
|
223
|
-
<Placeholder
|
|
231
|
+
<Placeholder variant="short">Footer</Placeholder>
|
|
224
232
|
</TemplateFooter>
|
|
225
233
|
</Template>
|
|
226
234
|
)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { render, screen } from "@testing-library/react";
|
|
3
3
|
import { axe } from "jest-axe";
|
|
4
|
+
import renderer from "react-test-renderer";
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
7
|
Template,
|
|
@@ -15,11 +16,11 @@ import {
|
|
|
15
16
|
} from "./Template";
|
|
16
17
|
import Placeholder from "../Placeholder/Placeholder";
|
|
17
18
|
|
|
18
|
-
const header = <Placeholder
|
|
19
|
+
const header = <Placeholder variant="short">NYPL Header</Placeholder>;
|
|
19
20
|
const breakout = (
|
|
20
21
|
<>
|
|
21
|
-
<Placeholder
|
|
22
|
-
<Placeholder
|
|
22
|
+
<Placeholder variant="short">Breadcrumbs</Placeholder>
|
|
23
|
+
<Placeholder variant="short">Hero</Placeholder>
|
|
23
24
|
</>
|
|
24
25
|
);
|
|
25
26
|
const sidebar = "left";
|
|
@@ -28,10 +29,10 @@ const contentSidebar = <Placeholder>Left Sidebar</Placeholder>;
|
|
|
28
29
|
const contentPrimary = (
|
|
29
30
|
<>
|
|
30
31
|
<Placeholder>Main Content</Placeholder>
|
|
31
|
-
<Placeholder
|
|
32
|
+
<Placeholder variant="short">More Content</Placeholder>
|
|
32
33
|
</>
|
|
33
34
|
);
|
|
34
|
-
const footer = <Placeholder
|
|
35
|
+
const footer = <Placeholder variant="short">Footer</Placeholder>;
|
|
35
36
|
|
|
36
37
|
describe("TemplateAppContainer accessibility", () => {
|
|
37
38
|
it("passes axe accessibility test", async () => {
|
|
@@ -93,6 +94,44 @@ describe("TemplateAppContainer component", () => {
|
|
|
93
94
|
expect(screen.getByText("More Content")).toBeInTheDocument();
|
|
94
95
|
expect(screen.getByText("Footer")).toBeInTheDocument();
|
|
95
96
|
});
|
|
97
|
+
|
|
98
|
+
it("renders only one footer in a custom footer component", () => {
|
|
99
|
+
const customFooter = <footer>Custom Footer</footer>;
|
|
100
|
+
render(
|
|
101
|
+
<TemplateAppContainer
|
|
102
|
+
header={header}
|
|
103
|
+
breakout={breakout}
|
|
104
|
+
sidebar={sidebar}
|
|
105
|
+
contentTop={contentTop}
|
|
106
|
+
contentSidebar={contentSidebar}
|
|
107
|
+
contentPrimary={contentPrimary}
|
|
108
|
+
footer={customFooter}
|
|
109
|
+
renderFooterElement={false}
|
|
110
|
+
/>
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
expect(screen.getAllByRole("contentinfo")).toHaveLength(1);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("consoles a warning when a footer element was passed without setting `renderFooterElement` to false", () => {
|
|
117
|
+
const warn = jest.spyOn(console, "warn");
|
|
118
|
+
const customFooter = <footer>Custom Footer</footer>;
|
|
119
|
+
render(
|
|
120
|
+
<TemplateAppContainer
|
|
121
|
+
header={header}
|
|
122
|
+
breakout={breakout}
|
|
123
|
+
sidebar={sidebar}
|
|
124
|
+
contentTop={contentTop}
|
|
125
|
+
contentSidebar={contentSidebar}
|
|
126
|
+
contentPrimary={contentPrimary}
|
|
127
|
+
footer={customFooter}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
130
|
+
expect(warn).toHaveBeenCalledWith(
|
|
131
|
+
"`TemplateFooter`: An HTML `footer` element was passed in. Set " +
|
|
132
|
+
"`renderFooterElement` to `false` to avoid nested HTML `footer` elements."
|
|
133
|
+
);
|
|
134
|
+
});
|
|
96
135
|
});
|
|
97
136
|
|
|
98
137
|
describe("Template components", () => {
|
|
@@ -121,4 +160,25 @@ describe("Template components", () => {
|
|
|
121
160
|
expect(screen.getByText("More Content")).toBeInTheDocument();
|
|
122
161
|
expect(screen.getByText("Footer")).toBeInTheDocument();
|
|
123
162
|
});
|
|
163
|
+
|
|
164
|
+
it("Renders the UI snapshot correctly", () => {
|
|
165
|
+
const basic = renderer
|
|
166
|
+
.create(
|
|
167
|
+
<Template>
|
|
168
|
+
<TemplateHeader>
|
|
169
|
+
{header}
|
|
170
|
+
<TemplateBreakout>{breakout}</TemplateBreakout>
|
|
171
|
+
</TemplateHeader>
|
|
172
|
+
<TemplateContent sidebar={sidebar}>
|
|
173
|
+
<TemplateContentTop>{contentTop}</TemplateContentTop>
|
|
174
|
+
<TemplateContentSidebar>{contentSidebar}</TemplateContentSidebar>
|
|
175
|
+
<TemplateContentPrimary>{contentPrimary}</TemplateContentPrimary>
|
|
176
|
+
</TemplateContent>
|
|
177
|
+
<TemplateFooter>{footer}</TemplateFooter>
|
|
178
|
+
</Template>
|
|
179
|
+
)
|
|
180
|
+
.toJSON();
|
|
181
|
+
|
|
182
|
+
expect(basic).toMatchSnapshot();
|
|
183
|
+
});
|
|
124
184
|
});
|
|
@@ -2,13 +2,19 @@ import * as React from "react";
|
|
|
2
2
|
import { Box, useStyleConfig } from "@chakra-ui/react";
|
|
3
3
|
|
|
4
4
|
export interface TemplateProps {}
|
|
5
|
+
export interface TemplateFooterProps {
|
|
6
|
+
/** Flag to render an HTML footer element. True by default. */
|
|
7
|
+
renderFooterElement?: boolean;
|
|
8
|
+
}
|
|
5
9
|
export interface TemplateSidebarProps {
|
|
6
10
|
/** Renders the `TemplateContentSidebar` component either on the left or
|
|
7
11
|
* right side of the `TemplateContentPrimary` component. */
|
|
8
12
|
sidebar?: "none" | "left" | "right";
|
|
9
13
|
}
|
|
10
14
|
export interface TemplateContentProps extends TemplateSidebarProps {}
|
|
11
|
-
export interface TemplateAppContainerProps
|
|
15
|
+
export interface TemplateAppContainerProps
|
|
16
|
+
extends TemplateFooterProps,
|
|
17
|
+
TemplateSidebarProps {
|
|
12
18
|
/** DOM that will be rendered in the `TemplateBreakout` component section. */
|
|
13
19
|
breakout?: React.ReactElement;
|
|
14
20
|
/** DOM that will be rendered in the `TemplateContentPrimary` component section. */
|
|
@@ -152,10 +158,29 @@ const TemplateContentSidebar = (
|
|
|
152
158
|
/**
|
|
153
159
|
* This optional component should be the last child of the `Template`
|
|
154
160
|
* component. This is rendered as an HTML `<footer>` element and spans the full
|
|
155
|
-
* width of the page.
|
|
161
|
+
* width of the page. If an HTML `<footer>` element is already passed in a
|
|
162
|
+
* custom component, set `renderFooterElement` to `false`.
|
|
156
163
|
*/
|
|
157
|
-
const TemplateFooter = (
|
|
158
|
-
|
|
164
|
+
const TemplateFooter = ({
|
|
165
|
+
children,
|
|
166
|
+
renderFooterElement = true,
|
|
167
|
+
}: React.PropsWithChildren<TemplateFooterProps>) => {
|
|
168
|
+
let footerElement = <>{children}</>;
|
|
169
|
+
|
|
170
|
+
// The user wants to render the `footer` HTML element.
|
|
171
|
+
if (renderFooterElement) {
|
|
172
|
+
// But give a warning if one was passed.
|
|
173
|
+
React.Children.map(children, (child: React.ReactElement) => {
|
|
174
|
+
if (child?.type === "footer" || child?.props?.mdxType === "footer") {
|
|
175
|
+
console.warn(
|
|
176
|
+
"`TemplateFooter`: An HTML `footer` element was passed in. Set " +
|
|
177
|
+
"`renderFooterElement` to `false` to avoid nested HTML `footer` elements."
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
footerElement = <Box as="footer">{children}</Box>;
|
|
182
|
+
}
|
|
183
|
+
return footerElement;
|
|
159
184
|
};
|
|
160
185
|
|
|
161
186
|
/**
|
|
@@ -176,6 +201,7 @@ const TemplateAppContainer = (
|
|
|
176
201
|
footer,
|
|
177
202
|
header,
|
|
178
203
|
sidebar = "none",
|
|
204
|
+
renderFooterElement = true,
|
|
179
205
|
} = props;
|
|
180
206
|
const breakoutElem = breakout && (
|
|
181
207
|
<TemplateBreakout>{breakout}</TemplateBreakout>
|
|
@@ -208,7 +234,11 @@ const TemplateAppContainer = (
|
|
|
208
234
|
|
|
209
235
|
{sidebar === "right" && contentSidebarElem}
|
|
210
236
|
</TemplateContent>
|
|
211
|
-
{footer &&
|
|
237
|
+
{footer && (
|
|
238
|
+
<TemplateFooter renderFooterElement={renderFooterElement}>
|
|
239
|
+
{footer}
|
|
240
|
+
</TemplateFooter>
|
|
241
|
+
)}
|
|
212
242
|
</Template>
|
|
213
243
|
);
|
|
214
244
|
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Template components Renders the UI snapshot correctly 1`] = `
|
|
4
|
+
<div
|
|
5
|
+
className="nypl-ds css-0"
|
|
6
|
+
>
|
|
7
|
+
<header
|
|
8
|
+
className="css-0"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
className="placeholder placeholder-short"
|
|
12
|
+
>
|
|
13
|
+
NYPL Header
|
|
14
|
+
</div>
|
|
15
|
+
<div
|
|
16
|
+
className="css-0"
|
|
17
|
+
>
|
|
18
|
+
<div
|
|
19
|
+
className="placeholder placeholder-short"
|
|
20
|
+
>
|
|
21
|
+
Breadcrumbs
|
|
22
|
+
</div>
|
|
23
|
+
<div
|
|
24
|
+
className="placeholder placeholder-short"
|
|
25
|
+
>
|
|
26
|
+
Hero
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</header>
|
|
30
|
+
<main
|
|
31
|
+
className="css-0"
|
|
32
|
+
>
|
|
33
|
+
<div
|
|
34
|
+
className="css-0"
|
|
35
|
+
>
|
|
36
|
+
<div
|
|
37
|
+
className="placeholder placeholder-undefined"
|
|
38
|
+
>
|
|
39
|
+
Content Top
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
<div
|
|
43
|
+
className="css-0"
|
|
44
|
+
>
|
|
45
|
+
<div
|
|
46
|
+
className="placeholder placeholder-undefined"
|
|
47
|
+
>
|
|
48
|
+
Left Sidebar
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<div
|
|
52
|
+
className="css-0"
|
|
53
|
+
>
|
|
54
|
+
<div
|
|
55
|
+
className="placeholder placeholder-undefined"
|
|
56
|
+
>
|
|
57
|
+
Main Content
|
|
58
|
+
</div>
|
|
59
|
+
<div
|
|
60
|
+
className="placeholder placeholder-short"
|
|
61
|
+
>
|
|
62
|
+
More Content
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</main>
|
|
66
|
+
<footer
|
|
67
|
+
className="css-0"
|
|
68
|
+
>
|
|
69
|
+
<div
|
|
70
|
+
className="placeholder placeholder-short"
|
|
71
|
+
>
|
|
72
|
+
Footer
|
|
73
|
+
</div>
|
|
74
|
+
</footer>
|
|
75
|
+
</div>
|
|
76
|
+
`;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Meta,
|
|
3
|
-
Story,
|
|
4
|
-
Canvas,
|
|
5
2
|
ArgsTable,
|
|
3
|
+
Canvas,
|
|
6
4
|
Description,
|
|
7
|
-
|
|
5
|
+
Meta,
|
|
6
|
+
Story,
|
|
7
|
+
} from "@storybook/addon-docs";
|
|
8
8
|
import { withDesign } from "storybook-addon-designs";
|
|
9
9
|
|
|
10
10
|
import Text from "./Text";
|
|
11
|
+
import { TextDisplaySizes } from "./TextTypes";
|
|
11
12
|
import { getCategory } from "../../utils/componentCategories";
|
|
13
|
+
import { getStorybookEnumValues } from "../../utils/utils";
|
|
14
|
+
|
|
15
|
+
export const enumValues = getStorybookEnumValues(
|
|
16
|
+
TextDisplaySizes,
|
|
17
|
+
"TextDisplaySizes"
|
|
18
|
+
);
|
|
12
19
|
|
|
13
20
|
<Meta
|
|
14
21
|
title={getCategory("Text")}
|
|
@@ -17,13 +24,19 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
17
24
|
parameters={{
|
|
18
25
|
design: {
|
|
19
26
|
type: "figma",
|
|
20
|
-
url:
|
|
21
|
-
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/?node-id=10733%3A56919",
|
|
27
|
+
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/?node-id=10733%3A56919",
|
|
22
28
|
},
|
|
23
29
|
}}
|
|
24
30
|
argTypes={{
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
className: { control: false },
|
|
32
|
+
displaySize: {
|
|
33
|
+
control: { type: "select" },
|
|
34
|
+
options: enumValues.options,
|
|
35
|
+
table: { defaultValue: { summary: "TextDisplaySizes.Default" } },
|
|
36
|
+
},
|
|
37
|
+
isBold: { table: { defaultValue: { summary: false } } },
|
|
38
|
+
isItalic: { table: { defaultValue: { summary: false } } },
|
|
39
|
+
noSpace: { table: { defaultValue: { summary: false } } },
|
|
27
40
|
}}
|
|
28
41
|
/>
|
|
29
42
|
|
|
@@ -39,10 +52,19 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
39
52
|
The `Text` component renders a basic `<p>` element. As its name indicates, the `displaySize` prop controls the size of the text rendered in the component.
|
|
40
53
|
|
|
41
54
|
<Canvas withToolbar>
|
|
42
|
-
<Story
|
|
55
|
+
<Story
|
|
56
|
+
name="Text"
|
|
57
|
+
args={{
|
|
58
|
+
className: undefined,
|
|
59
|
+
displaySize: "TextDisplaySizes.Default",
|
|
60
|
+
isBold: false,
|
|
61
|
+
isItalic: false,
|
|
62
|
+
noSpace: false,
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
43
65
|
{(args) => (
|
|
44
66
|
<>
|
|
45
|
-
<Text {...args}>
|
|
67
|
+
<Text {...args} displaySize={enumValues.getValue(args.displaySize)}>
|
|
46
68
|
Animal Crossing[a] is a social simulation video game series developed
|
|
47
69
|
and published by Nintendo. The series was conceptualized and created
|
|
48
70
|
by Katsuya Eguchi and Hisashi Nogami. In Animal Crossing, the player
|
|
@@ -52,7 +74,7 @@ The `Text` component renders a basic `<p>` element. As its name indicates, the `
|
|
|
52
74
|
open-ended gameplay and use of the video game console's internal clock
|
|
53
75
|
and calendar to simulate real passage of time.
|
|
54
76
|
</Text>
|
|
55
|
-
<Text {...args}>
|
|
77
|
+
<Text {...args} displaySize={enumValues.getValue(args.displaySize)}>
|
|
56
78
|
Since its initial release in 2001, five Animal Crossing games have
|
|
57
79
|
been released worldwide, one each for the Nintendo 64/iQue Player
|
|
58
80
|
(enhanced and reissued for the GameCube), Nintendo DS, Wii, Nintendo
|
|
@@ -6,14 +6,14 @@ import { getVariant } from "../../utils/utils";
|
|
|
6
6
|
export interface TextProps {
|
|
7
7
|
/** Additional class name to render in the `Text` component. */
|
|
8
8
|
className?: string;
|
|
9
|
+
/** Optional prop to control the text styling */
|
|
10
|
+
displaySize?: TextDisplaySizes;
|
|
9
11
|
/** Optional prop used to show bolded text */
|
|
10
12
|
isBold?: boolean;
|
|
11
13
|
/** Optional prop used to show itlicized text */
|
|
12
14
|
isItalic?: boolean;
|
|
13
15
|
/** Optional prop used to remove default spacing */
|
|
14
16
|
noSpace?: boolean;
|
|
15
|
-
/** Optional prop to control the text styling */
|
|
16
|
-
displaySize?: TextDisplaySizes;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function Text(props: React.PropsWithChildren<TextProps>) {
|