@nypl/design-system-react-components 0.23.4 → 0.25.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/CHANGELOG.md +98 -1
- package/README.md +46 -11
- package/dist/components/Accordion/Accordion.d.ts +14 -14
- package/dist/components/Autosuggest/Autosuggest.stories.d.ts +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +11 -14
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +6 -0
- package/dist/components/Button/Button.d.ts +6 -13
- package/dist/components/Button/ButtonTypes.d.ts +5 -3
- package/dist/components/Card/Card.d.ts +59 -10
- package/dist/components/Card/CardTypes.d.ts +19 -0
- package/dist/components/CardEdition/CardEdition.d.ts +21 -0
- package/dist/components/{StyleGuide/Colors.stories.d.ts → CardEdition/CardEdition.stories.d.ts} +5 -2
- package/dist/components/Checkbox/Checkbox.d.ts +21 -16
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +43 -0
- package/dist/components/CheckboxGroup/CheckboxGroupLayoutTypes.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.d.ts +79 -0
- package/dist/components/DatePicker/DatePickerTypes.d.ts +5 -0
- package/dist/components/Form/Form.d.ts +16 -8
- package/dist/components/Form/FormTypes.d.ts +2 -0
- package/dist/components/Grid/GridTypes.d.ts +9 -0
- package/dist/components/Grid/SimpleGrid.d.ts +14 -0
- package/dist/components/Heading/Heading.d.ts +9 -11
- package/dist/components/Heading/{HeadingDisplaySizes.d.ts → HeadingTypes.d.ts} +8 -0
- package/dist/components/HelperErrorText/HelperErrorText.stories.d.ts +2 -1
- package/dist/components/Hero/Hero.d.ts +19 -14
- package/dist/components/Hero/HeroTypes.d.ts +10 -5
- package/dist/components/Icons/Icon.d.ts +13 -16
- package/dist/components/Icons/IconSvgs.d.ts +4 -0
- package/dist/components/Icons/IconTypes.d.ts +78 -60
- package/dist/components/Image/Image.stories.d.ts +2 -1
- package/dist/components/Label/Label.d.ts +10 -26
- package/dist/components/Link/Link.d.ts +8 -12
- package/dist/components/List/List.stories.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +30 -24
- package/dist/components/RadioGroup/RadioGroup.d.ts +40 -0
- package/dist/components/RadioGroup/RadioGroupLayoutTypes.d.ts +4 -0
- package/dist/components/SearchBar/SearchBar.d.ts +45 -27
- package/dist/components/Select/Select.d.ts +34 -35
- package/dist/components/Select/SelectTypes.d.ts +4 -0
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +1 -1
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +2 -2
- package/dist/components/StatusBadge/StatusBadge.d.ts +8 -6
- package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +5 -0
- package/dist/components/Tabs/Tabs.d.ts +25 -0
- package/dist/components/Template/Template.d.ts +91 -0
- package/dist/components/Text/Text.d.ts +16 -0
- package/dist/components/Text/TextTypes.d.ts +6 -0
- package/dist/components/TextInput/TextInput.d.ts +37 -30
- package/dist/components/TextInput/TextInputTypes.d.ts +5 -0
- package/dist/design-system-react-components.cjs.development.js +4102 -917
- 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 +4023 -920
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +23 -5
- package/dist/resources.scss +133 -24
- package/dist/styles.css +1 -1
- package/dist/theme/components/accordion.d.ts +25 -0
- package/dist/theme/components/breadcrumb.d.ts +90 -0
- package/dist/theme/components/button.d.ts +109 -0
- package/dist/theme/components/checkbox.d.ts +91 -0
- package/dist/theme/components/customCheckboxGroup.d.ts +18 -0
- package/dist/theme/components/customRadioGroup.d.ts +18 -0
- package/dist/theme/components/global.d.ts +55 -0
- package/dist/theme/components/globalMixins.d.ts +15 -0
- package/dist/theme/components/heading.d.ts +110 -0
- package/dist/theme/components/hero.d.ts +492 -0
- package/dist/theme/components/icon.d.ts +13 -0
- package/dist/theme/components/label.d.ts +16 -0
- package/dist/theme/components/link.d.ts +45 -0
- package/dist/theme/components/radio.d.ts +95 -0
- package/dist/theme/components/searchBar.d.ts +20 -0
- package/dist/theme/components/select.d.ts +58 -0
- package/dist/theme/components/statusBadge.d.ts +25 -0
- package/dist/theme/components/tabs.d.ts +85 -0
- package/dist/theme/components/template.d.ts +105 -0
- package/dist/theme/components/text.d.ts +20 -0
- package/dist/theme/components/textInput.d.ts +105 -0
- package/dist/theme/foundations/breakpoints.d.ts +23 -0
- package/dist/theme/foundations/colors.d.ts +3 -0
- package/dist/theme/foundations/global.d.ts +23 -0
- package/dist/theme/foundations/shadows.d.ts +4 -0
- package/dist/theme/foundations/spacing.d.ts +77 -0
- package/dist/theme/foundations/typography.d.ts +8 -0
- package/dist/theme/index.d.ts +20 -0
- package/dist/theme/provider.d.ts +5 -0
- package/dist/theme/types.d.ts +1 -0
- package/dist/utils/utils.d.ts +6 -0
- package/package.json +9 -2
- package/src/components/Accordion/Accordion.stories.mdx +233 -33
- package/src/components/Accordion/Accordion.test.tsx +135 -19
- package/src/components/Accordion/Accordion.tsx +81 -56
- package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
- package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -1
- package/src/components/Autosuggest/_Autosuggest.scss +2 -2
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +57 -56
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +31 -25
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +71 -73
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +6 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +100 -0
- package/src/components/Button/Button.stories.mdx +125 -138
- package/src/components/Button/Button.test.tsx +65 -11
- package/src/components/Button/Button.tsx +72 -68
- package/src/components/Button/ButtonTypes.tsx +4 -2
- package/src/components/Button/_Button.scss +7 -92
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +58 -3
- package/src/components/Card/Card.stories.mdx +694 -0
- package/src/components/Card/Card.test.tsx +97 -102
- package/src/components/Card/Card.tsx +182 -31
- package/src/components/Card/CardTypes.tsx +21 -0
- package/src/components/Card/_Card.scss +234 -49
- package/src/components/{Card/Card.stories.tsx → CardEdition/CardEdition.stories.tsx} +32 -22
- package/src/components/CardEdition/CardEdition.test.tsx +395 -0
- package/src/components/CardEdition/CardEdition.tsx +60 -0
- package/src/components/CardEdition/_CardEdition.scss +138 -0
- package/src/components/Chakra/Box.stories.mdx +57 -0
- package/src/components/Chakra/Center.stories.mdx +99 -0
- package/src/components/Chakra/Grid.stories.mdx +79 -0
- package/src/components/Chakra/Stack.stories.mdx +93 -0
- package/src/components/Checkbox/Checkbox.stories.mdx +57 -35
- package/src/components/Checkbox/Checkbox.test.tsx +117 -147
- package/src/components/Checkbox/Checkbox.tsx +76 -50
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +325 -0
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +249 -0
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +345 -0
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +148 -0
- package/src/components/CheckboxGroup/CheckboxGroupLayoutTypes.tsx +4 -0
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +1360 -0
- package/src/components/DatePicker/DatePicker.stories.mdx +284 -0
- package/src/components/DatePicker/DatePicker.test.tsx +657 -0
- package/src/components/DatePicker/DatePicker.tsx +396 -0
- package/src/components/DatePicker/DatePickerTypes.tsx +5 -0
- package/src/components/DatePicker/_DatePicker.scss +76 -0
- package/src/components/Form/Form.stories.mdx +130 -27
- package/src/components/Form/Form.test.tsx +78 -36
- package/src/components/Form/Form.tsx +53 -19
- package/src/components/Form/FormTypes.tsx +3 -0
- package/src/components/Form/__snapshots__/Form.test.tsx.snap +38 -0
- package/src/components/Grid/GridTypes.tsx +9 -0
- package/src/components/Grid/SimpleGrid.stories.mdx +275 -0
- package/src/components/Grid/SimpleGrid.test.tsx +66 -0
- package/src/components/Grid/SimpleGrid.tsx +37 -0
- package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +8 -0
- package/src/components/Heading/Heading.stories.mdx +63 -33
- package/src/components/Heading/Heading.test.tsx +24 -16
- package/src/components/Heading/Heading.tsx +54 -38
- package/src/components/Heading/{HeadingDisplaySizes.tsx → HeadingTypes.tsx} +9 -0
- package/src/components/HelperErrorText/HelperErrorText.stories.tsx +2 -1
- package/src/components/HelperErrorText/_HelperErrorText.scss +1 -1
- package/src/components/Hero/Hero.stories.mdx +195 -85
- package/src/components/Hero/Hero.test.tsx +544 -113
- package/src/components/Hero/Hero.tsx +80 -93
- package/src/components/Hero/HeroTypes.tsx +17 -5
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +307 -0
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +6 -1
- package/src/components/HorizontalRule/_HorizontalRule.scss +1 -1
- package/src/components/Icons/Icon.stories.mdx +89 -74
- package/src/components/Icons/Icon.test.tsx +30 -22
- package/src/components/Icons/Icon.tsx +63 -61
- package/src/components/Icons/IconSvgs.tsx +8 -0
- package/src/components/Icons/IconTypes.tsx +80 -60
- package/src/components/Image/Image.stories.tsx +2 -1
- package/src/components/Input/_Input.scss +2 -2
- package/src/components/Label/Label.stories.mdx +77 -0
- package/src/components/Label/Label.test.tsx +43 -12
- package/src/components/Label/Label.tsx +28 -45
- package/src/components/Label/__snapshots__/Label.test.tsx.snap +41 -0
- package/src/components/Link/Link.stories.mdx +47 -41
- package/src/components/Link/Link.test.tsx +33 -44
- package/src/components/Link/Link.tsx +114 -100
- package/src/components/List/List.stories.mdx +7 -3
- package/src/components/List/List.stories.tsx +14 -9
- package/src/components/List/List.test.tsx +12 -8
- package/src/components/List/List.tsx +9 -7
- package/src/components/List/_List.scss +3 -3
- package/src/components/Modal/Modal.stories.mdx +7 -3
- package/src/components/Modal/_Modal.scss +1 -1
- package/src/components/Notification/Notification.stories.mdx +99 -65
- package/src/components/Notification/Notification.test.tsx +3 -16
- package/src/components/Notification/Notification.tsx +12 -12
- package/src/components/Notification/_Notification.scss +5 -4
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +1 -1
- package/src/components/Pagination/Pagination.stories.mdx +7 -1
- package/src/components/Pagination/Pagination.test.tsx +16 -10
- package/src/components/Radio/Radio.stories.mdx +57 -46
- package/src/components/Radio/Radio.test.tsx +92 -138
- package/src/components/Radio/Radio.tsx +70 -69
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +250 -0
- package/src/components/RadioGroup/RadioGroup.stories.mdx +247 -0
- package/src/components/RadioGroup/RadioGroup.test.tsx +327 -0
- package/src/components/RadioGroup/RadioGroup.tsx +154 -0
- package/src/components/RadioGroup/RadioGroupLayoutTypes.tsx +4 -0
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1101 -0
- package/src/components/SearchBar/SearchBar.Test.tsx +151 -16
- package/src/components/SearchBar/SearchBar.stories.mdx +196 -224
- package/src/components/SearchBar/SearchBar.tsx +151 -46
- package/src/components/Select/Select.stories.mdx +193 -168
- package/src/components/Select/Select.test.tsx +129 -324
- package/src/components/Select/Select.tsx +120 -160
- package/src/components/Select/SelectTypes.tsx +4 -0
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +18 -29
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -7
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +4 -2
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +2 -2
- package/src/components/SkeletonLoader/_SkeletonLoader.scss +3 -3
- package/src/components/StatusBadge/StatusBadge.stories.mdx +91 -0
- package/src/components/StatusBadge/StatusBadge.test.tsx +35 -7
- package/src/components/StatusBadge/StatusBadge.tsx +24 -25
- package/src/components/StatusBadge/StatusBadgeTypes.tsx +5 -0
- package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +28 -0
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +112 -90
- package/src/components/StyleGuide/Buttons.stories.mdx +98 -100
- package/src/components/StyleGuide/Colors.stories.mdx +336 -0
- package/src/components/StyleGuide/Forms.stories.mdx +85 -0
- package/src/components/StyleGuide/Iconography.stories.mdx +86 -93
- package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
- package/src/components/StyleGuide/Typography.stories.mdx +164 -166
- package/src/components/StyleGuide/UIDocCard.tsx +4 -4
- package/src/components/Tabs/Tabs.stories.mdx +221 -0
- package/src/components/Tabs/Tabs.test.tsx +264 -0
- package/src/components/Tabs/Tabs.tsx +220 -0
- package/src/components/Template/Template.stories.mdx +574 -0
- package/src/components/Template/Template.test.tsx +124 -0
- package/src/components/Template/Template.tsx +226 -0
- package/src/components/Text/Text.stories.mdx +70 -0
- package/src/components/Text/Text.test.tsx +63 -0
- package/src/components/Text/Text.tsx +55 -0
- package/src/components/Text/TextTypes.tsx +6 -0
- package/src/components/Text/__snapshots__/Text.test.tsx.snap +33 -0
- package/src/components/TextInput/TextInput.stories.mdx +90 -90
- package/src/components/TextInput/TextInput.test.tsx +103 -83
- package/src/components/TextInput/TextInput.tsx +108 -91
- package/src/components/TextInput/TextInputTypes.tsx +6 -0
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +2 -1
- package/src/components/VideoPlayer/VideoPlayer.tsx +4 -2
- package/src/components/VideoPlayer/_VideoPlayer.scss +1 -1
- package/src/docs/Chakra.stories.mdx +341 -0
- package/src/docs/Intro.stories.mdx +31 -24
- package/src/index.ts +70 -5
- package/src/styles/01-colors/_colors-brand.scss +6 -4
- package/src/styles/01-colors/_colors-utility.scss +14 -15
- package/src/styles/03-space/_space-inline.scss +47 -7
- package/src/styles/03-space/_space-inset.scss +33 -5
- package/src/styles/03-space/_space-stack.scss +48 -8
- package/src/styles/base/_02-breakpoints.scss +5 -4
- package/src/styles/base/_04-base.scss +2 -1
- package/src/styles/base/_place-holder.scss +1 -1
- package/src/styles/base/_typography.scss +1 -29
- package/src/styles.scss +22 -25
- package/src/theme/components/accordion.ts +30 -0
- package/src/theme/components/breadcrumb.ts +77 -0
- package/src/theme/components/button.ts +125 -0
- package/src/theme/components/checkbox.ts +107 -0
- package/src/theme/components/customCheckboxGroup.ts +12 -0
- package/src/theme/components/customRadioGroup.ts +12 -0
- package/src/theme/components/global.ts +71 -0
- package/src/theme/components/globalMixins.ts +16 -0
- package/src/theme/components/heading.ts +72 -0
- package/src/theme/components/hero.ts +239 -0
- package/src/theme/components/icon.ts +79 -0
- package/src/theme/components/label.ts +17 -0
- package/src/theme/components/link.ts +47 -0
- package/src/theme/components/radio.ts +106 -0
- package/src/theme/components/searchBar.ts +21 -0
- package/src/theme/components/select.ts +50 -0
- package/src/theme/components/statusBadge.ts +27 -0
- package/src/theme/components/tabs.ts +79 -0
- package/src/theme/components/template.ts +114 -0
- package/src/theme/components/text.ts +31 -0
- package/src/theme/components/textInput.ts +61 -0
- package/src/theme/foundations/breakpoints.ts +24 -0
- package/src/theme/foundations/colors.ts +208 -0
- package/src/theme/foundations/global.ts +26 -0
- package/src/theme/foundations/shadows.ts +5 -0
- package/src/theme/foundations/spacing.ts +85 -0
- package/src/theme/foundations/typography.ts +35 -0
- package/src/theme/index.ts +88 -0
- package/src/theme/provider.tsx +9 -0
- package/src/theme/types.ts +1 -0
- package/src/utils/componentCategories.ts +56 -21
- package/src/utils/utils.ts +13 -0
- package/dist/components/Accordion/Accordion.stories.d.ts +0 -5
- package/dist/components/Card/Card.stories.d.ts +0 -27
- package/dist/components/Label/Label.stories.d.ts +0 -12
- package/dist/components/StatusBadge/StatusBadge.stories.d.ts +0 -8
- package/dist/components/Template/Template.stories.d.ts +0 -29
- package/src/components/Accordion/Accordion.stories.tsx +0 -65
- package/src/components/Accordion/_Accordion.scss +0 -81
- package/src/components/Breadcrumbs/_Breadcrumbs.scss +0 -97
- package/src/components/Checkbox/_Checkbox.scss +0 -97
- package/src/components/Form/_Form.scss +0 -28
- package/src/components/Heading/_Heading.scss +0 -163
- package/src/components/Hero/_Hero.scss +0 -256
- package/src/components/Icons/_Icons.scss +0 -116
- package/src/components/Label/Label.stories.tsx +0 -30
- package/src/components/Label/_Label.scss +0 -22
- package/src/components/Link/_Link.scss +0 -73
- package/src/components/Radio/_Radio.scss +0 -84
- package/src/components/SearchBar/_SearchBar.scss +0 -16
- package/src/components/Select/_Select.scss +0 -82
- package/src/components/StatusBadge/StatusBadge.stories.tsx +0 -33
- package/src/components/StatusBadge/_StatusBadge.scss +0 -23
- package/src/components/StyleGuide/Colors.stories.tsx +0 -288
- package/src/components/Template/Template.stories.tsx +0 -85
- package/src/components/Template/_Template.scss +0 -63
- package/src/components/TextInput/_TextInput.scss +0 -59
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Meta,
|
|
3
|
+
Story,
|
|
4
|
+
Canvas,
|
|
5
|
+
ArgsTable,
|
|
6
|
+
Description,
|
|
7
|
+
} from "@storybook/addon-docs/blocks";
|
|
8
|
+
import { withDesign } from "storybook-addon-designs";
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
Template,
|
|
12
|
+
TemplateHeader,
|
|
13
|
+
TemplateBreakout,
|
|
14
|
+
TemplateContent,
|
|
15
|
+
TemplateContentTop,
|
|
16
|
+
TemplateContentPrimary,
|
|
17
|
+
TemplateContentSidebar,
|
|
18
|
+
TemplateFooter,
|
|
19
|
+
TemplateAppContainer,
|
|
20
|
+
} 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 Breadcrumbs from "../Breadcrumbs/Breadcrumbs";
|
|
26
|
+
import HorizontalRule from "../HorizontalRule/HorizontalRule";
|
|
27
|
+
import Heading from "../Heading/Heading";
|
|
28
|
+
import { HeadingLevels } from "../Heading/HeadingTypes";
|
|
29
|
+
import Notification, {
|
|
30
|
+
NotificationContent,
|
|
31
|
+
NotificationHeading,
|
|
32
|
+
NotificationProps,
|
|
33
|
+
} from "../Notification/Notification";
|
|
34
|
+
import Form, { FormRow, FormField } from "../Form/Form";
|
|
35
|
+
import TextInput from "../TextInput/TextInput";
|
|
36
|
+
import Button from "../Button/Button";
|
|
37
|
+
import Link from "../Link/Link";
|
|
38
|
+
import Card, {
|
|
39
|
+
CardImage,
|
|
40
|
+
CardHeading,
|
|
41
|
+
CardContent,
|
|
42
|
+
CardActions,
|
|
43
|
+
} from "../Card/Card";
|
|
44
|
+
import { CardImageRatios, CardImageSizes } from "../Card/CardTypes";
|
|
45
|
+
import Accordion from "../Accordion/Accordion";
|
|
46
|
+
import { faqContent } from "../Accordion/Accordion.stories.mdx";
|
|
47
|
+
import { NotificationTypes } from "../Notification/NotificationTypes";
|
|
48
|
+
import { getCategory } from "../../utils/componentCategories";
|
|
49
|
+
|
|
50
|
+
<Meta
|
|
51
|
+
title={getCategory("Template")}
|
|
52
|
+
component={TemplateAppContainer}
|
|
53
|
+
decorators={[withDesign]}
|
|
54
|
+
parameters={{
|
|
55
|
+
design: {
|
|
56
|
+
type: "figma",
|
|
57
|
+
url:
|
|
58
|
+
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11982%3A47778",
|
|
59
|
+
},
|
|
60
|
+
}}
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
# Template
|
|
64
|
+
|
|
65
|
+
| Component Version | DS Version |
|
|
66
|
+
| ----------------- | ---------- |
|
|
67
|
+
| Added | `0.3.6` |
|
|
68
|
+
| Latest | `0.25.1` |
|
|
69
|
+
|
|
70
|
+
## TemplateAppContainer Component
|
|
71
|
+
|
|
72
|
+
<Description of={TemplateAppContainer} />
|
|
73
|
+
|
|
74
|
+
<b>This is the recommended way to render an app page template.</b>
|
|
75
|
+
|
|
76
|
+
```jsx
|
|
77
|
+
import { TemplateAppContainer } from "@nypl/design-system-react-components";
|
|
78
|
+
|
|
79
|
+
<TemplateAppContainer
|
|
80
|
+
header={<Placeholder modifiers={["short"]}>NYPL Header</Placeholder>}
|
|
81
|
+
breakout={
|
|
82
|
+
<>
|
|
83
|
+
<Placeholder modifiers={["short"]}>Breadcrumbs</Placeholder>
|
|
84
|
+
<Placeholder modifiers={["short"]}>Hero</Placeholder>
|
|
85
|
+
</>
|
|
86
|
+
}
|
|
87
|
+
sidebar="left"
|
|
88
|
+
contentTop={<Placeholder>Content Top</Placeholder>}
|
|
89
|
+
contentSidebar={<Placeholder>Left Sidebar</Placeholder>}
|
|
90
|
+
contentPrimary={
|
|
91
|
+
<>
|
|
92
|
+
<Placeholder>Main Content</Placeholder>
|
|
93
|
+
<Placeholder modifiers={["short"]}>More Content</Placeholder>
|
|
94
|
+
</>
|
|
95
|
+
}
|
|
96
|
+
footer={<Placeholder modifiers={["short"]}>Footer</Placeholder>}
|
|
97
|
+
/>;
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
<Canvas>
|
|
101
|
+
<Story
|
|
102
|
+
name="TemplateAppContainer Component"
|
|
103
|
+
args={{
|
|
104
|
+
header: <Placeholder modifiers={["short"]}>NYPL Header</Placeholder>,
|
|
105
|
+
breakout: (
|
|
106
|
+
<>
|
|
107
|
+
<Placeholder modifiers={["short"]}>Breadcrumbs</Placeholder>
|
|
108
|
+
<Placeholder modifiers={["short"]}>Hero</Placeholder>
|
|
109
|
+
</>
|
|
110
|
+
),
|
|
111
|
+
sidebar: "left",
|
|
112
|
+
contentTop: <Placeholder>Content Top</Placeholder>,
|
|
113
|
+
contentSidebar: <Placeholder>Left Sidebar</Placeholder>,
|
|
114
|
+
contentPrimary: (
|
|
115
|
+
<>
|
|
116
|
+
<Placeholder>Main Content</Placeholder>
|
|
117
|
+
<Placeholder modifiers={["short"]}>More Content</Placeholder>
|
|
118
|
+
</>
|
|
119
|
+
),
|
|
120
|
+
footer: <Placeholder modifiers={["short"]}>Footer</Placeholder>,
|
|
121
|
+
}}
|
|
122
|
+
argTypes={{
|
|
123
|
+
header: { control: false },
|
|
124
|
+
breakout: { control: false },
|
|
125
|
+
contentTop: { control: false },
|
|
126
|
+
contentSidebar: { control: false },
|
|
127
|
+
contentPrimary: { control: false },
|
|
128
|
+
footer: { control: false },
|
|
129
|
+
}}
|
|
130
|
+
>
|
|
131
|
+
{(args) => <TemplateAppContainer {...args} />}
|
|
132
|
+
</Story>
|
|
133
|
+
</Canvas>
|
|
134
|
+
|
|
135
|
+
<ArgsTable story="TemplateAppContainer Component" />
|
|
136
|
+
|
|
137
|
+
## Template Children Components
|
|
138
|
+
|
|
139
|
+
The DS also provides a set of "template" components that work together to
|
|
140
|
+
render a consistent mobile and desktop layout. More information on individual
|
|
141
|
+
components and how they should be composed can be found below. Even though these
|
|
142
|
+
component are available for use, we recommend using the `TemplateAppContainer`
|
|
143
|
+
component and passing down children component as props as needed.
|
|
144
|
+
|
|
145
|
+
Basic "template" components structure:
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
import {
|
|
149
|
+
Template,
|
|
150
|
+
TemplateHeader,
|
|
151
|
+
TemplateBreakout,
|
|
152
|
+
TemplateContent,
|
|
153
|
+
TemplateContentTop,
|
|
154
|
+
TemplateContentPrimary,
|
|
155
|
+
TemplateContentSidebar,
|
|
156
|
+
TemplateFooter,
|
|
157
|
+
} from "@nypl/design-system-react-components";
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
<Template>
|
|
161
|
+
<TemplateHeader>
|
|
162
|
+
// ...
|
|
163
|
+
<TemplateBreakout>
|
|
164
|
+
// ...
|
|
165
|
+
</TemplateBreakout>
|
|
166
|
+
</TemplateHeader>
|
|
167
|
+
|
|
168
|
+
<TemplateContent>
|
|
169
|
+
<TemplateContentTop>
|
|
170
|
+
// ...
|
|
171
|
+
</TemplateContentTop>
|
|
172
|
+
|
|
173
|
+
<TemplateContentPrimary>
|
|
174
|
+
// ...
|
|
175
|
+
</TemplateContentPrimary>
|
|
176
|
+
</TemplateContent>
|
|
177
|
+
|
|
178
|
+
<TemplateFooter>
|
|
179
|
+
// ...
|
|
180
|
+
</TemplateFooter>
|
|
181
|
+
</Template>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
<Canvas>
|
|
185
|
+
<Story
|
|
186
|
+
name="Template Children Components"
|
|
187
|
+
args={{
|
|
188
|
+
sidebar: "left",
|
|
189
|
+
}}
|
|
190
|
+
argTypes={{
|
|
191
|
+
breakout: { table: { disable: true } },
|
|
192
|
+
contentPrimary: { table: { disable: true } },
|
|
193
|
+
contentSidebar: { table: { disable: true } },
|
|
194
|
+
contentTop: { table: { disable: true } },
|
|
195
|
+
footer: { table: { disable: true } },
|
|
196
|
+
header: { table: { disable: true } },
|
|
197
|
+
}}
|
|
198
|
+
>
|
|
199
|
+
{(args) => (
|
|
200
|
+
<Template>
|
|
201
|
+
<TemplateHeader>
|
|
202
|
+
<Placeholder modifiers={["short"]}>NYPL Header</Placeholder>
|
|
203
|
+
<TemplateBreakout>
|
|
204
|
+
<Placeholder modifiers={["short"]}>Breadcrumbs</Placeholder>
|
|
205
|
+
<Placeholder modifiers={["short"]}>Hero</Placeholder>
|
|
206
|
+
</TemplateBreakout>
|
|
207
|
+
</TemplateHeader>
|
|
208
|
+
<TemplateContent sidebar={args.sidebar}>
|
|
209
|
+
<TemplateContentTop>
|
|
210
|
+
<Placeholder>Content Top</Placeholder>
|
|
211
|
+
</TemplateContentTop>
|
|
212
|
+
{args.sidebar === "left" && (
|
|
213
|
+
<TemplateContentSidebar>
|
|
214
|
+
<Placeholder>Left Sidebar</Placeholder>
|
|
215
|
+
</TemplateContentSidebar>
|
|
216
|
+
)}
|
|
217
|
+
<TemplateContentPrimary>
|
|
218
|
+
<Placeholder>Main Content</Placeholder>
|
|
219
|
+
<Placeholder modifiers={["short"]}>More Content</Placeholder>
|
|
220
|
+
</TemplateContentPrimary>
|
|
221
|
+
{args.sidebar === "right" && (
|
|
222
|
+
<TemplateContentSidebar>
|
|
223
|
+
<Placeholder>Right Sidebar</Placeholder>
|
|
224
|
+
</TemplateContentSidebar>
|
|
225
|
+
)}
|
|
226
|
+
</TemplateContent>
|
|
227
|
+
<TemplateFooter>
|
|
228
|
+
<Placeholder modifiers={["short"]}>Footer</Placeholder>
|
|
229
|
+
</TemplateFooter>
|
|
230
|
+
</Template>
|
|
231
|
+
)}
|
|
232
|
+
</Story>
|
|
233
|
+
</Canvas>
|
|
234
|
+
|
|
235
|
+
<ArgsTable story="Template Children Components" />
|
|
236
|
+
|
|
237
|
+
### Template Components
|
|
238
|
+
|
|
239
|
+
The components consist of:
|
|
240
|
+
|
|
241
|
+
- `Template`
|
|
242
|
+
- `TemplateHeader`
|
|
243
|
+
- `TemplateBreakout`
|
|
244
|
+
- `TemplateContent`
|
|
245
|
+
- `TemplateContentTop`
|
|
246
|
+
- `TemplateContentPrimary`
|
|
247
|
+
- `TemplateContentSidebar`
|
|
248
|
+
- `TemplateFooter`
|
|
249
|
+
|
|
250
|
+
#### Template
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
<Template>
|
|
254
|
+
// ...
|
|
255
|
+
</Template>
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
<Description of={Template} />
|
|
259
|
+
|
|
260
|
+
#### TemplateHeader
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
<Template>
|
|
264
|
+
<TemplateHeader>
|
|
265
|
+
// ...
|
|
266
|
+
</TemplateHeader>
|
|
267
|
+
<Template>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
<Description of={TemplateHeader} />
|
|
271
|
+
|
|
272
|
+
#### TemplateBreakout
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
<Template>
|
|
276
|
+
<TemplateHeader>
|
|
277
|
+
<TemplateBreakout>
|
|
278
|
+
// ...
|
|
279
|
+
</TemplateBreakout>
|
|
280
|
+
</TemplateHeader>
|
|
281
|
+
<Template>
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
<Description of={TemplateBreakout} />
|
|
285
|
+
|
|
286
|
+
#### TemplateContent
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
<Template>
|
|
290
|
+
<TemplateHeader>...</TemplateHeader>
|
|
291
|
+
<TemplateContent sidebar="left">
|
|
292
|
+
// ...
|
|
293
|
+
</TemplateContent>
|
|
294
|
+
<Template>
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
<Description of={TemplateContent} />
|
|
298
|
+
|
|
299
|
+
#### TemplateContentTop
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
<Template>
|
|
303
|
+
<TemplateHeader>...</TemplateHeader>
|
|
304
|
+
<TemplateContent>
|
|
305
|
+
<TemplateContentTop>
|
|
306
|
+
// ...
|
|
307
|
+
</TemplateContent>
|
|
308
|
+
</TemplateContent>
|
|
309
|
+
<Template>
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
<Description of={TemplateContentTop} />
|
|
313
|
+
|
|
314
|
+
#### TemplateContentPrimary
|
|
315
|
+
|
|
316
|
+
```
|
|
317
|
+
<Template>
|
|
318
|
+
<TemplateHeader>...</TemplateHeader>
|
|
319
|
+
<TemplateContent>
|
|
320
|
+
<TemplateContentPrimary>
|
|
321
|
+
// ...
|
|
322
|
+
</TemplateContentPrimary>
|
|
323
|
+
</TemplateContent>
|
|
324
|
+
<Template>
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
<Description of={TemplateContentPrimary} />
|
|
328
|
+
|
|
329
|
+
#### TemplateContentSidebar
|
|
330
|
+
|
|
331
|
+
```
|
|
332
|
+
<Template>
|
|
333
|
+
<TemplateHeader>...</TemplateHeader>
|
|
334
|
+
<TemplateContent sidebar="right">
|
|
335
|
+
<TemplateContentPrimary>
|
|
336
|
+
// ...
|
|
337
|
+
</TemplateContentPrimary>
|
|
338
|
+
<TemplateContentSidebar>
|
|
339
|
+
// RIGHT SIDEBAR
|
|
340
|
+
</TemplateContentSidebar>
|
|
341
|
+
</TemplateContent>
|
|
342
|
+
<Template>
|
|
343
|
+
|
|
344
|
+
<Template>
|
|
345
|
+
<TemplateHeader>...</TemplateHeader>
|
|
346
|
+
<TemplateContent sidebar="left">
|
|
347
|
+
<TemplateContentSidebar>
|
|
348
|
+
// LEFT SIDEBAR
|
|
349
|
+
</TemplateContentSidebar>
|
|
350
|
+
<TemplateContentPrimary>
|
|
351
|
+
// ...
|
|
352
|
+
</TemplateContentPrimary>
|
|
353
|
+
</TemplateContent>
|
|
354
|
+
<Template>
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
<Description of={TemplateContentSidebar} />
|
|
358
|
+
|
|
359
|
+
#### TemplateFooter
|
|
360
|
+
|
|
361
|
+
```
|
|
362
|
+
<Template>
|
|
363
|
+
<TemplateHeader>
|
|
364
|
+
// ...
|
|
365
|
+
</TemplateHeader>
|
|
366
|
+
<TemplateContent sidebar="right">
|
|
367
|
+
//...
|
|
368
|
+
</TemplateContent>
|
|
369
|
+
<TemplateFooter>
|
|
370
|
+
// ...
|
|
371
|
+
</TemplateFooter>
|
|
372
|
+
<Template>
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
<Description of={TemplateFooter} />
|
|
376
|
+
|
|
377
|
+
### Template Children Components Sidebar Configuration
|
|
378
|
+
|
|
379
|
+
In order to render a sidebar, two steps must be taken.
|
|
380
|
+
|
|
381
|
+
1. The `TemplateContent` component needs to be aware of it. Pass the location
|
|
382
|
+
of the sidebar to the `sidebar` prop as either "left" or "right".
|
|
383
|
+
|
|
384
|
+
```jsx
|
|
385
|
+
<TemplateContent sidebar="left">
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
2. Render `TemplateContentSidebar` and `TemplateContentPrimary` next to each
|
|
389
|
+
other in the appropriate order. If the sidebar must show left, then
|
|
390
|
+
`TemplateContentSidebar` comes before `TemplateContentPrimary`. Otherwise,
|
|
391
|
+
`TemplateContentPrimary` must come before `TemplateContentSidebar`.
|
|
392
|
+
|
|
393
|
+
```jsx
|
|
394
|
+
// Render left sidebar
|
|
395
|
+
<TemplateContent sidebar="left">
|
|
396
|
+
<TemplateContentSidebar>
|
|
397
|
+
// ...
|
|
398
|
+
</TemplateContentSidebar>
|
|
399
|
+
<TemplateContentPrimary>
|
|
400
|
+
// ...
|
|
401
|
+
</TemplateContentPrimary>
|
|
402
|
+
</TemplateContent>
|
|
403
|
+
|
|
404
|
+
// Render right sidebar
|
|
405
|
+
<TemplateContent sidebar="right">
|
|
406
|
+
<TemplateContentPrimary>
|
|
407
|
+
// ...
|
|
408
|
+
</TemplateContentPrimary>
|
|
409
|
+
<TemplateContentSidebar>
|
|
410
|
+
// ...
|
|
411
|
+
</TemplateContentSidebar>
|
|
412
|
+
</TemplateContent>
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
## Full Example with Template Children Components
|
|
416
|
+
|
|
417
|
+
export const otherSubHeaderText =
|
|
418
|
+
"With 92 locations across the Bronx, Manhattan, and Staten Island, The New York Public Library is an essential part of neighborhoods across the city. Visit us today.";
|
|
419
|
+
|
|
420
|
+
This is best viewed in the Storybook "Canvas" and not "Docs" section.
|
|
421
|
+
|
|
422
|
+
<Canvas>
|
|
423
|
+
<Story name="Full Example with Template Children Components">
|
|
424
|
+
<Template>
|
|
425
|
+
<TemplateHeader>
|
|
426
|
+
<TemplateBreakout>
|
|
427
|
+
<Breadcrumbs
|
|
428
|
+
breadcrumbsData={[
|
|
429
|
+
{ url: "#", text: "Home" },
|
|
430
|
+
{ url: "#", text: "Research" },
|
|
431
|
+
{
|
|
432
|
+
url: "#",
|
|
433
|
+
text: "Catalog",
|
|
434
|
+
},
|
|
435
|
+
]}
|
|
436
|
+
/>
|
|
437
|
+
<Hero
|
|
438
|
+
heroType={HeroTypes.Campaign}
|
|
439
|
+
heading={
|
|
440
|
+
<Heading level={HeadingLevels.One} id="1" text="Hero Campaign" />
|
|
441
|
+
}
|
|
442
|
+
subHeaderText={otherSubHeaderText}
|
|
443
|
+
backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
|
|
444
|
+
image={
|
|
445
|
+
<Image
|
|
446
|
+
src="https://placeimg.com/800/400/animals"
|
|
447
|
+
alt="Image example"
|
|
448
|
+
/>
|
|
449
|
+
}
|
|
450
|
+
/>
|
|
451
|
+
</TemplateBreakout>
|
|
452
|
+
</TemplateHeader>
|
|
453
|
+
<TemplateContent sidebar="right">
|
|
454
|
+
<TemplateContentTop>
|
|
455
|
+
<Notification notificationType={NotificationTypes.Announcement}>
|
|
456
|
+
<NotificationHeading>Announcement Notification</NotificationHeading>
|
|
457
|
+
<NotificationContent>
|
|
458
|
+
This is an "announcement" Notification with a heading. Cras mattis
|
|
459
|
+
consectetur purus sit amet fermentum. Maecenas faucibus mollis
|
|
460
|
+
interdum. Morbi leo risus, porta ac consectetur ac, vestibulum at
|
|
461
|
+
eros. Cum sociis natoque penatibus et magnis dis parturient
|
|
462
|
+
montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue
|
|
463
|
+
laoreet rutrum faucibus dolor auctor.
|
|
464
|
+
</NotificationContent>
|
|
465
|
+
</Notification>
|
|
466
|
+
</TemplateContentTop>
|
|
467
|
+
<TemplateContentPrimary>
|
|
468
|
+
<p>This is the main content!</p>
|
|
469
|
+
<Accordion contentData={faqContent} />
|
|
470
|
+
<HorizontalRule />
|
|
471
|
+
<p>Fill out the form!</p>
|
|
472
|
+
<Form action="/end/point">
|
|
473
|
+
<FormField>
|
|
474
|
+
<TextInput
|
|
475
|
+
labelText="Username"
|
|
476
|
+
helperText="Make sure to complete this field."
|
|
477
|
+
required
|
|
478
|
+
/>
|
|
479
|
+
</FormField>
|
|
480
|
+
<FormField>
|
|
481
|
+
<TextInput
|
|
482
|
+
labelText="Password"
|
|
483
|
+
helperText="Make sure to complete this field."
|
|
484
|
+
required
|
|
485
|
+
/>
|
|
486
|
+
</FormField>
|
|
487
|
+
<FormRow>
|
|
488
|
+
<FormField>
|
|
489
|
+
<TextInput labelText="Phone Field" type="tel" />
|
|
490
|
+
</FormField>
|
|
491
|
+
<FormField>
|
|
492
|
+
<TextInput labelText="URL Field" type="url" />
|
|
493
|
+
</FormField>
|
|
494
|
+
<FormField>
|
|
495
|
+
<TextInput labelText="Age" type="number" />
|
|
496
|
+
</FormField>
|
|
497
|
+
</FormRow>
|
|
498
|
+
<FormField>
|
|
499
|
+
<Button>Submit</Button>
|
|
500
|
+
</FormField>
|
|
501
|
+
</Form>
|
|
502
|
+
</TemplateContentPrimary>
|
|
503
|
+
<TemplateContentSidebar>
|
|
504
|
+
<p>Sidebar information in a `Card` component.</p>
|
|
505
|
+
<Card
|
|
506
|
+
center
|
|
507
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
508
|
+
imageAlt="Alt text"
|
|
509
|
+
imageAspectRatio={CardImageRatios.Square}
|
|
510
|
+
imageSize={CardImageSizes.Small}
|
|
511
|
+
>
|
|
512
|
+
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
513
|
+
Small Animal Image
|
|
514
|
+
</CardHeading>
|
|
515
|
+
<CardHeading level={HeadingLevels.Five} id="heading2">
|
|
516
|
+
Animal info
|
|
517
|
+
</CardHeading>
|
|
518
|
+
<CardContent>
|
|
519
|
+
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
520
|
+
libero, a pharetra augue.
|
|
521
|
+
</CardContent>
|
|
522
|
+
</Card>
|
|
523
|
+
</TemplateContentSidebar>
|
|
524
|
+
</TemplateContent>
|
|
525
|
+
<TemplateFooter>
|
|
526
|
+
<Card
|
|
527
|
+
id="custom-card"
|
|
528
|
+
imageAlt="Alt text"
|
|
529
|
+
imageSrc="https://cdn-d8.nypl.org/s3fs-public/2020-05/NYPL_MainFacadeRev2Cam2.png"
|
|
530
|
+
imageAspectRatio={CardImageRatios.SixteenByNine}
|
|
531
|
+
layout="horizontal"
|
|
532
|
+
backgroundColor="#616161"
|
|
533
|
+
foregroundColor="#FFF"
|
|
534
|
+
>
|
|
535
|
+
<CardHeading id="heading1" level={2}>
|
|
536
|
+
Footer
|
|
537
|
+
</CardHeading>
|
|
538
|
+
<CardContent>
|
|
539
|
+
<p>This is an example footer using the `Card` component.</p>
|
|
540
|
+
<p>
|
|
541
|
+
© The New York Public Library, 2021 The New York Public Library is
|
|
542
|
+
a 501(c)(3) | EIN 13-1887440
|
|
543
|
+
</p>
|
|
544
|
+
</CardContent>
|
|
545
|
+
<CardActions>
|
|
546
|
+
<Link
|
|
547
|
+
href="javascript:void(0);"
|
|
548
|
+
attributes={{
|
|
549
|
+
style: { color: "#FFF", textDecoration: "underline" },
|
|
550
|
+
}}
|
|
551
|
+
>
|
|
552
|
+
Facebook
|
|
553
|
+
</Link>
|
|
554
|
+
,<Link
|
|
555
|
+
href="javascript:void(0);"
|
|
556
|
+
attributes={{
|
|
557
|
+
style: { color: "#FFF", textDecoration: "underline" },
|
|
558
|
+
}}
|
|
559
|
+
>
|
|
560
|
+
Instagram
|
|
561
|
+
</Link>,<Link
|
|
562
|
+
href="javascript:void(0);"
|
|
563
|
+
attributes={{
|
|
564
|
+
style: { color: "#FFF", textDecoration: "underline" },
|
|
565
|
+
}}
|
|
566
|
+
>
|
|
567
|
+
Twitter
|
|
568
|
+
</Link>
|
|
569
|
+
</CardActions>
|
|
570
|
+
</Card>
|
|
571
|
+
</TemplateFooter>
|
|
572
|
+
</Template>
|
|
573
|
+
</Story>
|
|
574
|
+
</Canvas>
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import { axe } from "jest-axe";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Template,
|
|
7
|
+
TemplateHeader,
|
|
8
|
+
TemplateBreakout,
|
|
9
|
+
TemplateContent,
|
|
10
|
+
TemplateContentTop,
|
|
11
|
+
TemplateContentPrimary,
|
|
12
|
+
TemplateContentSidebar,
|
|
13
|
+
TemplateFooter,
|
|
14
|
+
TemplateAppContainer,
|
|
15
|
+
} from "./Template";
|
|
16
|
+
import Placeholder from "../Placeholder/Placeholder";
|
|
17
|
+
|
|
18
|
+
const header = <Placeholder modifiers={["short"]}>NYPL Header</Placeholder>;
|
|
19
|
+
const breakout = (
|
|
20
|
+
<>
|
|
21
|
+
<Placeholder modifiers={["short"]}>Breadcrumbs</Placeholder>
|
|
22
|
+
<Placeholder modifiers={["short"]}>Hero</Placeholder>
|
|
23
|
+
</>
|
|
24
|
+
);
|
|
25
|
+
const sidebar = "left";
|
|
26
|
+
const contentTop = <Placeholder>Content Top</Placeholder>;
|
|
27
|
+
const contentSidebar = <Placeholder>Left Sidebar</Placeholder>;
|
|
28
|
+
const contentPrimary = (
|
|
29
|
+
<>
|
|
30
|
+
<Placeholder>Main Content</Placeholder>
|
|
31
|
+
<Placeholder modifiers={["short"]}>More Content</Placeholder>
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
34
|
+
const footer = <Placeholder modifiers={["short"]}>Footer</Placeholder>;
|
|
35
|
+
|
|
36
|
+
describe("TemplateAppContainer accessibility", () => {
|
|
37
|
+
it("passes axe accessibility test", async () => {
|
|
38
|
+
const { container } = render(
|
|
39
|
+
<TemplateAppContainer
|
|
40
|
+
header={header}
|
|
41
|
+
breakout={breakout}
|
|
42
|
+
sidebar={sidebar}
|
|
43
|
+
contentTop={contentTop}
|
|
44
|
+
contentSidebar={contentSidebar}
|
|
45
|
+
contentPrimary={contentPrimary}
|
|
46
|
+
footer={footer}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe("Template components accessibility", () => {
|
|
54
|
+
it("passes axe accessibility test", async () => {
|
|
55
|
+
const { container } = render(
|
|
56
|
+
<Template>
|
|
57
|
+
<TemplateHeader>
|
|
58
|
+
{header}
|
|
59
|
+
<TemplateBreakout>{breakout}</TemplateBreakout>
|
|
60
|
+
</TemplateHeader>
|
|
61
|
+
<TemplateContent sidebar={sidebar}>
|
|
62
|
+
<TemplateContentTop>{contentTop}</TemplateContentTop>
|
|
63
|
+
<TemplateContentSidebar>{contentSidebar}</TemplateContentSidebar>
|
|
64
|
+
<TemplateContentPrimary>{contentPrimary}</TemplateContentPrimary>
|
|
65
|
+
</TemplateContent>
|
|
66
|
+
<TemplateFooter>{footer}</TemplateFooter>
|
|
67
|
+
</Template>
|
|
68
|
+
);
|
|
69
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe("TemplateAppContainer component", () => {
|
|
74
|
+
it("renders each section", () => {
|
|
75
|
+
render(
|
|
76
|
+
<TemplateAppContainer
|
|
77
|
+
header={header}
|
|
78
|
+
breakout={breakout}
|
|
79
|
+
sidebar={sidebar}
|
|
80
|
+
contentTop={contentTop}
|
|
81
|
+
contentSidebar={contentSidebar}
|
|
82
|
+
contentPrimary={contentPrimary}
|
|
83
|
+
footer={footer}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
expect(screen.getByText("NYPL Header")).toBeInTheDocument();
|
|
88
|
+
expect(screen.getByText("Breadcrumbs")).toBeInTheDocument();
|
|
89
|
+
expect(screen.getByText("Hero")).toBeInTheDocument();
|
|
90
|
+
expect(screen.getByText("Content Top")).toBeInTheDocument();
|
|
91
|
+
expect(screen.getByText("Left Sidebar")).toBeInTheDocument();
|
|
92
|
+
expect(screen.getByText("Main Content")).toBeInTheDocument();
|
|
93
|
+
expect(screen.getByText("More Content")).toBeInTheDocument();
|
|
94
|
+
expect(screen.getByText("Footer")).toBeInTheDocument();
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
describe("Template components", () => {
|
|
99
|
+
it("renders each section", () => {
|
|
100
|
+
render(
|
|
101
|
+
<Template>
|
|
102
|
+
<TemplateHeader>
|
|
103
|
+
{header}
|
|
104
|
+
<TemplateBreakout>{breakout}</TemplateBreakout>
|
|
105
|
+
</TemplateHeader>
|
|
106
|
+
<TemplateContent sidebar={sidebar}>
|
|
107
|
+
<TemplateContentTop>{contentTop}</TemplateContentTop>
|
|
108
|
+
<TemplateContentSidebar>{contentSidebar}</TemplateContentSidebar>
|
|
109
|
+
<TemplateContentPrimary>{contentPrimary}</TemplateContentPrimary>
|
|
110
|
+
</TemplateContent>
|
|
111
|
+
<TemplateFooter>{footer}</TemplateFooter>
|
|
112
|
+
</Template>
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
expect(screen.getByText("NYPL Header")).toBeInTheDocument();
|
|
116
|
+
expect(screen.getByText("Breadcrumbs")).toBeInTheDocument();
|
|
117
|
+
expect(screen.getByText("Hero")).toBeInTheDocument();
|
|
118
|
+
expect(screen.getByText("Content Top")).toBeInTheDocument();
|
|
119
|
+
expect(screen.getByText("Left Sidebar")).toBeInTheDocument();
|
|
120
|
+
expect(screen.getByText("Main Content")).toBeInTheDocument();
|
|
121
|
+
expect(screen.getByText("More Content")).toBeInTheDocument();
|
|
122
|
+
expect(screen.getByText("Footer")).toBeInTheDocument();
|
|
123
|
+
});
|
|
124
|
+
});
|