@nypl/design-system-react-components 0.26.0 → 0.28.0
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 +56 -0
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -5
- package/dist/components/Button/Button.d.ts +2 -10
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
- package/dist/components/Card/Card.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.d.ts +10 -8
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/Form/Form.d.ts +2 -2
- package/dist/components/Grid/SimpleGrid.d.ts +6 -3
- package/dist/components/Heading/Heading.d.ts +2 -5
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +1 -5
- package/dist/components/Hero/Hero.d.ts +13 -9
- package/dist/components/Icons/Icon.d.ts +6 -5
- package/dist/components/Icons/IconSvgs.d.ts +21 -21
- package/dist/components/Image/Image.d.ts +8 -5
- package/dist/components/Link/Link.d.ts +1 -9
- package/dist/components/List/List.d.ts +7 -11
- package/dist/components/Logo/Logo.d.ts +2 -5
- package/dist/components/Logo/LogoSvgs.d.ts +39 -39
- package/dist/components/Modal/Modal.d.ts +28 -8
- package/dist/components/Notification/Notification.d.ts +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.d.ts +3 -2
- package/dist/components/Select/Select.d.ts +2 -5
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
- package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
- package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
- package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Template/Template.d.ts +2 -0
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +21 -9
- package/dist/components/Toggle/Toggle.d.ts +1 -5
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
- package/dist/design-system-react-components.cjs.development.js +977 -1213
- 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 +976 -1276
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/helpers/types.d.ts +1 -0
- package/dist/index.d.ts +27 -48
- package/dist/styles.css +1 -1
- package/dist/theme/components/buttonGroup.d.ts +11 -0
- package/dist/theme/components/card.d.ts +104 -8
- package/dist/theme/components/componentWrapper.d.ts +4 -3
- package/dist/theme/components/customTable.d.ts +11 -14
- package/dist/theme/components/fieldset.d.ts +4 -3
- package/dist/theme/components/helperErrorText.d.ts +4 -3
- package/dist/theme/components/hero.d.ts +1 -1
- package/dist/theme/components/horizontalRule.d.ts +4 -3
- package/dist/theme/components/icon.d.ts +47743 -1
- package/dist/theme/components/image.d.ts +563 -10
- package/dist/theme/components/label.d.ts +4 -3
- package/dist/theme/components/list.d.ts +6 -7
- package/dist/theme/components/logo.d.ts +474 -1
- package/dist/theme/components/notification.d.ts +20 -16
- package/dist/theme/components/progressIndicator.d.ts +6 -4
- package/dist/theme/components/select.d.ts +4 -10
- package/dist/theme/components/skeletonLoader.d.ts +14 -10
- package/dist/theme/components/skipNavigation.d.ts +22 -0
- package/dist/theme/components/slider.d.ts +7 -6
- package/dist/theme/components/structuredContent.d.ts +10 -9
- package/dist/theme/components/text.d.ts +7 -1
- package/dist/theme/components/toggle.d.ts +6 -4
- package/dist/theme/provider.d.ts +2 -4
- package/dist/utils/componentCategories.d.ts +1 -1
- package/dist/utils/interfaces.d.ts +5 -0
- package/dist/utils/utils.d.ts +2 -18
- package/package.json +15 -16
- package/src/__tests__/setup.ts +3 -3
- package/src/__tests__/utils/utils.test.ts +1 -23
- package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
- package/src/components/Accordion/Accordion.stories.mdx +43 -44
- package/src/components/Accordion/Accordion.test.tsx +5 -13
- package/src/components/Accordion/Accordion.tsx +14 -18
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
- package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
- package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
- package/src/components/Button/Button.stories.mdx +89 -126
- package/src/components/Button/Button.test.tsx +16 -30
- package/src/components/Button/Button.tsx +14 -20
- package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
- package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
- package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
- package/src/components/Card/Card.stories.mdx +143 -177
- package/src/components/Card/Card.test.tsx +36 -97
- package/src/components/Card/Card.tsx +78 -74
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +1 -1
- package/src/components/Chakra/Box.stories.mdx +2 -6
- package/src/components/Chakra/Center.stories.mdx +5 -23
- package/src/components/Chakra/Flex.stories.mdx +4 -6
- package/src/components/Chakra/Stack.stories.mdx +9 -10
- package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
- package/src/components/Checkbox/Checkbox.test.tsx +2 -2
- package/src/components/Checkbox/Checkbox.tsx +20 -13
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +9 -9
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +6 -17
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -7
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +33 -29
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +24 -35
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +3 -10
- package/src/components/DatePicker/DatePicker.stories.mdx +23 -37
- package/src/components/DatePicker/DatePicker.test.tsx +21 -19
- package/src/components/DatePicker/DatePicker.tsx +57 -49
- package/src/components/Form/Form.stories.mdx +46 -31
- package/src/components/Form/Form.test.tsx +1 -18
- package/src/components/Form/Form.tsx +7 -7
- package/src/components/Grid/SimpleGrid.stories.mdx +73 -49
- package/src/components/Grid/SimpleGrid.test.tsx +7 -9
- package/src/components/Grid/SimpleGrid.tsx +14 -11
- package/src/components/Heading/Heading.stories.mdx +27 -72
- package/src/components/Heading/Heading.test.tsx +18 -44
- package/src/components/Heading/Heading.tsx +7 -10
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -3
- package/src/components/HelperErrorText/HelperErrorText.tsx +1 -5
- package/src/components/Hero/Hero.stories.mdx +219 -216
- package/src/components/Hero/Hero.test.tsx +107 -223
- package/src/components/Hero/Hero.tsx +63 -61
- package/src/components/Icons/Icon.stories.mdx +172 -118
- package/src/components/Icons/Icon.test.tsx +8 -16
- package/src/components/Icons/Icon.tsx +75 -29
- package/src/components/Icons/IconSvgs.tsx +42 -42
- package/src/components/Image/Image.stories.mdx +45 -132
- package/src/components/Image/Image.test.tsx +16 -31
- package/src/components/Image/Image.tsx +28 -12
- package/src/components/Link/Link.stories.mdx +30 -94
- package/src/components/Link/Link.test.tsx +25 -75
- package/src/components/Link/Link.tsx +43 -56
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +1 -2
- package/src/components/List/List.stories.mdx +20 -31
- package/src/components/List/List.test.tsx +24 -43
- package/src/components/List/List.tsx +25 -36
- package/src/components/Logo/Logo.stories.mdx +94 -50
- package/src/components/Logo/Logo.test.tsx +10 -19
- package/src/components/Logo/Logo.tsx +50 -17
- package/src/components/Logo/LogoSvgs.tsx +78 -78
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +4 -4
- package/src/components/Modal/Modal.stories.mdx +245 -139
- package/src/components/Modal/Modal.test.tsx +147 -10
- package/src/components/Modal/Modal.tsx +140 -20
- package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +25 -0
- package/src/components/Notification/Notification.stories.mdx +10 -28
- package/src/components/Notification/Notification.test.tsx +9 -12
- package/src/components/Notification/Notification.tsx +34 -37
- package/src/components/Pagination/Pagination.stories.mdx +3 -4
- package/src/components/Pagination/Pagination.tsx +15 -10
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +27 -53
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +9 -10
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -21
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -10
- package/src/components/Radio/Radio.stories.mdx +1 -1
- package/src/components/Radio/Radio.tsx +9 -6
- package/src/components/RadioGroup/RadioGroup.stories.mdx +15 -16
- package/src/components/RadioGroup/RadioGroup.test.tsx +2 -8
- package/src/components/RadioGroup/RadioGroup.tsx +28 -24
- package/src/components/SearchBar/SearchBar.stories.mdx +1 -1
- package/src/components/SearchBar/SearchBar.test.tsx +1 -1
- package/src/components/SearchBar/SearchBar.tsx +14 -22
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1 -13
- package/src/components/Select/Select.stories.mdx +10 -25
- package/src/components/Select/Select.test.tsx +6 -7
- package/src/components/Select/Select.tsx +28 -35
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +24 -24
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +17 -56
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -21
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +9 -8
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +33 -33
- package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
- package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
- package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
- package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
- package/src/components/Slider/Slider.stories.mdx +19 -53
- package/src/components/Slider/Slider.test.tsx +2 -2
- package/src/components/Slider/Slider.tsx +10 -12
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2 -9
- package/src/components/StatusBadge/StatusBadge.stories.mdx +6 -21
- package/src/components/StatusBadge/StatusBadge.test.tsx +2 -3
- package/src/components/StatusBadge/StatusBadge.tsx +3 -10
- package/src/components/StructuredContent/StructuredContent.stories.mdx +30 -58
- package/src/components/StructuredContent/StructuredContent.test.tsx +42 -44
- package/src/components/StructuredContent/StructuredContent.tsx +9 -18
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -23
- package/src/components/StyleGuide/Buttons.stories.mdx +62 -62
- package/src/components/StyleGuide/ColorCard.tsx +2 -4
- package/src/components/StyleGuide/Colors.stories.mdx +7 -8
- package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
- package/src/components/StyleGuide/Forms.stories.mdx +0 -1
- package/src/components/StyleGuide/Iconography.stories.mdx +59 -77
- package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
- package/src/components/StyleGuide/Typography.stories.mdx +15 -18
- package/src/components/Table/Table.stories.mdx +85 -1
- package/src/components/Table/Table.test.tsx +57 -1
- package/src/components/Table/Table.tsx +7 -4
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +121 -0
- package/src/components/Tabs/Tabs.stories.mdx +1 -1
- package/src/components/Tabs/Tabs.test.tsx +2 -2
- package/src/components/Tabs/Tabs.tsx +26 -27
- package/src/components/Template/Template.stories.mdx +49 -54
- package/src/components/Template/Template.tsx +9 -3
- package/src/components/Text/Text.stories.mdx +5 -11
- package/src/components/Text/Text.test.tsx +3 -6
- package/src/components/Text/Text.tsx +3 -5
- package/src/components/TextInput/TextInput.stories.mdx +10 -22
- package/src/components/TextInput/TextInput.test.tsx +32 -62
- package/src/components/TextInput/TextInput.tsx +61 -30
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +1 -0
- package/src/components/Toggle/Toggle.stories.mdx +5 -16
- package/src/components/Toggle/Toggle.test.tsx +2 -3
- package/src/components/Toggle/Toggle.tsx +9 -10
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +13 -29
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -23
- package/src/components/VideoPlayer/VideoPlayer.tsx +13 -10
- package/src/docs/Chakra.stories.mdx +14 -11
- package/src/docs/Welcome.stories.mdx +23 -43
- package/src/helpers/types.ts +1 -0
- package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
- package/src/hooks/useNYPLTheme.stories.mdx +3 -6
- package/src/index.ts +52 -46
- package/src/styles.scss +0 -1
- package/src/theme/components/buttonGroup.ts +10 -0
- package/src/theme/components/card.ts +50 -15
- package/src/theme/components/componentWrapper.ts +5 -1
- package/src/theme/components/customTable.ts +8 -2
- package/src/theme/components/fieldset.ts +5 -1
- package/src/theme/components/helperErrorText.ts +5 -1
- package/src/theme/components/hero.ts +2 -2
- package/src/theme/components/horizontalRule.ts +5 -1
- package/src/theme/components/icon.ts +7 -1
- package/src/theme/components/image.ts +14 -3
- package/src/theme/components/label.ts +5 -1
- package/src/theme/components/list.ts +8 -2
- package/src/theme/components/logo.ts +5 -1
- package/src/theme/components/notification.ts +38 -14
- package/src/theme/components/progressIndicator.ts +10 -5
- package/src/theme/components/select.ts +5 -6
- package/src/theme/components/skeletonLoader.ts +8 -2
- package/src/theme/components/skipNavigation.ts +26 -0
- package/src/theme/components/slider.ts +13 -1
- package/src/theme/components/structuredContent.ts +11 -1
- package/src/theme/components/text.ts +12 -5
- package/src/theme/components/toggle.ts +9 -3
- package/src/theme/index.ts +4 -0
- package/src/theme/provider.tsx +1 -1
- package/src/utils/componentCategories.ts +13 -5
- package/src/utils/interfaces.ts +5 -0
- package/src/utils/utils.ts +2 -32
- package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
- package/dist/components/Button/ButtonTypes.d.ts +0 -8
- package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
- package/dist/components/Form/FormTypes.d.ts +0 -2
- package/dist/components/Grid/GridTypes.d.ts +0 -9
- package/dist/components/Heading/HeadingTypes.d.ts +0 -14
- package/dist/components/Hero/HeroTypes.d.ts +0 -12
- package/dist/components/Icons/IconTypes.d.ts +0 -77
- package/dist/components/Image/ImageTypes.d.ts +0 -22
- package/dist/components/Link/LinkTypes.d.ts +0 -8
- package/dist/components/List/ListTypes.d.ts +0 -5
- package/dist/components/Logo/LogoTypes.d.ts +0 -54
- package/dist/components/Notification/NotificationTypes.d.ts +0 -5
- package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
- package/dist/components/Select/SelectTypes.d.ts +0 -8
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
- package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
- package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
- package/dist/components/Text/TextTypes.d.ts +0 -6
- package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
- package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
- package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
- package/dist/helpers/enums.d.ts +0 -4
- package/dist/utils/siteSections.d.ts +0 -2
- package/src/components/Accordion/AccordionTypes.tsx +0 -5
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
- package/src/components/Button/ButtonTypes.tsx +0 -8
- package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
- package/src/components/Form/FormTypes.tsx +0 -3
- package/src/components/Grid/GridTypes.tsx +0 -9
- package/src/components/Heading/HeadingTypes.tsx +0 -15
- package/src/components/Hero/HeroTypes.tsx +0 -20
- package/src/components/Icons/IconTypes.tsx +0 -83
- package/src/components/Image/ImageTypes.ts +0 -24
- package/src/components/Link/LinkTypes.tsx +0 -8
- package/src/components/List/ListTypes.tsx +0 -5
- package/src/components/Logo/LogoTypes.tsx +0 -56
- package/src/components/Modal/_Modal.scss +0 -18
- package/src/components/Notification/NotificationTypes.tsx +0 -5
- package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
- package/src/components/Select/SelectTypes.tsx +0 -10
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
- package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
- package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
- package/src/components/Text/TextTypes.tsx +0 -6
- package/src/components/TextInput/TextInputTypes.tsx +0 -48
- package/src/components/Toggle/ToggleTypes.tsx +0 -4
- package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
- package/src/helpers/enums.ts +0 -4
- package/src/utils/siteSections.ts +0 -10
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Box, VStack } from "@chakra-ui/react";
|
|
2
1
|
import {
|
|
3
2
|
ArgsTable,
|
|
4
3
|
Canvas,
|
|
@@ -9,14 +8,11 @@ import {
|
|
|
9
8
|
import { withDesign } from "storybook-addon-designs";
|
|
10
9
|
|
|
11
10
|
import Heading from "../Heading/Heading";
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
11
|
+
import Hero, { heroSecondaryTypes } from "./Hero";
|
|
12
|
+
import SimpleGrid from "../Grid/SimpleGrid";
|
|
13
|
+
import Text from "../Text/Text";
|
|
15
14
|
import { getCategory } from "../../utils/componentCategories";
|
|
16
15
|
import DSProvider from "../../theme/provider";
|
|
17
|
-
import { getStorybookEnumValues } from "../../utils/utils";
|
|
18
|
-
|
|
19
|
-
export const enumValues = getStorybookEnumValues(HeroTypes, "HeroTypes");
|
|
20
16
|
|
|
21
17
|
<Meta
|
|
22
18
|
title={getCategory("Hero")}
|
|
@@ -34,12 +30,9 @@ export const enumValues = getStorybookEnumValues(HeroTypes, "HeroTypes");
|
|
|
34
30
|
foregroundColor: { control: false },
|
|
35
31
|
heading: { control: false },
|
|
36
32
|
heroType: {
|
|
37
|
-
|
|
38
|
-
table: { defaultValue: { summary: "HeroTypes.Primary" } },
|
|
39
|
-
options: enumValues.options,
|
|
33
|
+
table: { defaultValue: { summary: "primary" } },
|
|
40
34
|
},
|
|
41
|
-
|
|
42
|
-
imageSrc: { control: false },
|
|
35
|
+
imageProps: { control: false },
|
|
43
36
|
locationDetails: { control: false },
|
|
44
37
|
subHeaderText: { control: false },
|
|
45
38
|
}}
|
|
@@ -55,15 +48,17 @@ export const secondarySubHeaderText = (
|
|
|
55
48
|
);
|
|
56
49
|
export const otherSubHeaderText =
|
|
57
50
|
"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.";
|
|
58
|
-
const
|
|
59
|
-
|
|
51
|
+
export const imageProps = {
|
|
52
|
+
alt: "Image example",
|
|
53
|
+
src: "https://placeimg.com/800/400/animals",
|
|
54
|
+
};
|
|
60
55
|
|
|
61
56
|
# Hero
|
|
62
57
|
|
|
63
58
|
| Component Version | DS Version |
|
|
64
59
|
| ----------------- | ---------- |
|
|
65
60
|
| Added | `0.2.0` |
|
|
66
|
-
| Latest | `0.
|
|
61
|
+
| Latest | `0.28.0` |
|
|
67
62
|
|
|
68
63
|
## Table of Contents
|
|
69
64
|
|
|
@@ -81,6 +76,31 @@ The `Hero` component is used to display a full width banner at the top of a page
|
|
|
81
76
|
The `Hero` will contain a required `h1` page title and may also include optional
|
|
82
77
|
descriptive text and images.
|
|
83
78
|
|
|
79
|
+
There are currently five main hero types: `"primary"`, `"secondary"`,
|
|
80
|
+
`"tertiary"`, `"campaign"`, and `"fiftyFifty"`. Under the `"secondary"` hero type,
|
|
81
|
+
there are four additional subtypes: `"secondaryBooksAndMore"`, `"secondaryLocations"`,
|
|
82
|
+
`"secondaryResearch"`, and `"secondaryWhatsOn"`.
|
|
83
|
+
|
|
84
|
+
For the variations that use image "alt" and "src" attributes, the `imageProps`
|
|
85
|
+
prop should be used:
|
|
86
|
+
|
|
87
|
+
```jsx
|
|
88
|
+
<Hero
|
|
89
|
+
backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
|
|
90
|
+
heroType="campaign"
|
|
91
|
+
heading={<Heading level="one" id="campaign-hero" text="Hero Campaign" />}
|
|
92
|
+
imageProps={{
|
|
93
|
+
alt: "Image example",
|
|
94
|
+
src: "https://placeimg.com/800/400/animals",
|
|
95
|
+
}}
|
|
96
|
+
subHeaderText="Campaign Hero Subheader Text"
|
|
97
|
+
/>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Note: the `imageProps` prop is not the same as the `backgroundImageSrc` prop used
|
|
101
|
+
for some variations. For a full list of what props to use for each variant, check
|
|
102
|
+
the [All Variations](#all-variations) section.
|
|
103
|
+
|
|
84
104
|
## Component Props
|
|
85
105
|
|
|
86
106
|
<Canvas withToolbar>
|
|
@@ -91,68 +111,56 @@ descriptive text and images.
|
|
|
91
111
|
backgroundImageSrc: undefined,
|
|
92
112
|
foregroundColor: undefined,
|
|
93
113
|
heading: undefined,
|
|
94
|
-
heroType: "
|
|
95
|
-
|
|
96
|
-
imageSrc: undefined,
|
|
114
|
+
heroType: "primary",
|
|
115
|
+
imageProps: undefined,
|
|
97
116
|
locationDetails: undefined,
|
|
98
117
|
subHeaderText: undefined,
|
|
99
118
|
}}
|
|
100
119
|
>
|
|
101
120
|
{(args) =>
|
|
102
|
-
(args.heroType === "
|
|
121
|
+
(args.heroType === "primary" && (
|
|
103
122
|
<Hero
|
|
104
123
|
{...args}
|
|
105
124
|
backgroundImageSrc="https://placeimg.com/2400/800/nature"
|
|
106
|
-
heading={
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
heroType={enumValues.getValue(args.heroType)}
|
|
125
|
+
heading={<Heading level="one" id="1" text="Hero Primary" />}
|
|
126
|
+
heroType={args.heroType}
|
|
110
127
|
subHeaderText="Example Subtitle"
|
|
111
128
|
/>
|
|
112
129
|
)) ||
|
|
113
|
-
(
|
|
130
|
+
(heroSecondaryTypes.includes(args.heroType) && (
|
|
114
131
|
<div className="nypl--books-and-more">
|
|
115
132
|
<Hero
|
|
116
133
|
{...args}
|
|
117
|
-
heading={
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
heroType={enumValues.getValue(args.heroType)}
|
|
121
|
-
imageAlt={args.imageAlt}
|
|
122
|
-
imageSrc={args.imageSrc}
|
|
134
|
+
heading={<Heading level="one" id="1" text="Hero Secondary" />}
|
|
135
|
+
heroType={args.heroType}
|
|
136
|
+
imageProps={args.imageProps}
|
|
123
137
|
subHeaderText={secondarySubHeaderText}
|
|
124
138
|
/>
|
|
125
139
|
</div>
|
|
126
140
|
)) ||
|
|
127
|
-
(args.heroType === "
|
|
141
|
+
(args.heroType === "tertiary" && (
|
|
128
142
|
<Hero
|
|
129
143
|
{...args}
|
|
130
|
-
heading={
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
heroType={enumValues.getValue(args.heroType)}
|
|
144
|
+
heading={<Heading level="one" id="1" text="Hero Tertiary" />}
|
|
145
|
+
heroType={args.heroType}
|
|
134
146
|
subHeaderText={otherSubHeaderText}
|
|
135
147
|
/>
|
|
136
148
|
)) ||
|
|
137
|
-
(args.heroType === "
|
|
149
|
+
(args.heroType === "campaign" && (
|
|
138
150
|
<Hero
|
|
139
151
|
{...args}
|
|
140
152
|
backgroundImageSrc="https://placeimg.com/2400/800/nature"
|
|
141
|
-
heading={
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
heroType={enumValues.getValue(args.heroType)}
|
|
145
|
-
imageAlt={args.imageAlt}
|
|
146
|
-
imageSrc={args.imageSrc}
|
|
153
|
+
heading={<Heading level="one" id="1" text="Hero Campaign" />}
|
|
154
|
+
heroType={args.heroType}
|
|
155
|
+
imageProps={args.imageProps}
|
|
147
156
|
subHeaderText={otherSubHeaderText}
|
|
148
157
|
/>
|
|
149
158
|
)) ||
|
|
150
|
-
(args.heroType === "
|
|
159
|
+
(args.heroType === "fiftyFifty" && (
|
|
151
160
|
<Hero
|
|
152
161
|
{...args}
|
|
153
|
-
heroType={
|
|
154
|
-
|
|
155
|
-
imageSrc={args.imageSrc}
|
|
162
|
+
heroType={args.heroType}
|
|
163
|
+
imageProps={args.imageProps}
|
|
156
164
|
subHeaderText={otherSubHeaderText}
|
|
157
165
|
/>
|
|
158
166
|
))
|
|
@@ -167,209 +175,204 @@ descriptive text and images.
|
|
|
167
175
|
The `Hero` component is commonly used as a banner below the page's header and
|
|
168
176
|
breadcrumbs and above the main content. This means that if the `Hero` displays
|
|
169
177
|
a heading element, it should be the first on the page and an `h1` element set
|
|
170
|
-
through `Heading`'s `level=
|
|
178
|
+
through `Heading`'s `level="one"`.
|
|
171
179
|
|
|
172
180
|
## All Variations
|
|
173
181
|
|
|
182
|
+
Each `Hero` variation can be rendered through the `heroType` prop.
|
|
183
|
+
|
|
184
|
+
### Primary
|
|
185
|
+
|
|
186
|
+
The `"primary"` hero type can be used with the `backgroundColor`, `backgroundImageSrc`,
|
|
187
|
+
`foregroundColor`, `heading`, `locationDetails`, and `subHeaderText` props. The
|
|
188
|
+
minimum props that should be used are `backgroundImageSrc` and `heading`.
|
|
189
|
+
|
|
190
|
+
```jsx
|
|
191
|
+
backgroundImageSrc="https://placeimg.com/1600/800/arch"
|
|
192
|
+
heading={<Heading level="one" id="primary-hero" text="Hero Primary" />}
|
|
193
|
+
```
|
|
194
|
+
|
|
174
195
|
<Canvas>
|
|
175
196
|
<DSProvider>
|
|
176
|
-
<
|
|
177
|
-
|
|
178
|
-
<Hero
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
197
|
+
<Hero
|
|
198
|
+
backgroundImageSrc="https://placeimg.com/1600/800/arch"
|
|
199
|
+
heading={<Heading level="one" id="primary-hero" text="Hero Primary" />}
|
|
200
|
+
heroType="primary"
|
|
201
|
+
/>
|
|
202
|
+
</DSProvider>
|
|
203
|
+
</Canvas>
|
|
204
|
+
|
|
205
|
+
### Secondary
|
|
206
|
+
|
|
207
|
+
The `"secondary"` hero type can be used with the `heading`, `imageProps`, and
|
|
208
|
+
`subHeaderText` props.
|
|
209
|
+
|
|
210
|
+
```jsx
|
|
211
|
+
heading={
|
|
212
|
+
<Heading level="one" id="secondary-hero" text="Hero Secondary" />
|
|
213
|
+
}
|
|
214
|
+
imageProps={imageProps}
|
|
215
|
+
subHeaderText={secondarySubHeaderText}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
<Canvas>
|
|
219
|
+
<DSProvider>
|
|
220
|
+
<Hero
|
|
221
|
+
heading={
|
|
222
|
+
<Heading level="one" id="secondary-hero" text="Hero Secondary" />
|
|
223
|
+
}
|
|
224
|
+
heroType="secondary"
|
|
225
|
+
imageProps={imageProps}
|
|
226
|
+
subHeaderText={secondarySubHeaderText}
|
|
227
|
+
/>
|
|
228
|
+
</DSProvider>
|
|
229
|
+
</Canvas>
|
|
230
|
+
|
|
231
|
+
### Tertiary
|
|
232
|
+
|
|
233
|
+
The `"tertiary"` hero type can be used with the `backgroundColor`, `foregroundColor`,
|
|
234
|
+
`heading`, and `subHeaderText` props. The minimum prop to use is the `heading`
|
|
235
|
+
prop.
|
|
236
|
+
|
|
237
|
+
```jsx
|
|
238
|
+
heading={
|
|
239
|
+
<Heading
|
|
240
|
+
level="one"
|
|
241
|
+
id="tertiary-hero"
|
|
242
|
+
text="Hero Tertiary with Sub-Header"
|
|
243
|
+
/>
|
|
244
|
+
}
|
|
245
|
+
subHeaderText={otherSubHeaderText}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
<Canvas>
|
|
249
|
+
<DSProvider>
|
|
250
|
+
<Hero
|
|
251
|
+
heading={
|
|
252
|
+
<Heading
|
|
253
|
+
level="one"
|
|
254
|
+
id="tertiary-hero"
|
|
255
|
+
text="Hero Tertiary with Sub-Header"
|
|
207
256
|
/>
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
257
|
+
}
|
|
258
|
+
heroType="tertiary"
|
|
259
|
+
subHeaderText={otherSubHeaderText}
|
|
260
|
+
/>
|
|
261
|
+
<br />
|
|
262
|
+
<Hero
|
|
263
|
+
heading={
|
|
264
|
+
<Heading
|
|
265
|
+
level="one"
|
|
266
|
+
id="tertiary-hero"
|
|
267
|
+
text="Hero Tertiary without Sub-Header text"
|
|
268
|
+
/>
|
|
269
|
+
}
|
|
270
|
+
heroType="tertiary"
|
|
271
|
+
/>
|
|
272
|
+
</DSProvider>
|
|
273
|
+
</Canvas>
|
|
274
|
+
|
|
275
|
+
### Campaign
|
|
276
|
+
|
|
277
|
+
The `"campaign"` hero type can be used with the `backgroundColor`,
|
|
278
|
+
`backgroundImageSrc`, `foregroundColor`, `heading`, `imageProps`, and
|
|
279
|
+
`subHeaderText` props. The minimum props to use are `backgroundImageSrc`,
|
|
280
|
+
`heading`, and `imageProps`.
|
|
281
|
+
|
|
282
|
+
```jsx
|
|
283
|
+
backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
|
|
284
|
+
heading={
|
|
285
|
+
<Heading level="one" id="campaign-hero" text="Hero Campaign" />
|
|
286
|
+
}
|
|
287
|
+
imageProps={imageProps}
|
|
288
|
+
subHeaderText={otherSubHeaderText}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
<Canvas>
|
|
292
|
+
<DSProvider>
|
|
293
|
+
<Hero
|
|
294
|
+
backgroundImageSrc="https://placeimg.com/2400/800/nature/grayscale"
|
|
295
|
+
heroType="campaign"
|
|
296
|
+
heading={<Heading level="one" id="campaign-hero" text="Hero Campaign" />}
|
|
297
|
+
imageProps={imageProps}
|
|
298
|
+
subHeaderText={otherSubHeaderText}
|
|
299
|
+
/>
|
|
300
|
+
</DSProvider>
|
|
301
|
+
</Canvas>
|
|
302
|
+
|
|
303
|
+
### FiftyFifty
|
|
304
|
+
|
|
305
|
+
The `"fiftyFifty"` hero type can be used with the `backgroundColor`,
|
|
306
|
+
`foregroundColor`, `heading`, `imageProps`, and `subHeaderText` props. The
|
|
307
|
+
minimum props to use are `imageProps` and `subHeaderText`.
|
|
308
|
+
|
|
309
|
+
```
|
|
310
|
+
imageProps={imageProps}
|
|
311
|
+
subHeaderText={otherSubHeaderText}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
<Canvas>
|
|
315
|
+
<DSProvider>
|
|
316
|
+
<Hero
|
|
317
|
+
heroType="fiftyFifty"
|
|
318
|
+
imageProps={imageProps}
|
|
319
|
+
subHeaderText={otherSubHeaderText}
|
|
320
|
+
/>
|
|
267
321
|
</DSProvider>
|
|
268
322
|
</Canvas>
|
|
269
323
|
|
|
270
324
|
## Color Variations for Secondary Hero
|
|
271
325
|
|
|
272
|
-
The background color for the title bar in the "
|
|
273
|
-
on the `
|
|
326
|
+
The background color for the title bar in the `"secondary"` `Hero` changes based
|
|
327
|
+
on the `heroType` variants for the `"secondary"` main variant. There are four
|
|
328
|
+
subtypes: `"secondaryBooksAndMore"`, `"secondaryLocations"`, `"secondaryResearch"`,
|
|
329
|
+
and `"secondaryWhatsOn"`.
|
|
274
330
|
|
|
275
331
|
```jsx
|
|
276
|
-
// Example `
|
|
277
|
-
<Hero heroType=
|
|
332
|
+
// Example `heroType` "secondary" variant.
|
|
333
|
+
<Hero heroType="secondaryBooksAndMore" {...props} />
|
|
278
334
|
```
|
|
279
335
|
|
|
280
336
|
<Canvas>
|
|
281
337
|
<Story name="Color Variations for Secondary Hero">
|
|
282
|
-
<
|
|
283
|
-
<Heading
|
|
284
|
-
id="main-secondary-heading"
|
|
285
|
-
level={HeadingLevels.Two}
|
|
286
|
-
text="HeroTypes.Secondary"
|
|
287
|
-
/>
|
|
338
|
+
<SimpleGrid columns={1}>
|
|
339
|
+
<Heading id="main-secondary-heading" text="secondary" />
|
|
288
340
|
<Hero
|
|
289
341
|
heading={
|
|
290
|
-
<Heading
|
|
291
|
-
level={HeadingLevels.One}
|
|
292
|
-
id="main-secondary-hero"
|
|
293
|
-
text="Secondary"
|
|
294
|
-
/>
|
|
342
|
+
<Heading level="one" id="main-secondary-hero" text="Secondary" />
|
|
295
343
|
}
|
|
296
|
-
heroType=
|
|
297
|
-
|
|
298
|
-
imageSrc={imageSrc}
|
|
344
|
+
heroType="secondary"
|
|
345
|
+
imageProps={imageProps}
|
|
299
346
|
subHeaderText={secondarySubHeaderText}
|
|
300
347
|
/>
|
|
301
|
-
<Heading
|
|
302
|
-
id="books-heading"
|
|
303
|
-
level={HeadingLevels.Two}
|
|
304
|
-
text="HeroTypes.SecondaryBooksAndMore"
|
|
305
|
-
/>
|
|
348
|
+
<Heading id="books-heading" text="secondaryBooksAndMore" />
|
|
306
349
|
<Hero
|
|
307
|
-
heading={
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
id="books-hero"
|
|
311
|
-
text="Books and More"
|
|
312
|
-
/>
|
|
313
|
-
}
|
|
314
|
-
heroType={HeroTypes.SecondaryBooksAndMore}
|
|
315
|
-
imageAlt={imageAlt}
|
|
316
|
-
imageSrc={imageSrc}
|
|
350
|
+
heading={<Heading level="one" id="books-hero" text="Books and More" />}
|
|
351
|
+
heroType="secondaryBooksAndMore"
|
|
352
|
+
imageProps={imageProps}
|
|
317
353
|
subHeaderText={secondarySubHeaderText}
|
|
318
354
|
/>
|
|
319
|
-
<Heading
|
|
320
|
-
id="location-heading"
|
|
321
|
-
level={HeadingLevels.Two}
|
|
322
|
-
text="HeroTypes.SecondaryLocations"
|
|
323
|
-
/>
|
|
355
|
+
<Heading id="location-heading" text="secondaryLocations" />
|
|
324
356
|
<Hero
|
|
325
|
-
heading={
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
id="locations-hero"
|
|
329
|
-
text="Locations"
|
|
330
|
-
/>
|
|
331
|
-
}
|
|
332
|
-
heroType={HeroTypes.SecondaryLocations}
|
|
333
|
-
imageAlt={imageAlt}
|
|
334
|
-
imageSrc={imageSrc}
|
|
357
|
+
heading={<Heading level="one" id="locations-hero" text="Locations" />}
|
|
358
|
+
heroType="secondaryLocations"
|
|
359
|
+
imageProps={imageProps}
|
|
335
360
|
subHeaderText={secondarySubHeaderText}
|
|
336
361
|
/>
|
|
337
|
-
<Heading
|
|
338
|
-
id="research-heading"
|
|
339
|
-
level={HeadingLevels.Two}
|
|
340
|
-
text="HeroTypes.SecondaryResearch"
|
|
341
|
-
/>
|
|
362
|
+
<Heading id="research-heading" text="secondaryResearch" />
|
|
342
363
|
<Hero
|
|
343
|
-
heading={
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
id="research-hero"
|
|
347
|
-
text="Research"
|
|
348
|
-
/>
|
|
349
|
-
}
|
|
350
|
-
heroType={HeroTypes.SecondaryResearch}
|
|
351
|
-
imageAlt={imageAlt}
|
|
352
|
-
imageSrc={imageSrc}
|
|
364
|
+
heading={<Heading level="one" id="research-hero" text="Research" />}
|
|
365
|
+
heroType="secondaryResearch"
|
|
366
|
+
imageProps={imageProps}
|
|
353
367
|
subHeaderText={secondarySubHeaderText}
|
|
354
368
|
/>
|
|
355
|
-
<Heading
|
|
356
|
-
id="whats-on-heading"
|
|
357
|
-
level={HeadingLevels.Two}
|
|
358
|
-
text="HeroTypes.SecondaryWhatsOn"
|
|
359
|
-
/>
|
|
369
|
+
<Heading id="whats-on-heading" text="secondaryWhatsOn" />
|
|
360
370
|
<Hero
|
|
361
|
-
heading={
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
id="whats-on-hero"
|
|
365
|
-
text="What's On"
|
|
366
|
-
/>
|
|
367
|
-
}
|
|
368
|
-
heroType={HeroTypes.SecondaryWhatsOn}
|
|
369
|
-
imageAlt={imageAlt}
|
|
370
|
-
imageSrc={imageSrc}
|
|
371
|
+
heading={<Heading level="one" id="whats-on-hero" text="What's On" />}
|
|
372
|
+
heroType="secondaryWhatsOn"
|
|
373
|
+
imageProps={imageProps}
|
|
371
374
|
subHeaderText={secondarySubHeaderText}
|
|
372
375
|
/>
|
|
373
|
-
</
|
|
376
|
+
</SimpleGrid>
|
|
374
377
|
</Story>
|
|
375
378
|
</Canvas>
|