@nypl/design-system-react-components 0.25.13 → 0.26.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 +58 -0
- package/README.md +10 -10
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Card/Card.d.ts +11 -9
- package/dist/components/Checkbox/Checkbox.d.ts +2 -2
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +5 -4
- package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +5 -6
- package/dist/components/Fieldset/Fieldset.d.ts +5 -6
- package/dist/components/Form/Form.d.ts +6 -6
- package/dist/components/Grid/GridTypes.d.ts +7 -7
- package/dist/components/Grid/SimpleGrid.d.ts +1 -1
- package/dist/components/Heading/Heading.d.ts +1 -1
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +9 -8
- package/dist/components/Hero/Hero.d.ts +2 -1
- package/dist/components/HorizontalRule/HorizontalRule.d.ts +2 -10
- package/dist/components/Icons/Icon.d.ts +2 -1
- package/dist/components/Image/Image.d.ts +2 -2
- package/dist/components/Label/Label.d.ts +7 -4
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/List/List.d.ts +11 -11
- package/dist/components/List/ListTypes.d.ts +1 -1
- package/dist/components/Logo/Logo.d.ts +2 -1
- package/dist/components/Logo/LogoSvgs.d.ts +2 -0
- package/dist/components/Logo/LogoTypes.d.ts +2 -0
- package/dist/components/Notification/Notification.d.ts +4 -4
- package/dist/components/Pagination/Pagination.d.ts +2 -2
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +3 -3
- package/dist/components/Radio/Radio.d.ts +4 -6
- package/dist/components/RadioGroup/RadioGroup.d.ts +12 -6
- package/dist/components/SearchBar/SearchBar.d.ts +4 -4
- package/dist/components/Select/Select.d.ts +10 -6
- package/dist/components/Select/SelectTypes.d.ts +4 -0
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -3
- package/dist/components/Slider/Slider.d.ts +6 -4
- package/dist/components/StatusBadge/StatusBadge.d.ts +5 -1
- package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +4 -3
- package/dist/components/Template/Template.d.ts +4 -3
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +5 -5
- package/dist/components/Toggle/Toggle.d.ts +3 -4
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
- package/dist/design-system-react-components.cjs.development.js +1663 -1139
- 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 +1667 -1143
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/hooks/useCarouselStyles.d.ts +3 -2
- package/dist/hooks/useNYPLTheme.d.ts +12 -0
- package/dist/index.d.ts +4 -1
- package/dist/styles.css +1 -1
- package/dist/theme/components/button.d.ts +10 -2
- package/dist/theme/components/card.d.ts +42 -22
- package/dist/theme/components/checkbox.d.ts +5 -4
- package/dist/theme/components/checkboxGroup.d.ts +1 -1
- package/dist/theme/components/componentWrapper.d.ts +2 -2
- package/dist/theme/components/customTable.d.ts +84 -1
- package/dist/theme/components/fieldset.d.ts +4 -14
- package/dist/theme/components/global.d.ts +23 -17
- package/dist/theme/components/heading.d.ts +53 -0
- package/dist/theme/components/helperErrorText.d.ts +1 -0
- package/dist/theme/components/hero.d.ts +20 -14
- package/dist/theme/components/label.d.ts +9 -10
- package/dist/theme/components/list.d.ts +99 -9
- package/dist/theme/components/radio.d.ts +6 -4
- package/dist/theme/components/radioGroup.d.ts +1 -1
- package/dist/theme/components/select.d.ts +34 -5
- package/dist/theme/components/skeletonLoader.d.ts +2 -2
- package/dist/theme/components/slider.d.ts +6 -3
- package/dist/theme/components/structuredContent.d.ts +197 -0
- package/dist/theme/components/textInput.d.ts +18 -6
- package/dist/theme/components/toggle.d.ts +7 -4
- package/dist/theme/foundations/global.d.ts +2 -0
- package/dist/theme/foundations/radii.d.ts +1 -0
- package/dist/theme/foundations/spacing.d.ts +46 -43
- package/package.json +5 -6
- package/src/components/Accordion/Accordion.stories.mdx +9 -9
- package/src/components/Accordion/Accordion.test.tsx +21 -0
- package/src/components/Accordion/Accordion.tsx +13 -9
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +276 -27
- package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -5
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +52 -31
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +8 -7
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +211 -12
- package/src/components/Button/Button.stories.mdx +87 -23
- package/src/components/Button/Button.test.tsx +25 -0
- package/src/components/Button/Button.tsx +18 -7
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +27 -7
- package/src/components/Card/Card.stories.mdx +287 -194
- package/src/components/Card/Card.test.tsx +102 -0
- package/src/components/Card/Card.tsx +73 -32
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +195 -35
- package/src/components/Chakra/Grid.stories.mdx +4 -4
- package/src/components/Checkbox/Checkbox.stories.mdx +62 -10
- package/src/components/Checkbox/Checkbox.test.tsx +32 -9
- package/src/components/Checkbox/Checkbox.tsx +20 -15
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +134 -7
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +65 -17
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +137 -81
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +31 -21
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +332 -97
- package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +12 -0
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +39 -41
- package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +47 -34
- package/src/components/DatePicker/DatePicker.stories.mdx +63 -27
- package/src/components/DatePicker/DatePicker.test.tsx +89 -13
- package/src/components/DatePicker/DatePicker.tsx +62 -56
- package/src/components/DatePicker/_DatePicker.scss +71 -13
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +250 -206
- package/src/components/Fieldset/Fieldset.stories.mdx +33 -3
- package/src/components/Fieldset/Fieldset.test.tsx +58 -28
- package/src/components/Fieldset/Fieldset.tsx +35 -30
- package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +40 -19
- package/src/components/Form/Form.stories.mdx +72 -39
- package/src/components/Form/Form.test.tsx +58 -15
- package/src/components/Form/Form.tsx +89 -67
- package/src/components/Form/__snapshots__/Form.test.tsx.snap +83 -5
- package/src/components/Grid/GridTypes.tsx +7 -7
- package/src/components/Grid/SimpleGrid.stories.mdx +34 -6
- package/src/components/Grid/SimpleGrid.test.tsx +9 -0
- package/src/components/Grid/SimpleGrid.tsx +29 -20
- package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +16 -1
- package/src/components/Heading/Heading.stories.mdx +36 -3
- package/src/components/Heading/Heading.test.tsx +10 -0
- package/src/components/Heading/Heading.tsx +56 -50
- package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +26 -7
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +64 -42
- package/src/components/HelperErrorText/HelperErrorText.test.tsx +15 -0
- package/src/components/HelperErrorText/HelperErrorText.tsx +40 -35
- package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +35 -4
- package/src/components/Hero/Hero.stories.mdx +125 -95
- package/src/components/Hero/Hero.test.tsx +33 -0
- package/src/components/Hero/Hero.tsx +135 -126
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +89 -17
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +26 -4
- package/src/components/HorizontalRule/HorizontalRule.test.tsx +9 -19
- package/src/components/HorizontalRule/HorizontalRule.tsx +9 -26
- package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +18 -5
- package/src/components/Icons/Icon.stories.mdx +31 -6
- package/src/components/Icons/Icon.test.tsx +38 -0
- package/src/components/Icons/Icon.tsx +93 -76
- package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +129 -0
- package/src/components/Image/Image.stories.mdx +29 -5
- package/src/components/Image/Image.test.tsx +8 -0
- package/src/components/Image/Image.tsx +38 -26
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +24 -8
- package/src/components/Label/Label.stories.mdx +42 -20
- package/src/components/Label/Label.test.tsx +42 -17
- package/src/components/Label/Label.tsx +22 -13
- package/src/components/Label/__snapshots__/Label.test.tsx.snap +19 -15
- package/src/components/Link/Link.stories.mdx +25 -1
- package/src/components/Link/Link.test.tsx +21 -0
- package/src/components/Link/Link.tsx +8 -8
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +37 -11
- package/src/components/List/List.stories.mdx +75 -40
- package/src/components/List/List.test.tsx +67 -19
- package/src/components/List/List.tsx +38 -25
- package/src/components/List/ListTypes.tsx +1 -1
- package/src/components/List/__snapshots__/List.test.tsx.snap +110 -8
- package/src/components/Logo/Logo.stories.mdx +30 -6
- package/src/components/Logo/Logo.test.tsx +17 -0
- package/src/components/Logo/Logo.tsx +18 -6
- package/src/components/Logo/LogoSvgs.tsx +4 -0
- package/src/components/Logo/LogoTypes.tsx +2 -0
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +73 -2
- package/src/components/Modal/Modal.stories.mdx +13 -0
- package/src/components/Notification/Notification.stories.mdx +25 -1
- package/src/components/Notification/Notification.test.tsx +23 -0
- package/src/components/Notification/Notification.tsx +46 -44
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +158 -29
- package/src/components/Pagination/Pagination.stories.mdx +24 -4
- package/src/components/Pagination/Pagination.test.tsx +25 -0
- package/src/components/Pagination/Pagination.tsx +6 -6
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +244 -27
- package/src/components/Placeholder/Placeholder.tsx +3 -1
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +76 -10
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +81 -11
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -9
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +101 -14
- package/src/components/Radio/Radio.stories.mdx +64 -12
- package/src/components/Radio/Radio.test.tsx +28 -8
- package/src/components/Radio/Radio.tsx +66 -63
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +103 -6
- package/src/components/RadioGroup/RadioGroup.stories.mdx +224 -89
- package/src/components/RadioGroup/RadioGroup.test.tsx +122 -62
- package/src/components/RadioGroup/RadioGroup.tsx +106 -100
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1236 -1020
- package/src/components/SearchBar/SearchBar.stories.mdx +101 -36
- package/src/components/SearchBar/{SearchBar.Test.tsx → SearchBar.test.tsx} +46 -4
- package/src/components/SearchBar/SearchBar.tsx +17 -8
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1039 -0
- package/src/components/Select/Select.stories.mdx +128 -49
- package/src/components/Select/Select.test.tsx +63 -16
- package/src/components/Select/Select.tsx +125 -92
- package/src/components/Select/SelectTypes.tsx +5 -0
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +749 -409
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +42 -10
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +8 -0
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +76 -72
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +169 -10
- package/src/components/Slider/Slider.stories.mdx +91 -42
- package/src/components/Slider/Slider.test.tsx +65 -17
- package/src/components/Slider/Slider.tsx +26 -19
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +403 -226
- package/src/components/StatusBadge/StatusBadge.stories.mdx +19 -1
- package/src/components/StatusBadge/StatusBadge.test.tsx +16 -0
- package/src/components/StatusBadge/StatusBadge.tsx +25 -20
- package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +22 -3
- package/src/components/StructuredContent/StructuredContent.stories.mdx +131 -12
- package/src/components/StructuredContent/StructuredContent.test.tsx +34 -0
- package/src/components/StructuredContent/StructuredContent.tsx +80 -75
- package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +102 -17
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +5 -5
- package/src/components/StyleGuide/Breakpoints.stories.mdx +6 -6
- package/src/components/StyleGuide/Buttons.stories.mdx +2 -12
- package/src/components/StyleGuide/ColorCard.tsx +1 -1
- package/src/components/StyleGuide/Colors.stories.mdx +1 -2
- package/src/components/StyleGuide/DesignTokens.stories.mdx +56 -26
- package/src/components/StyleGuide/Forms.stories.mdx +27 -12
- package/src/components/StyleGuide/Iconography.stories.mdx +2 -12
- package/src/components/StyleGuide/Spacing.stories.mdx +80 -41
- package/src/components/StyleGuide/Typography.stories.mdx +30 -21
- package/src/components/Table/Table.stories.mdx +38 -11
- package/src/components/Table/Table.test.tsx +15 -0
- package/src/components/Table/Table.tsx +7 -7
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +408 -5
- package/src/components/Tabs/Tabs.stories.mdx +52 -3
- package/src/components/Tabs/Tabs.test.tsx +16 -0
- package/src/components/Tabs/Tabs.tsx +10 -6
- package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +394 -5
- package/src/components/Template/Template.stories.mdx +47 -43
- package/src/components/Template/Template.test.tsx +33 -0
- package/src/components/Template/Template.tsx +65 -60
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +191 -20
- package/src/components/Text/Text.stories.mdx +20 -1
- package/src/components/Text/Text.test.tsx +12 -0
- package/src/components/Text/Text.tsx +6 -4
- package/src/components/Text/__snapshots__/Text.test.tsx.snap +21 -4
- package/src/components/TextInput/TextInput.stories.mdx +65 -19
- package/src/components/TextInput/TextInput.test.tsx +42 -28
- package/src/components/TextInput/TextInput.tsx +121 -113
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +96 -73
- package/src/components/Toggle/Toggle.stories.mdx +80 -22
- package/src/components/Toggle/Toggle.test.tsx +27 -9
- package/src/components/Toggle/Toggle.tsx +22 -18
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +128 -5
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +52 -4
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +23 -0
- package/src/components/VideoPlayer/VideoPlayer.tsx +133 -126
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +81 -39
- package/src/docs/Chakra.stories.mdx +50 -9
- package/src/docs/Welcome.stories.mdx +160 -41
- package/src/hooks/useCarouselStyles.stories.mdx +22 -2
- package/src/hooks/useCarouselStyles.ts +3 -2
- package/src/hooks/useNYPLTheme.stories.mdx +101 -0
- package/src/hooks/useNYPLTheme.ts +30 -6
- package/src/hooks/useWindowSize.stories.mdx +23 -0
- package/src/index.ts +4 -1
- package/src/styles/base/_place-holder.scss +1 -1
- package/src/theme/components/button.ts +15 -7
- package/src/theme/components/card.ts +30 -19
- package/src/theme/components/checkbox.ts +10 -8
- package/src/theme/components/checkboxGroup.ts +1 -1
- package/src/theme/components/componentWrapper.ts +2 -2
- package/src/theme/components/customTable.ts +39 -31
- package/src/theme/components/fieldset.ts +1 -2
- package/src/theme/components/global.ts +25 -20
- package/src/theme/components/heading.ts +1 -1
- package/src/theme/components/helperErrorText.ts +1 -0
- package/src/theme/components/hero.ts +13 -15
- package/src/theme/components/label.ts +4 -3
- package/src/theme/components/list.ts +73 -66
- package/src/theme/components/notification.ts +2 -2
- package/src/theme/components/radio.ts +9 -9
- package/src/theme/components/radioGroup.ts +1 -1
- package/src/theme/components/select.ts +35 -22
- package/src/theme/components/skeletonLoader.ts +3 -3
- package/src/theme/components/slider.ts +8 -7
- package/src/theme/components/statusBadge.ts +2 -2
- package/src/theme/components/structuredContent.ts +66 -1
- package/src/theme/components/tabs.ts +2 -2
- package/src/theme/components/template.ts +9 -9
- package/src/theme/components/textInput.ts +13 -12
- package/src/theme/components/toggle.ts +17 -10
- package/src/theme/components/videoPlayer.ts +1 -1
- package/src/theme/foundations/colors.ts +1 -1
- package/src/theme/foundations/radii.ts +1 -0
- package/src/theme/foundations/spacing.ts +70 -22
- package/src/theme/foundations/typography.ts +2 -2
- package/src/utils/componentCategories.ts +1 -2
- package/dist/components/SearchBar/SearchBar.Test.d.ts +0 -1
- package/dist/helpers/generateUUID.d.ts +0 -1
- package/src/helpers/generateUUID.tsx +0 -5
|
@@ -51,9 +51,6 @@ export const LayoutTypesEnumValues = getStorybookEnumValues(
|
|
|
51
51
|
}}
|
|
52
52
|
argTypes={{
|
|
53
53
|
backgroundColor: { control: { type: "color" } },
|
|
54
|
-
border: {
|
|
55
|
-
table: { defaultValue: { summary: false } },
|
|
56
|
-
},
|
|
57
54
|
className: { control: false },
|
|
58
55
|
foregroundColor: { control: { type: "color" } },
|
|
59
56
|
id: { control: false },
|
|
@@ -81,6 +78,12 @@ export const LayoutTypesEnumValues = getStorybookEnumValues(
|
|
|
81
78
|
"imageProps.src": {
|
|
82
79
|
table: { defaultValue: { summary: "" } },
|
|
83
80
|
},
|
|
81
|
+
isAlignedRightActions: {
|
|
82
|
+
table: { defaultValue: { summary: false } },
|
|
83
|
+
},
|
|
84
|
+
isBordered: {
|
|
85
|
+
table: { defaultValue: { summary: false } },
|
|
86
|
+
},
|
|
84
87
|
isCentered: {
|
|
85
88
|
table: { defaultValue: { summary: false } },
|
|
86
89
|
},
|
|
@@ -97,7 +100,24 @@ export const LayoutTypesEnumValues = getStorybookEnumValues(
|
|
|
97
100
|
| Component Version | DS Version |
|
|
98
101
|
| ----------------- | ---------- |
|
|
99
102
|
| Added | `0.24.0` |
|
|
100
|
-
| Latest | `0.
|
|
103
|
+
| Latest | `0.26.0` |
|
|
104
|
+
|
|
105
|
+
## Table of Contents
|
|
106
|
+
|
|
107
|
+
- [Overview](#overview)
|
|
108
|
+
- [Component Props](#component-props)
|
|
109
|
+
- [Accessibility](#accessibility)
|
|
110
|
+
- [Image Position](#image-position)
|
|
111
|
+
- [Image Size](#image-size)
|
|
112
|
+
- [Custom Image Component](#custom-image-component)
|
|
113
|
+
- [Card With Link Heading](#card-with-link-heading)
|
|
114
|
+
- [Card With Full-Click Functionality](#card-with-full-click-functionality)
|
|
115
|
+
- [Card with Right Side CardActions](#card-with-right-side-cardactions)
|
|
116
|
+
- [Cards in a Grid](#cards-in-a-grid)
|
|
117
|
+
- [Cards in a Stack](#cards-in-a-stack)
|
|
118
|
+
- [Card Without Images](#card-without-images)
|
|
119
|
+
|
|
120
|
+
## Overview
|
|
101
121
|
|
|
102
122
|
<Description of={Card} />
|
|
103
123
|
|
|
@@ -109,28 +129,33 @@ order and each child component may be used multiple times within the content
|
|
|
109
129
|
area. Although a `Card` is a self-contained unit, `Card` components are often
|
|
110
130
|
grouped together and displayed in some type of grid layout.
|
|
111
131
|
|
|
112
|
-
|
|
132
|
+
### CardHeading
|
|
113
133
|
|
|
114
|
-
The `CardHeading` component mirrors the standard
|
|
115
|
-
accepts the [same props](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/components-typography-styles-heading--heading-with-controls).
|
|
134
|
+
The `CardHeading` component mirrors the standard Reservoir Design System (DS)
|
|
135
|
+
`Heading` component and accepts the [same props](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/components-typography-styles-heading--heading-with-controls).
|
|
116
136
|
|
|
117
|
-
|
|
137
|
+
### CardActions
|
|
118
138
|
|
|
119
139
|
The `CardActions` component is used to display "call to action" (CTA) buttons
|
|
120
140
|
and links for the card. The DS `Button` and `Link` components should be passed
|
|
121
141
|
as children into the `CardActions` component.
|
|
122
142
|
|
|
123
|
-
|
|
143
|
+
Set the `isAlignedRightActions` prop to true in the `Card` component to align the
|
|
144
|
+
`CardActions` to the right of the the main content area. This is only applicable
|
|
145
|
+
in the row layout of the `Card` component.
|
|
146
|
+
|
|
147
|
+
### CardContent
|
|
124
148
|
|
|
125
149
|
The `CardContent` component should be used to display all content other than
|
|
126
150
|
headings and CTAs.
|
|
127
151
|
|
|
152
|
+
## Component Props
|
|
153
|
+
|
|
128
154
|
<Canvas withToolbar>
|
|
129
155
|
<Story
|
|
130
156
|
name="Card with Controls"
|
|
131
157
|
args={{
|
|
132
158
|
backgroundColor: undefined,
|
|
133
|
-
border: false,
|
|
134
159
|
className: undefined,
|
|
135
160
|
foregroundColor: undefined,
|
|
136
161
|
id: "card-id",
|
|
@@ -140,6 +165,8 @@ headings and CTAs.
|
|
|
140
165
|
"imageProps.isAtEnd": false,
|
|
141
166
|
"imageProps.size": "ImageSizes.Default",
|
|
142
167
|
"imageProps.src": "https://placeimg.com/400/300/animals",
|
|
168
|
+
isAlignedRightActions: false,
|
|
169
|
+
isBordered: false,
|
|
143
170
|
isCentered: false,
|
|
144
171
|
layout: "LayoutTypes.Row",
|
|
145
172
|
mainActionLink: undefined,
|
|
@@ -173,17 +200,17 @@ headings and CTAs.
|
|
|
173
200
|
</CardContent>
|
|
174
201
|
<CardActions topBorder bottomBorder>
|
|
175
202
|
<Button
|
|
176
|
-
onClick={action("clicked")}
|
|
177
|
-
id="main-button1"
|
|
178
203
|
buttonType={ButtonTypes.Primary}
|
|
204
|
+
id="main-button1"
|
|
205
|
+
onClick={action("clicked")}
|
|
179
206
|
type="submit"
|
|
180
207
|
>
|
|
181
208
|
Primary
|
|
182
209
|
</Button>
|
|
183
210
|
<Button
|
|
184
|
-
onClick={action("clicked")}
|
|
185
|
-
id="main-button2"
|
|
186
211
|
buttonType={ButtonTypes.Secondary}
|
|
212
|
+
id="main-button2"
|
|
213
|
+
onClick={action("clicked")}
|
|
187
214
|
type="submit"
|
|
188
215
|
>
|
|
189
216
|
Secondary
|
|
@@ -200,6 +227,40 @@ headings and CTAs.
|
|
|
200
227
|
|
|
201
228
|
<ArgsTable story="Card with Controls" />
|
|
202
229
|
|
|
230
|
+
## Accessibility
|
|
231
|
+
|
|
232
|
+
### Headings
|
|
233
|
+
|
|
234
|
+
In general, headings from `h1` through `h6` must be in sequential order in the
|
|
235
|
+
DOM tree. Rendering an `h4` following an `h2` will throw an accessibility error.
|
|
236
|
+
Therefore, when adding `CardHeading` components, make sure to add them in
|
|
237
|
+
sequential order with the proper `level` prop.
|
|
238
|
+
|
|
239
|
+
```tsx
|
|
240
|
+
// Correct
|
|
241
|
+
<CardHeading level={HeadingLevels.Three} id="headingthree">
|
|
242
|
+
Heading level three
|
|
243
|
+
</CardHeading>
|
|
244
|
+
<CardHeading level={HeadingLevels.Four} id="headingfour">
|
|
245
|
+
Heading level four
|
|
246
|
+
</CardHeading>
|
|
247
|
+
|
|
248
|
+
// Incorrect
|
|
249
|
+
<CardHeading level={HeadingLevels.Two} id="headingtwo">
|
|
250
|
+
Heading level Two
|
|
251
|
+
</CardHeading>
|
|
252
|
+
<CardHeading level={HeadingLevels.Four} id="headingfour">
|
|
253
|
+
Heading level four
|
|
254
|
+
</CardHeading>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Full-Click Functionality
|
|
258
|
+
|
|
259
|
+
Passing in a URL in the `mainActionLink` prop will make the entire `Card`
|
|
260
|
+
clickable. Other links in the `CardActions` component can still be accessed by
|
|
261
|
+
tabbing through and pressing "enter" or by clicking as you normally would on a
|
|
262
|
+
link.
|
|
263
|
+
|
|
203
264
|
## Image Position
|
|
204
265
|
|
|
205
266
|
By default, the image is always the first element within a `Card`. This means
|
|
@@ -566,6 +627,212 @@ prop to override the default width.
|
|
|
566
627
|
</DSProvider>
|
|
567
628
|
</Canvas>
|
|
568
629
|
|
|
630
|
+
## Custom Image Component
|
|
631
|
+
|
|
632
|
+
Instead of passing a path for the `imageProps.src` prop, you can pass a custom
|
|
633
|
+
image component in using the `imageProps.component` prop.
|
|
634
|
+
|
|
635
|
+
<Canvas withToolbar>
|
|
636
|
+
<Story name="Custom Image Component">
|
|
637
|
+
<Card
|
|
638
|
+
imageProps={{
|
|
639
|
+
alt: "Alt text",
|
|
640
|
+
aspectRatio: ImageRatios.SixteenByNine,
|
|
641
|
+
component: (
|
|
642
|
+
<Image src="https://placeimg.com/400/400/animals" alt="Alt text" />
|
|
643
|
+
),
|
|
644
|
+
src: "https://placeimg.com/400/200/animals",
|
|
645
|
+
}}
|
|
646
|
+
>
|
|
647
|
+
<CardHeading level={HeadingLevels.Two} id="img1-heading1">
|
|
648
|
+
Card Component with Custom Image Component
|
|
649
|
+
</CardHeading>
|
|
650
|
+
<CardHeading level={HeadingLevels.Three} id="img2-heading2">
|
|
651
|
+
Secondary Heading
|
|
652
|
+
</CardHeading>
|
|
653
|
+
<CardContent>
|
|
654
|
+
Nulla vitae elit libero, a pharetra augue. Lorem ipsum dolor sit amet,
|
|
655
|
+
consectetur adipiscing elit. Aenean lacinia bibendum nulla sed
|
|
656
|
+
consectetur. Vestibulum id ligula porta felis euismod semper. Cras justo
|
|
657
|
+
odio, dapibus ac facilisis in, egestas eget quam. Sed posuere
|
|
658
|
+
consectetur est at lobortis.
|
|
659
|
+
</CardContent>
|
|
660
|
+
<CardActions>
|
|
661
|
+
<Link type={LinkTypes.Button} href="#">
|
|
662
|
+
Reserve
|
|
663
|
+
</Link>
|
|
664
|
+
<Link href="#url" type={LinkTypes.Forwards}>
|
|
665
|
+
View Book Details
|
|
666
|
+
</Link>
|
|
667
|
+
</CardActions>
|
|
668
|
+
</Card>
|
|
669
|
+
</Story>
|
|
670
|
+
</Canvas>
|
|
671
|
+
|
|
672
|
+
## Card with Link Heading
|
|
673
|
+
|
|
674
|
+
The `CardHeading` component works just like the DS `Heading` component. This
|
|
675
|
+
means that a URL can be passed in the `url` prop for `CardHeading` or a `Link`
|
|
676
|
+
component can be used as a child. Click on "Show code" in the example below to
|
|
677
|
+
see both patterns.
|
|
678
|
+
|
|
679
|
+
<Canvas>
|
|
680
|
+
<Story name="Card With Link Heading">
|
|
681
|
+
<Card
|
|
682
|
+
imageProps={{
|
|
683
|
+
alt: "Alt text",
|
|
684
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
685
|
+
src: "https://placeimg.com/400/200/animals",
|
|
686
|
+
}}
|
|
687
|
+
>
|
|
688
|
+
<CardHeading
|
|
689
|
+
level={HeadingLevels.Three}
|
|
690
|
+
id="link-heading1"
|
|
691
|
+
url="http://nypl.org"
|
|
692
|
+
>
|
|
693
|
+
Go to NYPL home page.
|
|
694
|
+
</CardHeading>
|
|
695
|
+
<CardHeading level={HeadingLevels.Four} id="link-heading2">
|
|
696
|
+
<>
|
|
697
|
+
Go to NYPL <Link href="http://nypl.org">home page</Link>.
|
|
698
|
+
</>
|
|
699
|
+
</CardHeading>
|
|
700
|
+
<CardContent>
|
|
701
|
+
This entire `Card` component is clickable, but the links below are still
|
|
702
|
+
accessible by tabbing through the `Card` and pressing `enter` or
|
|
703
|
+
clicking with a mouse.
|
|
704
|
+
</CardContent>
|
|
705
|
+
<CardActions>
|
|
706
|
+
<Link href="#" type={LinkTypes.Button}>
|
|
707
|
+
Button
|
|
708
|
+
</Link>
|
|
709
|
+
<Link href="#" type={LinkTypes.Forwards}>
|
|
710
|
+
Other link
|
|
711
|
+
</Link>
|
|
712
|
+
</CardActions>
|
|
713
|
+
</Card>
|
|
714
|
+
</Story>
|
|
715
|
+
</Canvas>
|
|
716
|
+
|
|
717
|
+
## Card With Full-Click Functionality
|
|
718
|
+
|
|
719
|
+
To enable the full-click functionality in the `Card` component, pass a URL in
|
|
720
|
+
the `mainActionLink` prop. This will make the entire `Card` component clickable.
|
|
721
|
+
If the `Card` has action links or buttons, they can still be accessed by tabbing
|
|
722
|
+
through the `Card` and pressing `enter` or clicking like a regular link.
|
|
723
|
+
|
|
724
|
+
Internally, if multiple `CardHeading` components are passed, only the first one
|
|
725
|
+
will have the full-click link. This, however, does not affect the `Card` itself
|
|
726
|
+
from being having the full-click functionality.
|
|
727
|
+
|
|
728
|
+
<Canvas>
|
|
729
|
+
<Story name="Card With Full-Click Functionality">
|
|
730
|
+
<SimpleGrid columns={2}>
|
|
731
|
+
<Card
|
|
732
|
+
imageProps={{
|
|
733
|
+
alt: "Alt text",
|
|
734
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
735
|
+
src: "https://placeimg.com/400/200/animals",
|
|
736
|
+
}}
|
|
737
|
+
mainActionLink="http://nypl.org"
|
|
738
|
+
>
|
|
739
|
+
<CardHeading level={HeadingLevels.Three} id="fullclick1-heading1">
|
|
740
|
+
Go to NYPL home page.
|
|
741
|
+
</CardHeading>
|
|
742
|
+
<CardHeading level={HeadingLevels.Four} id="fullclick1-heading2">
|
|
743
|
+
Some other heading.
|
|
744
|
+
</CardHeading>
|
|
745
|
+
<CardContent>
|
|
746
|
+
This entire `Card` component is clickable, but the links below are
|
|
747
|
+
still accessible by tabbing through the `Card` and pressing `enter` or
|
|
748
|
+
clicking with a mouse.
|
|
749
|
+
</CardContent>
|
|
750
|
+
<CardActions>
|
|
751
|
+
<Link href="#" type={LinkTypes.Button}>
|
|
752
|
+
Button
|
|
753
|
+
</Link>
|
|
754
|
+
<Link href="#" type={LinkTypes.Forwards}>
|
|
755
|
+
Other link
|
|
756
|
+
</Link>
|
|
757
|
+
</CardActions>
|
|
758
|
+
</Card>
|
|
759
|
+
<Card
|
|
760
|
+
imageProps={{
|
|
761
|
+
alt: "Alt text",
|
|
762
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
763
|
+
isAtEnd: true,
|
|
764
|
+
src: "https://placeimg.com/410/210/animals",
|
|
765
|
+
}}
|
|
766
|
+
mainActionLink="http://nypl.org"
|
|
767
|
+
>
|
|
768
|
+
<CardHeading level={HeadingLevels.Three} id="fullclick2-heading1">
|
|
769
|
+
Go to NYPL home page.
|
|
770
|
+
</CardHeading>
|
|
771
|
+
<CardContent>
|
|
772
|
+
This `Card` component does not have any extra links.
|
|
773
|
+
</CardContent>
|
|
774
|
+
</Card>
|
|
775
|
+
</SimpleGrid>
|
|
776
|
+
</Story>
|
|
777
|
+
</Canvas>
|
|
778
|
+
|
|
779
|
+
## Card with Right Side CardActions
|
|
780
|
+
|
|
781
|
+
It's possible to set only the `CardActions` component on the right side of the
|
|
782
|
+
main content area of the `Card`. This is possible only in the "LayoutTypes.Row"
|
|
783
|
+
layout and through the `Card` component's `isAlignedRightActions` prop which
|
|
784
|
+
must be set to `true`.
|
|
785
|
+
|
|
786
|
+
<Canvas>
|
|
787
|
+
<Story name="Card with Right Side CardActions">
|
|
788
|
+
<Card
|
|
789
|
+
imageProps={{
|
|
790
|
+
alt: "Alt text",
|
|
791
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
792
|
+
size: ImageSizes.Medium,
|
|
793
|
+
src: "https://placeimg.com/400/200/animals",
|
|
794
|
+
}}
|
|
795
|
+
isAlignedRightActions
|
|
796
|
+
isCentered
|
|
797
|
+
layout={LayoutTypes.Row}
|
|
798
|
+
>
|
|
799
|
+
<CardHeading level={HeadingLevels.Two} id="main-heading1">
|
|
800
|
+
Optional Header
|
|
801
|
+
</CardHeading>
|
|
802
|
+
<CardHeading level={HeadingLevels.Three} id="main-heading2">
|
|
803
|
+
Sollicitudin Lorem Tortor Purus Ornare
|
|
804
|
+
</CardHeading>
|
|
805
|
+
<CardContent>
|
|
806
|
+
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
807
|
+
libero, a pharetra augue. Nullam quis risus eget urna mollis ornare vel
|
|
808
|
+
eu leo. Nulla vitae elit libero, a pharetra augue.
|
|
809
|
+
</CardContent>
|
|
810
|
+
<CardActions topBorder bottomBorder>
|
|
811
|
+
<Button
|
|
812
|
+
onClick={action("clicked")}
|
|
813
|
+
id="main-button1"
|
|
814
|
+
buttonType={ButtonTypes.Primary}
|
|
815
|
+
type="submit"
|
|
816
|
+
>
|
|
817
|
+
Primary
|
|
818
|
+
</Button>
|
|
819
|
+
<Button
|
|
820
|
+
onClick={action("clicked")}
|
|
821
|
+
id="main-button2"
|
|
822
|
+
buttonType={ButtonTypes.Secondary}
|
|
823
|
+
type="submit"
|
|
824
|
+
>
|
|
825
|
+
Secondary
|
|
826
|
+
</Button>
|
|
827
|
+
</CardActions>
|
|
828
|
+
<CardActions>
|
|
829
|
+
<Link href="#">#hash1</Link>,<Link href="#">#hash2</Link>,
|
|
830
|
+
<Link href="#">#hash3</Link>
|
|
831
|
+
</CardActions>
|
|
832
|
+
</Card>
|
|
833
|
+
</Story>
|
|
834
|
+
</Canvas>
|
|
835
|
+
|
|
569
836
|
## Cards in a Grid
|
|
570
837
|
|
|
571
838
|
<Canvas>
|
|
@@ -728,54 +995,12 @@ prop to override the default width.
|
|
|
728
995
|
</Story>
|
|
729
996
|
</Canvas>
|
|
730
997
|
|
|
731
|
-
## Custom Image Component
|
|
732
|
-
|
|
733
|
-
Instead of passing a path for the `imageProps.src` prop, you can pass a custom
|
|
734
|
-
image component in using the `imageProps.component` prop.
|
|
735
|
-
|
|
736
|
-
<Canvas withToolbar>
|
|
737
|
-
<Story name="Custom Image Component">
|
|
738
|
-
<Card
|
|
739
|
-
imageProps={{
|
|
740
|
-
alt: "Alt text",
|
|
741
|
-
aspectRatio: ImageRatios.SixteenByNine,
|
|
742
|
-
component: (
|
|
743
|
-
<Image src="https://placeimg.com/400/400/animals" alt="Alt text" />
|
|
744
|
-
),
|
|
745
|
-
src: "https://placeimg.com/400/200/animals",
|
|
746
|
-
}}
|
|
747
|
-
>
|
|
748
|
-
<CardHeading level={HeadingLevels.Two} id="img1-heading1">
|
|
749
|
-
Card Component with Custom Image Component
|
|
750
|
-
</CardHeading>
|
|
751
|
-
<CardHeading level={HeadingLevels.Three} id="img2-heading2">
|
|
752
|
-
Secondary Heading
|
|
753
|
-
</CardHeading>
|
|
754
|
-
<CardContent>
|
|
755
|
-
Nulla vitae elit libero, a pharetra augue. Lorem ipsum dolor sit amet,
|
|
756
|
-
consectetur adipiscing elit. Aenean lacinia bibendum nulla sed
|
|
757
|
-
consectetur. Vestibulum id ligula porta felis euismod semper. Cras justo
|
|
758
|
-
odio, dapibus ac facilisis in, egestas eget quam. Sed posuere
|
|
759
|
-
consectetur est at lobortis.
|
|
760
|
-
</CardContent>
|
|
761
|
-
<CardActions>
|
|
762
|
-
<Link type={LinkTypes.Button} href="#">
|
|
763
|
-
Reserve
|
|
764
|
-
</Link>
|
|
765
|
-
<Link href="#url" type={LinkTypes.Forwards}>
|
|
766
|
-
View Book Details
|
|
767
|
-
</Link>
|
|
768
|
-
</CardActions>
|
|
769
|
-
</Card>
|
|
770
|
-
</Story>
|
|
771
|
-
</Canvas>
|
|
772
|
-
|
|
773
998
|
## Cards Without Images
|
|
774
999
|
|
|
775
1000
|
<Canvas>
|
|
776
1001
|
<Story name="Cards Without Images">
|
|
777
1002
|
<SimpleGrid columns={3}>
|
|
778
|
-
<Card
|
|
1003
|
+
<Card isBordered>
|
|
779
1004
|
<CardHeading level={HeadingLevels.Three} id="no-img1-heading1">
|
|
780
1005
|
Card Heading
|
|
781
1006
|
</CardHeading>
|
|
@@ -785,7 +1010,7 @@ image component in using the `imageProps.component` prop.
|
|
|
785
1010
|
Praesent commodo cursus magna, vel scelerisque nisl.
|
|
786
1011
|
</CardContent>
|
|
787
1012
|
</Card>
|
|
788
|
-
<Card
|
|
1013
|
+
<Card isBordered>
|
|
789
1014
|
<CardHeading level={HeadingLevels.Three} id="no-img2-heading1">
|
|
790
1015
|
Card Heading
|
|
791
1016
|
</CardHeading>
|
|
@@ -795,7 +1020,7 @@ image component in using the `imageProps.component` prop.
|
|
|
795
1020
|
Praesent commodo cursus magna, vel scelerisque nisl.
|
|
796
1021
|
</CardContent>
|
|
797
1022
|
</Card>
|
|
798
|
-
<Card
|
|
1023
|
+
<Card isBordered>
|
|
799
1024
|
<CardHeading level={HeadingLevels.Three} id="no-img3-heading1">
|
|
800
1025
|
Card Heading
|
|
801
1026
|
</CardHeading>
|
|
@@ -808,7 +1033,7 @@ image component in using the `imageProps.component` prop.
|
|
|
808
1033
|
</SimpleGrid>
|
|
809
1034
|
<br />
|
|
810
1035
|
<SimpleGrid columns={1}>
|
|
811
|
-
<Card layout={LayoutTypes.Row}
|
|
1036
|
+
<Card layout={LayoutTypes.Row} isBordered>
|
|
812
1037
|
<CardHeading level={HeadingLevels.Three} id="no-img4-heading1">
|
|
813
1038
|
Card Heading
|
|
814
1039
|
</CardHeading>
|
|
@@ -821,7 +1046,7 @@ image component in using the `imageProps.component` prop.
|
|
|
821
1046
|
eget metus.
|
|
822
1047
|
</CardContent>
|
|
823
1048
|
</Card>
|
|
824
|
-
<Card layout={LayoutTypes.Row}
|
|
1049
|
+
<Card layout={LayoutTypes.Row} isBordered>
|
|
825
1050
|
<CardHeading level={HeadingLevels.Three} id="no-img5-heading1">
|
|
826
1051
|
Card Heading
|
|
827
1052
|
</CardHeading>
|
|
@@ -834,7 +1059,7 @@ image component in using the `imageProps.component` prop.
|
|
|
834
1059
|
eget metus.
|
|
835
1060
|
</CardContent>
|
|
836
1061
|
</Card>
|
|
837
|
-
<Card layout={LayoutTypes.Row}
|
|
1062
|
+
<Card layout={LayoutTypes.Row} isBordered>
|
|
838
1063
|
<CardHeading level={HeadingLevels.Three} id="no-img6-heading1">
|
|
839
1064
|
Card Heading
|
|
840
1065
|
</CardHeading>
|
|
@@ -850,135 +1075,3 @@ image component in using the `imageProps.component` prop.
|
|
|
850
1075
|
</SimpleGrid>
|
|
851
1076
|
</Story>
|
|
852
1077
|
</Canvas>
|
|
853
|
-
|
|
854
|
-
## Card with Link Heading
|
|
855
|
-
|
|
856
|
-
The `CardHeading` component works just like the DS `Heading` component. This
|
|
857
|
-
means that a URL can be passed in the `url` prop for `CardHeading` or a `Link`
|
|
858
|
-
component can be used as a child. Click on "Show code" in the example below to
|
|
859
|
-
see both patterns.
|
|
860
|
-
|
|
861
|
-
<Canvas>
|
|
862
|
-
<Story name="Card With Link Heading">
|
|
863
|
-
<Card
|
|
864
|
-
imageProps={{
|
|
865
|
-
alt: "Alt text",
|
|
866
|
-
aspectRatio: ImageRatios.TwoByOne,
|
|
867
|
-
src: "https://placeimg.com/400/200/animals",
|
|
868
|
-
}}
|
|
869
|
-
>
|
|
870
|
-
<CardHeading
|
|
871
|
-
level={HeadingLevels.Three}
|
|
872
|
-
id="link-heading1"
|
|
873
|
-
url="http://nypl.org"
|
|
874
|
-
>
|
|
875
|
-
Go to NYPL home page.
|
|
876
|
-
</CardHeading>
|
|
877
|
-
<CardHeading level={HeadingLevels.Four} id="link-heading2">
|
|
878
|
-
<>
|
|
879
|
-
Go to NYPL <Link href="http://nypl.org">home page</Link>.
|
|
880
|
-
</>
|
|
881
|
-
</CardHeading>
|
|
882
|
-
<CardContent>
|
|
883
|
-
This entire `Card` component is clickable, but the links below are still
|
|
884
|
-
accessible by tabbing through the `Card` and pressing `enter` or
|
|
885
|
-
clicking with a mouse.
|
|
886
|
-
</CardContent>
|
|
887
|
-
<CardActions>
|
|
888
|
-
<Link href="#" type={LinkTypes.Button}>
|
|
889
|
-
Button
|
|
890
|
-
</Link>
|
|
891
|
-
<Link href="#" type={LinkTypes.Forwards}>
|
|
892
|
-
Other link
|
|
893
|
-
</Link>
|
|
894
|
-
</CardActions>
|
|
895
|
-
</Card>
|
|
896
|
-
</Story>
|
|
897
|
-
</Canvas>
|
|
898
|
-
|
|
899
|
-
## Card With Full-Click Functionality
|
|
900
|
-
|
|
901
|
-
To enable the full-click functionality in the `Card` component, pass a URL in
|
|
902
|
-
the `mainActionLink` prop. This will make the entire `Card` component clickable.
|
|
903
|
-
If the `Card` has action links or buttons, they can still be accessed by tabbing
|
|
904
|
-
through the `Card` and pressing `enter` or clicking like a regular link.
|
|
905
|
-
|
|
906
|
-
Internally, if multiple `CardHeading` components are passed, only the first one
|
|
907
|
-
will have the full-click link. This, however, does not affect the `Card` itself
|
|
908
|
-
from being having the full-click functionality.
|
|
909
|
-
|
|
910
|
-
<Canvas>
|
|
911
|
-
<Story name="Card With Full-Click Functionality">
|
|
912
|
-
<SimpleGrid columns={2}>
|
|
913
|
-
<Card
|
|
914
|
-
imageProps={{
|
|
915
|
-
alt: "Alt text",
|
|
916
|
-
aspectRatio: ImageRatios.TwoByOne,
|
|
917
|
-
src: "https://placeimg.com/400/200/animals",
|
|
918
|
-
}}
|
|
919
|
-
mainActionLink="http://nypl.org"
|
|
920
|
-
>
|
|
921
|
-
<CardHeading level={HeadingLevels.Three} id="fullclick1-heading1">
|
|
922
|
-
Go to NYPL home page.
|
|
923
|
-
</CardHeading>
|
|
924
|
-
<CardHeading level={HeadingLevels.Four} id="fullclick1-heading2">
|
|
925
|
-
Some other heading.
|
|
926
|
-
</CardHeading>
|
|
927
|
-
<CardContent>
|
|
928
|
-
This entire `Card` component is clickable, but the links below are
|
|
929
|
-
still accessible by tabbing through the `Card` and pressing `enter` or
|
|
930
|
-
clicking with a mouse.
|
|
931
|
-
</CardContent>
|
|
932
|
-
<CardActions>
|
|
933
|
-
<Link href="#" type={LinkTypes.Button}>
|
|
934
|
-
Button
|
|
935
|
-
</Link>
|
|
936
|
-
<Link href="#" type={LinkTypes.Forwards}>
|
|
937
|
-
Other link
|
|
938
|
-
</Link>
|
|
939
|
-
</CardActions>
|
|
940
|
-
</Card>
|
|
941
|
-
<Card
|
|
942
|
-
imageProps={{
|
|
943
|
-
alt: "Alt text",
|
|
944
|
-
aspectRatio: ImageRatios.TwoByOne,
|
|
945
|
-
isAtEnd: true,
|
|
946
|
-
src: "https://placeimg.com/410/210/animals",
|
|
947
|
-
}}
|
|
948
|
-
mainActionLink="http://nypl.org"
|
|
949
|
-
>
|
|
950
|
-
<CardHeading level={HeadingLevels.Three} id="fullclick2-heading1">
|
|
951
|
-
Go to NYPL home page.
|
|
952
|
-
</CardHeading>
|
|
953
|
-
<CardContent>
|
|
954
|
-
This `Card` component does not have any extra links.
|
|
955
|
-
</CardContent>
|
|
956
|
-
</Card>
|
|
957
|
-
</SimpleGrid>
|
|
958
|
-
</Story>
|
|
959
|
-
</Canvas>
|
|
960
|
-
|
|
961
|
-
## Accessibility
|
|
962
|
-
|
|
963
|
-
### Headings
|
|
964
|
-
|
|
965
|
-
In general, headings from `h1` through `h6` must be in sequential order in the
|
|
966
|
-
DOM tree. Rendering an `h4` following an `h2` will throw an error. Therefore,
|
|
967
|
-
when adding `CardHeading` components, make sure to add them in sequential order
|
|
968
|
-
with the `level` prop.
|
|
969
|
-
|
|
970
|
-
```tsx
|
|
971
|
-
<CardHeading level={HeadingLevels.Three} id="headingthree">
|
|
972
|
-
Heading level three
|
|
973
|
-
</CardHeading>
|
|
974
|
-
<CardHeading level={HeadingLevels.Four} id="headingfour">
|
|
975
|
-
Heading level four
|
|
976
|
-
</CardHeading>
|
|
977
|
-
```
|
|
978
|
-
|
|
979
|
-
### Full-Click Functionality
|
|
980
|
-
|
|
981
|
-
Passing in a URL in the `mainActionLink` prop will make the entire `Card`
|
|
982
|
-
clickable. Other links in the `CardActions` component can still be accessed by
|
|
983
|
-
tabbing through and pressing "enter" or by clicking as you normally would on a
|
|
984
|
-
link.
|