@nypl/design-system-react-components 0.25.11 → 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 +151 -0
- package/README.md +14 -26
- package/dist/components/Accordion/Accordion.d.ts +6 -4
- package/dist/components/Accordion/AccordionTypes.d.ts +5 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +4 -4
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +2 -1
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Card/Card.d.ts +22 -29
- package/dist/components/Checkbox/Checkbox.d.ts +3 -3
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +9 -6
- 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 +5 -5
- package/dist/components/Heading/HeadingTypes.d.ts +1 -1
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +9 -8
- package/dist/components/Hero/Hero.d.ts +9 -5
- package/dist/components/HorizontalRule/HorizontalRule.d.ts +2 -10
- package/dist/components/Icons/Icon.d.ts +2 -1
- package/dist/components/Icons/IconTypes.d.ts +10 -7
- package/dist/components/Image/Image.d.ts +27 -9
- package/dist/components/Image/ImageTypes.d.ts +4 -4
- 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 +8 -0
- package/dist/components/Logo/LogoTypes.d.ts +10 -2
- package/dist/components/Notification/Notification.d.ts +7 -7
- package/dist/components/Pagination/Pagination.d.ts +8 -4
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +3 -3
- package/dist/components/Radio/Radio.d.ts +5 -7
- package/dist/components/RadioGroup/RadioGroup.d.ts +16 -8
- package/dist/components/SearchBar/SearchBar.d.ts +5 -5
- package/dist/components/Select/Select.d.ts +12 -8
- package/dist/components/Select/SelectTypes.d.ts +4 -0
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +8 -6
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -4
- 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 +10 -23
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +7 -6
- package/dist/components/Template/Template.d.ts +18 -9
- package/dist/components/Text/Text.d.ts +4 -4
- package/dist/components/Text/TextTypes.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +7 -7
- package/dist/components/Toggle/Toggle.d.ts +8 -10
- package/dist/components/Toggle/{ToggleSizes.d.ts → ToggleTypes.d.ts} +1 -1
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
- package/dist/design-system-react-components.cjs.development.js +2802 -1686
- 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 +2811 -1699
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/helpers/enums.d.ts +4 -0
- package/dist/hooks/useCarouselStyles.d.ts +3 -2
- package/dist/hooks/useNYPLTheme.d.ts +12 -0
- package/dist/index.d.ts +11 -9
- package/dist/styles.css +1 -1
- package/dist/theme/components/accordion.d.ts +7 -12
- package/dist/theme/components/breadcrumb.d.ts +6 -0
- package/dist/theme/components/button.d.ts +10 -2
- package/dist/theme/components/card.d.ts +44 -24
- package/dist/theme/components/checkbox.d.ts +6 -6
- package/dist/theme/components/checkboxGroup.d.ts +4 -2
- 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 +6 -14
- package/dist/theme/components/global.d.ts +37 -29
- package/dist/theme/components/globalMixins.d.ts +8 -8
- 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 +21 -15
- package/dist/theme/components/image.d.ts +1 -1
- package/dist/theme/components/label.d.ts +9 -10
- package/dist/theme/components/list.d.ts +105 -9
- package/dist/theme/components/notification.d.ts +7 -4
- package/dist/theme/components/pagination.d.ts +2 -5
- package/dist/theme/components/radio.d.ts +10 -6
- package/dist/theme/components/radioGroup.d.ts +4 -2
- package/dist/theme/components/select.d.ts +38 -13
- package/dist/theme/components/skeletonLoader.d.ts +2 -2
- package/dist/theme/components/slider.d.ts +14 -7
- package/dist/theme/components/structuredContent.d.ts +197 -0
- package/dist/theme/components/textInput.d.ts +22 -14
- package/dist/theme/components/toggle.d.ts +25 -6
- package/dist/theme/foundations/global.d.ts +33 -3
- package/dist/theme/foundations/radii.d.ts +1 -0
- package/dist/theme/foundations/spacing.d.ts +46 -43
- package/dist/utils/utils.d.ts +10 -0
- package/package.json +5 -6
- package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +34 -0
- package/src/components/Accordion/Accordion.stories.mdx +150 -66
- package/src/components/Accordion/Accordion.test.tsx +65 -17
- package/src/components/Accordion/Accordion.tsx +61 -27
- package/src/components/Accordion/AccordionTypes.tsx +5 -0
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +505 -14
- package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +53 -18
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +66 -35
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +14 -13
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +2 -1
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +308 -10
- 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 +493 -329
- package/src/components/Card/Card.test.tsx +138 -18
- package/src/components/Card/Card.tsx +151 -85
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +220 -100
- package/src/components/Chakra/Center.stories.mdx +2 -2
- package/src/components/Chakra/Grid.stories.mdx +4 -4
- package/src/components/Checkbox/Checkbox.stories.mdx +73 -9
- package/src/components/Checkbox/Checkbox.test.tsx +89 -10
- package/src/components/Checkbox/Checkbox.tsx +27 -16
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +209 -6
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +135 -23
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +216 -90
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +39 -26
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +493 -89
- 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 +94 -15
- package/src/components/DatePicker/DatePicker.tsx +67 -58
- 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 +118 -47
- package/src/components/Form/Form.test.tsx +59 -16
- package/src/components/Form/Form.tsx +89 -65
- 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 +87 -41
- package/src/components/Grid/SimpleGrid.test.tsx +24 -9
- 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 +56 -25
- package/src/components/Heading/Heading.test.tsx +17 -7
- package/src/components/Heading/Heading.tsx +60 -58
- package/src/components/Heading/HeadingTypes.tsx +1 -1
- package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +27 -8
- 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 +143 -113
- package/src/components/Hero/Hero.test.tsx +146 -58
- package/src/components/Hero/Hero.tsx +144 -112
- 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 -17
- package/src/components/HorizontalRule/HorizontalRule.tsx +9 -25
- package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +18 -5
- package/src/components/Icons/Icon.stories.mdx +80 -23
- package/src/components/Icons/Icon.test.tsx +51 -2
- package/src/components/Icons/Icon.tsx +93 -71
- package/src/components/Icons/IconTypes.tsx +9 -6
- package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +129 -0
- package/src/components/Image/Image.stories.mdx +160 -71
- package/src/components/Image/Image.test.tsx +40 -48
- package/src/components/Image/Image.tsx +80 -48
- package/src/components/Image/ImageTypes.ts +4 -4
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +84 -21
- 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 +16 -9
- 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 +73 -22
- package/src/components/List/List.tsx +44 -28
- 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 +40 -16
- package/src/components/Logo/Logo.test.tsx +29 -2
- package/src/components/Logo/Logo.tsx +28 -11
- package/src/components/Logo/LogoSvgs.tsx +16 -0
- package/src/components/Logo/LogoTypes.tsx +9 -1
- 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 +34 -5
- package/src/components/Notification/Notification.test.tsx +43 -9
- package/src/components/Notification/Notification.tsx +59 -55
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +256 -32
- package/src/components/Pagination/Pagination.stories.mdx +76 -13
- package/src/components/Pagination/Pagination.test.tsx +116 -5
- package/src/components/Pagination/Pagination.tsx +54 -29
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +247 -30
- package/src/components/Placeholder/Placeholder.tsx +3 -1
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +76 -10
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +87 -13
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +20 -10
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +101 -14
- package/src/components/Radio/Radio.stories.mdx +75 -11
- package/src/components/Radio/Radio.test.tsx +83 -9
- package/src/components/Radio/Radio.tsx +70 -61
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +168 -10
- package/src/components/RadioGroup/RadioGroup.stories.mdx +293 -94
- package/src/components/RadioGroup/RadioGroup.test.tsx +193 -68
- package/src/components/RadioGroup/RadioGroup.tsx +110 -101
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1258 -902
- package/src/components/SearchBar/SearchBar.stories.mdx +104 -39
- package/src/components/SearchBar/{SearchBar.Test.tsx → SearchBar.test.tsx} +66 -6
- package/src/components/SearchBar/SearchBar.tsx +23 -13
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1039 -0
- package/src/components/Select/Select.stories.mdx +151 -62
- package/src/components/Select/Select.test.tsx +56 -44
- package/src/components/Select/Select.tsx +125 -104
- 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 +53 -23
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +14 -8
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +80 -78
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +169 -10
- package/src/components/Slider/Slider.stories.mdx +123 -41
- package/src/components/Slider/Slider.test.tsx +65 -17
- package/src/components/Slider/Slider.tsx +34 -24
- 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 +19 -1
- 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 +229 -61
- package/src/components/StructuredContent/StructuredContent.test.tsx +162 -101
- package/src/components/StructuredContent/StructuredContent.tsx +98 -103
- package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +102 -17
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -9
- package/src/components/StyleGuide/Breakpoints.stories.mdx +6 -6
- package/src/components/StyleGuide/Buttons.stories.mdx +2 -12
- package/src/components/StyleGuide/ColorCard.tsx +4 -4
- package/src/components/StyleGuide/Colors.stories.mdx +34 -20
- 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 +47 -33
- package/src/components/Table/Table.stories.mdx +38 -11
- package/src/components/Table/Table.test.tsx +16 -1
- package/src/components/Table/Table.tsx +10 -8
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +408 -5
- package/src/components/Tabs/Tabs.stories.mdx +59 -10
- package/src/components/Tabs/Tabs.test.tsx +29 -11
- package/src/components/Tabs/Tabs.tsx +28 -21
- package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +394 -5
- package/src/components/Template/Template.stories.mdx +73 -32
- package/src/components/Template/Template.test.tsx +68 -5
- package/src/components/Template/Template.tsx +86 -72
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +195 -22
- package/src/components/Text/Text.stories.mdx +32 -15
- package/src/components/Text/Text.test.tsx +14 -11
- package/src/components/Text/Text.tsx +13 -16
- package/src/components/Text/TextTypes.tsx +1 -1
- package/src/components/Text/__snapshots__/Text.test.tsx.snap +21 -4
- package/src/components/TextInput/TextInput.stories.mdx +73 -27
- package/src/components/TextInput/TextInput.test.tsx +65 -50
- package/src/components/TextInput/TextInput.tsx +123 -115
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +96 -73
- package/src/components/Toggle/Toggle.stories.mdx +74 -26
- package/src/components/Toggle/Toggle.test.tsx +41 -10
- package/src/components/Toggle/Toggle.tsx +31 -27
- package/src/components/Toggle/{ToggleSizes.tsx → ToggleTypes.tsx} +1 -1
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +195 -8
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +52 -4
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +41 -6
- package/src/components/VideoPlayer/VideoPlayer.tsx +134 -120
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +81 -39
- package/src/docs/Chakra.stories.mdx +51 -10
- package/src/docs/Welcome.stories.mdx +168 -0
- package/src/{components/Card/CardTypes.tsx → helpers/enums.ts} +2 -2
- package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
- package/src/hooks/useCarouselStyles.stories.mdx +30 -0
- package/src/hooks/useCarouselStyles.ts +3 -2
- package/src/hooks/useNYPLTheme.stories.mdx +101 -0
- package/src/hooks/useNYPLTheme.ts +31 -7
- package/src/hooks/useWindowSize.stories.mdx +23 -0
- package/src/index.ts +11 -15
- package/src/styles/base/_place-holder.scss +3 -1
- package/src/styles.scss +0 -2
- package/src/theme/components/accordion.ts +7 -12
- package/src/theme/components/breadcrumb.ts +7 -0
- package/src/theme/components/button.ts +15 -7
- package/src/theme/components/card.ts +56 -36
- package/src/theme/components/checkbox.ts +12 -14
- package/src/theme/components/checkboxGroup.ts +4 -2
- package/src/theme/components/componentWrapper.ts +2 -2
- package/src/theme/components/customTable.ts +39 -31
- package/src/theme/components/fieldset.ts +3 -2
- package/src/theme/components/global.ts +42 -33
- package/src/theme/components/globalMixins.ts +8 -8
- package/src/theme/components/heading.ts +1 -1
- package/src/theme/components/helperErrorText.ts +1 -0
- package/src/theme/components/hero.ts +14 -16
- package/src/theme/components/icon.ts +5 -2
- package/src/theme/components/image.ts +1 -1
- package/src/theme/components/label.ts +4 -3
- package/src/theme/components/list.ts +76 -65
- package/src/theme/components/notification.ts +10 -7
- package/src/theme/components/pagination.ts +2 -5
- package/src/theme/components/progressIndicator.ts +3 -3
- package/src/theme/components/radio.ts +11 -14
- package/src/theme/components/radioGroup.ts +4 -2
- package/src/theme/components/select.ts +37 -18
- package/src/theme/components/skeletonLoader.ts +3 -3
- package/src/theme/components/slider.ts +19 -15
- 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 +76 -42
- package/src/theme/components/videoPlayer.ts +1 -1
- package/src/theme/foundations/colors.ts +20 -13
- package/src/theme/foundations/global.ts +17 -5
- package/src/theme/foundations/radii.ts +1 -0
- package/src/theme/foundations/spacing.ts +70 -22
- package/src/theme/foundations/typography.ts +3 -3
- package/src/utils/componentCategories.ts +28 -21
- package/src/utils/utils.ts +28 -0
- package/dist/components/Card/CardTypes.d.ts +0 -4
- package/dist/components/CheckboxGroup/CheckboxGroupLayoutTypes.d.ts +0 -4
- package/dist/components/Pagination/Pagination.stories.d.ts +0 -13
- package/dist/components/RadioGroup/RadioGroupLayoutTypes.d.ts +0 -4
- package/dist/components/SearchBar/SearchBar.Test.d.ts +0 -1
- package/dist/helpers/generateUUID.d.ts +0 -1
- package/src/components/CheckboxGroup/CheckboxGroupLayoutTypes.tsx +0 -4
- package/src/components/Pagination/Pagination.stories.tsx +0 -54
- package/src/components/RadioGroup/RadioGroupLayoutTypes.tsx +0 -4
- package/src/docs/Intro.stories.mdx +0 -53
- package/src/helpers/generateUUID.tsx +0 -5
- package/src/styles/base/_03-base.scss +0 -25
- package/src/styles/base/_04-focus.scss +0 -22
|
@@ -11,9 +11,8 @@ import { withDesign } from "storybook-addon-designs";
|
|
|
11
11
|
import Button from "../Button/Button";
|
|
12
12
|
import { ButtonTypes } from "../Button/ButtonTypes";
|
|
13
13
|
import Card, { CardHeading, CardContent, CardActions } from "./Card";
|
|
14
|
-
import { CardLayouts } from "./CardTypes";
|
|
15
14
|
import Heading from "../Heading/Heading";
|
|
16
|
-
import {
|
|
15
|
+
import { HeadingSizes, HeadingLevels } from "../Heading/HeadingTypes";
|
|
17
16
|
import HorizontalRule from "../HorizontalRule/HorizontalRule";
|
|
18
17
|
import Icon from "../Icons/Icon";
|
|
19
18
|
import Image from "../Image/Image";
|
|
@@ -21,6 +20,7 @@ import { ImageRatios, ImageSizes } from "../Image/ImageTypes";
|
|
|
21
20
|
import Link from "../Link/Link";
|
|
22
21
|
import { LinkTypes } from "../Link/LinkTypes";
|
|
23
22
|
import SimpleGrid from "../Grid/SimpleGrid";
|
|
23
|
+
import { LayoutTypes } from "../../helpers/enums";
|
|
24
24
|
import { getCategory } from "../../utils/componentCategories";
|
|
25
25
|
import DSProvider from "../../theme/provider";
|
|
26
26
|
import { getStorybookEnumValues } from "../../utils/utils";
|
|
@@ -33,9 +33,9 @@ export const imageSizesEnumValues = getStorybookEnumValues(
|
|
|
33
33
|
ImageSizes,
|
|
34
34
|
"ImageSizes"
|
|
35
35
|
);
|
|
36
|
-
export const
|
|
37
|
-
|
|
38
|
-
"
|
|
36
|
+
export const LayoutTypesEnumValues = getStorybookEnumValues(
|
|
37
|
+
LayoutTypes,
|
|
38
|
+
"LayoutTypes"
|
|
39
39
|
);
|
|
40
40
|
|
|
41
41
|
<Meta
|
|
@@ -51,39 +51,46 @@ export const cardLayoutsEnumValues = getStorybookEnumValues(
|
|
|
51
51
|
}}
|
|
52
52
|
argTypes={{
|
|
53
53
|
backgroundColor: { control: { type: "color" } },
|
|
54
|
-
border: {
|
|
55
|
-
table: { defaultValue: { summary: false } },
|
|
56
|
-
},
|
|
57
|
-
center: {
|
|
58
|
-
table: { defaultValue: { summary: false } },
|
|
59
|
-
},
|
|
60
54
|
className: { control: false },
|
|
61
55
|
foregroundColor: { control: { type: "color" } },
|
|
62
56
|
id: { control: false },
|
|
63
|
-
|
|
57
|
+
imageProps: { disable: true },
|
|
58
|
+
"imageProps.alt": {
|
|
59
|
+
control: { type: "text" },
|
|
64
60
|
table: { defaultValue: { summary: "" } },
|
|
65
61
|
},
|
|
66
|
-
|
|
62
|
+
"imageProps.aspectRatio": {
|
|
67
63
|
control: { type: "select" },
|
|
68
64
|
table: { defaultValue: { summary: "ImageRatios.Square" } },
|
|
69
65
|
options: imageRatiosEnumValues.options,
|
|
70
66
|
},
|
|
71
|
-
|
|
67
|
+
"imageProps.caption": { control: false },
|
|
68
|
+
"imageProps.component": { control: false },
|
|
69
|
+
"imageProps.credit": { control: false },
|
|
70
|
+
"imageProps.isAtEnd": {
|
|
72
71
|
table: { defaultValue: { summary: false } },
|
|
73
72
|
},
|
|
74
|
-
|
|
75
|
-
imageSize: {
|
|
73
|
+
"imageProps.size": {
|
|
76
74
|
control: { type: "select" },
|
|
77
75
|
table: { defaultValue: { summary: "ImageSizes.Default" } },
|
|
78
76
|
options: imageSizesEnumValues.options,
|
|
79
77
|
},
|
|
80
|
-
|
|
78
|
+
"imageProps.src": {
|
|
81
79
|
table: { defaultValue: { summary: "" } },
|
|
82
80
|
},
|
|
81
|
+
isAlignedRightActions: {
|
|
82
|
+
table: { defaultValue: { summary: false } },
|
|
83
|
+
},
|
|
84
|
+
isBordered: {
|
|
85
|
+
table: { defaultValue: { summary: false } },
|
|
86
|
+
},
|
|
87
|
+
isCentered: {
|
|
88
|
+
table: { defaultValue: { summary: false } },
|
|
89
|
+
},
|
|
83
90
|
layout: {
|
|
84
91
|
control: { type: "radio" },
|
|
85
|
-
table: { defaultValue: { summary: "
|
|
86
|
-
options:
|
|
92
|
+
table: { defaultValue: { summary: "LayoutTypes.Column" } },
|
|
93
|
+
options: LayoutTypesEnumValues.options,
|
|
87
94
|
},
|
|
88
95
|
}}
|
|
89
96
|
/>
|
|
@@ -93,7 +100,24 @@ export const cardLayoutsEnumValues = getStorybookEnumValues(
|
|
|
93
100
|
| Component Version | DS Version |
|
|
94
101
|
| ----------------- | ---------- |
|
|
95
102
|
| Added | `0.24.0` |
|
|
96
|
-
| 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
|
|
97
121
|
|
|
98
122
|
<Description of={Card} />
|
|
99
123
|
|
|
@@ -105,48 +129,63 @@ order and each child component may be used multiple times within the content
|
|
|
105
129
|
area. Although a `Card` is a self-contained unit, `Card` components are often
|
|
106
130
|
grouped together and displayed in some type of grid layout.
|
|
107
131
|
|
|
108
|
-
|
|
132
|
+
### CardHeading
|
|
109
133
|
|
|
110
|
-
The `CardHeading` component mirrors the standard
|
|
111
|
-
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).
|
|
112
136
|
|
|
113
|
-
|
|
137
|
+
### CardActions
|
|
114
138
|
|
|
115
139
|
The `CardActions` component is used to display "call to action" (CTA) buttons
|
|
116
140
|
and links for the card. The DS `Button` and `Link` components should be passed
|
|
117
141
|
as children into the `CardActions` component.
|
|
118
142
|
|
|
119
|
-
|
|
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
|
|
120
148
|
|
|
121
149
|
The `CardContent` component should be used to display all content other than
|
|
122
150
|
headings and CTAs.
|
|
123
151
|
|
|
152
|
+
## Component Props
|
|
153
|
+
|
|
124
154
|
<Canvas withToolbar>
|
|
125
155
|
<Story
|
|
126
156
|
name="Card with Controls"
|
|
127
157
|
args={{
|
|
128
158
|
backgroundColor: undefined,
|
|
129
|
-
border: false,
|
|
130
|
-
center: false,
|
|
131
159
|
className: undefined,
|
|
132
160
|
foregroundColor: undefined,
|
|
133
161
|
id: "card-id",
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
162
|
+
"imageProps.alt": "Alt text",
|
|
163
|
+
"imageProps.aspectRatio": "ImageRatios.Square",
|
|
164
|
+
"imageProps.component": undefined,
|
|
165
|
+
"imageProps.isAtEnd": false,
|
|
166
|
+
"imageProps.size": "ImageSizes.Default",
|
|
167
|
+
"imageProps.src": "https://placeimg.com/400/300/animals",
|
|
168
|
+
isAlignedRightActions: false,
|
|
169
|
+
isBordered: false,
|
|
170
|
+
isCentered: false,
|
|
171
|
+
layout: "LayoutTypes.Row",
|
|
141
172
|
mainActionLink: undefined,
|
|
142
173
|
}}
|
|
143
174
|
>
|
|
144
175
|
{(args) => (
|
|
145
176
|
<Card
|
|
146
177
|
{...args}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
178
|
+
imageProps={{
|
|
179
|
+
alt: args["imageProps.alt"],
|
|
180
|
+
aspectRatio: imageRatiosEnumValues.getValue(
|
|
181
|
+
args["imageProps.aspectRatio"]
|
|
182
|
+
),
|
|
183
|
+
component: args["imageProps.component"],
|
|
184
|
+
isAtEnd: args["imageProps.isAtEnd"],
|
|
185
|
+
size: imageSizesEnumValues.getValue(args["imageProps.size"]),
|
|
186
|
+
src: args["imageProps.src"],
|
|
187
|
+
}}
|
|
188
|
+
layout={LayoutTypesEnumValues.getValue(args.layout)}
|
|
150
189
|
>
|
|
151
190
|
<CardHeading level={HeadingLevels.Two} id="main-heading1">
|
|
152
191
|
Optional Header
|
|
@@ -161,17 +200,17 @@ headings and CTAs.
|
|
|
161
200
|
</CardContent>
|
|
162
201
|
<CardActions topBorder bottomBorder>
|
|
163
202
|
<Button
|
|
164
|
-
onClick={action("clicked")}
|
|
165
|
-
id="main-button1"
|
|
166
203
|
buttonType={ButtonTypes.Primary}
|
|
204
|
+
id="main-button1"
|
|
205
|
+
onClick={action("clicked")}
|
|
167
206
|
type="submit"
|
|
168
207
|
>
|
|
169
208
|
Primary
|
|
170
209
|
</Button>
|
|
171
210
|
<Button
|
|
172
|
-
onClick={action("clicked")}
|
|
173
|
-
id="main-button2"
|
|
174
211
|
buttonType={ButtonTypes.Secondary}
|
|
212
|
+
id="main-button2"
|
|
213
|
+
onClick={action("clicked")}
|
|
175
214
|
type="submit"
|
|
176
215
|
>
|
|
177
216
|
Secondary
|
|
@@ -188,11 +227,45 @@ headings and CTAs.
|
|
|
188
227
|
|
|
189
228
|
<ArgsTable story="Card with Controls" />
|
|
190
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
|
+
|
|
191
264
|
## Image Position
|
|
192
265
|
|
|
193
266
|
By default, the image is always the first element within a `Card`. This means
|
|
194
267
|
the image is at the top of a `Card` with a column layout and on the left side of
|
|
195
|
-
a `Card` with a row layout. However, you can use the `
|
|
268
|
+
a `Card` with a row layout. However, you can use the `imageProps.isAtEnd` boolean prop
|
|
196
269
|
to override the default placement and move the image to the last element within
|
|
197
270
|
a `Card`.
|
|
198
271
|
|
|
@@ -202,9 +275,11 @@ a `Card`.
|
|
|
202
275
|
<Story name="Card Image Position">
|
|
203
276
|
<SimpleGrid columns={2}>
|
|
204
277
|
<Card
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
278
|
+
imageProps={{
|
|
279
|
+
alt: "Alt text",
|
|
280
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
281
|
+
src: "https://placeimg.com/400/200/animals",
|
|
282
|
+
}}
|
|
208
283
|
>
|
|
209
284
|
<CardHeading level={HeadingLevels.Three} id="props-heading1">
|
|
210
285
|
Image on Top (default)
|
|
@@ -215,10 +290,12 @@ a `Card`.
|
|
|
215
290
|
</CardContent>
|
|
216
291
|
</Card>
|
|
217
292
|
<Card
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
293
|
+
imageProps={{
|
|
294
|
+
alt: "Alt text",
|
|
295
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
296
|
+
isAtEnd: true,
|
|
297
|
+
src: "https://placeimg.com/400/200/animals",
|
|
298
|
+
}}
|
|
222
299
|
>
|
|
223
300
|
<CardHeading level={HeadingLevels.Three} id="props-heading2">
|
|
224
301
|
Image on Bottom
|
|
@@ -238,11 +315,13 @@ a `Card`.
|
|
|
238
315
|
<DSProvider>
|
|
239
316
|
<SimpleGrid columns={1}>
|
|
240
317
|
<Card
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
318
|
+
imageProps={{
|
|
319
|
+
alt: "Alt text",
|
|
320
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
321
|
+
src: "https://placeimg.com/400/200/animals",
|
|
322
|
+
}}
|
|
323
|
+
isCentered
|
|
324
|
+
layout={LayoutTypes.Row}
|
|
246
325
|
>
|
|
247
326
|
<CardHeading level={HeadingLevels.Four} id="row-heading1">
|
|
248
327
|
Image on Left (default)
|
|
@@ -254,12 +333,14 @@ a `Card`.
|
|
|
254
333
|
</CardContent>
|
|
255
334
|
</Card>
|
|
256
335
|
<Card
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
336
|
+
imageProps={{
|
|
337
|
+
alt: "Alt text",
|
|
338
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
339
|
+
isAtEnd: true,
|
|
340
|
+
src: "https://placeimg.com/400/200/animals",
|
|
341
|
+
}}
|
|
342
|
+
isCentered
|
|
343
|
+
layout={LayoutTypes.Row}
|
|
263
344
|
>
|
|
264
345
|
<CardHeading level={HeadingLevels.Four} id="row-heading2">
|
|
265
346
|
Image on Right
|
|
@@ -277,7 +358,7 @@ a `Card`.
|
|
|
277
358
|
## Image Size
|
|
278
359
|
|
|
279
360
|
By default, the image width is `100%` for a `Card` with a column layout and
|
|
280
|
-
`225px` for a `Card` with a row layout. However, you can use the `
|
|
361
|
+
`225px` for a `Card` with a row layout. However, you can use the `imageProps.size`
|
|
281
362
|
prop to override the default width.
|
|
282
363
|
|
|
283
364
|
### Column Cards
|
|
@@ -286,11 +367,13 @@ prop to override the default width.
|
|
|
286
367
|
<Story name="Card Image Size">
|
|
287
368
|
<SimpleGrid columns={1}>
|
|
288
369
|
<Card
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
370
|
+
imageProps={{
|
|
371
|
+
alt: "Alt text",
|
|
372
|
+
aspectRatio: ImageRatios.Square,
|
|
373
|
+
size: ImageSizes.ExtraExtraSmall,
|
|
374
|
+
src: "https://placeimg.com/400/200/animals",
|
|
375
|
+
}}
|
|
376
|
+
isCentered
|
|
294
377
|
>
|
|
295
378
|
<CardHeading level={HeadingLevels.Three} id="column-heading1">
|
|
296
379
|
Extra Extra Small Image
|
|
@@ -305,11 +388,13 @@ prop to override the default width.
|
|
|
305
388
|
</Card>
|
|
306
389
|
<HorizontalRule />
|
|
307
390
|
<Card
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
391
|
+
imageProps={{
|
|
392
|
+
alt: "Alt text",
|
|
393
|
+
aspectRatio: ImageRatios.Square,
|
|
394
|
+
size: ImageSizes.ExtraSmall,
|
|
395
|
+
src: "https://placeimg.com/400/200/animals",
|
|
396
|
+
}}
|
|
397
|
+
isCentered
|
|
313
398
|
>
|
|
314
399
|
<CardHeading level={HeadingLevels.Three} id="column-heading1">
|
|
315
400
|
Extra Small Image
|
|
@@ -324,11 +409,13 @@ prop to override the default width.
|
|
|
324
409
|
</Card>
|
|
325
410
|
<HorizontalRule />
|
|
326
411
|
<Card
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
412
|
+
imageProps={{
|
|
413
|
+
alt: "Alt text",
|
|
414
|
+
aspectRatio: ImageRatios.Square,
|
|
415
|
+
size: ImageSizes.Small,
|
|
416
|
+
src: "https://placeimg.com/400/200/animals",
|
|
417
|
+
}}
|
|
418
|
+
isCentered
|
|
332
419
|
>
|
|
333
420
|
<CardHeading level={HeadingLevels.Three} id="column-heading1">
|
|
334
421
|
Small Image
|
|
@@ -343,11 +430,13 @@ prop to override the default width.
|
|
|
343
430
|
</Card>
|
|
344
431
|
<HorizontalRule />
|
|
345
432
|
<Card
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
433
|
+
imageProps={{
|
|
434
|
+
alt: "Alt text",
|
|
435
|
+
aspectRatio: ImageRatios.Square,
|
|
436
|
+
size: ImageSizes.Medium,
|
|
437
|
+
src: "https://placeimg.com/400/200/animals",
|
|
438
|
+
}}
|
|
439
|
+
isCentered
|
|
351
440
|
>
|
|
352
441
|
<CardHeading level={HeadingLevels.Three} id="column2-heading1">
|
|
353
442
|
Medium Image
|
|
@@ -362,11 +451,13 @@ prop to override the default width.
|
|
|
362
451
|
</Card>
|
|
363
452
|
<HorizontalRule />
|
|
364
453
|
<Card
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
454
|
+
imageProps={{
|
|
455
|
+
alt: "Alt text",
|
|
456
|
+
aspectRatio: ImageRatios.Square,
|
|
457
|
+
size: ImageSizes.Large,
|
|
458
|
+
src: "https://placeimg.com/400/200/animals",
|
|
459
|
+
}}
|
|
460
|
+
isCentered
|
|
370
461
|
>
|
|
371
462
|
<CardHeading level={HeadingLevels.Three} id="column3-heading1">
|
|
372
463
|
Large Image
|
|
@@ -381,10 +472,12 @@ prop to override the default width.
|
|
|
381
472
|
</Card>
|
|
382
473
|
<HorizontalRule />
|
|
383
474
|
<Card
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
475
|
+
imageProps={{
|
|
476
|
+
alt: "Alt text",
|
|
477
|
+
aspectRatio: ImageRatios.Square,
|
|
478
|
+
src: "https://placeimg.com/400/200/animals",
|
|
479
|
+
}}
|
|
480
|
+
isCentered
|
|
388
481
|
>
|
|
389
482
|
<CardHeading level={HeadingLevels.Three} id="column-4heading1">
|
|
390
483
|
Default Image
|
|
@@ -407,12 +500,14 @@ prop to override the default width.
|
|
|
407
500
|
<DSProvider>
|
|
408
501
|
<SimpleGrid columns={1}>
|
|
409
502
|
<Card
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
503
|
+
imageProps={{
|
|
504
|
+
alt: "Alt text",
|
|
505
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
506
|
+
size: ImageSizes.ExtraExtraSmall,
|
|
507
|
+
src: "https://placeimg.com/400/200/animals",
|
|
508
|
+
}}
|
|
509
|
+
isCentered
|
|
510
|
+
layout={LayoutTypes.Row}
|
|
416
511
|
>
|
|
417
512
|
<CardHeading level={HeadingLevels.Three} id="row2-heading1">
|
|
418
513
|
Extra Extra Small Image
|
|
@@ -425,12 +520,14 @@ prop to override the default width.
|
|
|
425
520
|
</CardContent>
|
|
426
521
|
</Card>
|
|
427
522
|
<Card
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
523
|
+
imageProps={{
|
|
524
|
+
alt: "Alt text",
|
|
525
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
526
|
+
size: ImageSizes.ExtraSmall,
|
|
527
|
+
src: "https://placeimg.com/400/200/animals",
|
|
528
|
+
}}
|
|
529
|
+
isCentered
|
|
530
|
+
layout={LayoutTypes.Row}
|
|
434
531
|
>
|
|
435
532
|
<CardHeading level={HeadingLevels.Three} id="row2-heading1">
|
|
436
533
|
Extra Small Image
|
|
@@ -443,12 +540,14 @@ prop to override the default width.
|
|
|
443
540
|
</CardContent>
|
|
444
541
|
</Card>
|
|
445
542
|
<Card
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
543
|
+
imageProps={{
|
|
544
|
+
alt: "Alt text",
|
|
545
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
546
|
+
size: ImageSizes.Small,
|
|
547
|
+
src: "https://placeimg.com/400/200/animals",
|
|
548
|
+
}}
|
|
549
|
+
isCentered
|
|
550
|
+
layout={LayoutTypes.Row}
|
|
452
551
|
>
|
|
453
552
|
<CardHeading level={HeadingLevels.Three} id="row2-heading1">
|
|
454
553
|
Small Image
|
|
@@ -461,12 +560,14 @@ prop to override the default width.
|
|
|
461
560
|
</CardContent>
|
|
462
561
|
</Card>
|
|
463
562
|
<Card
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
563
|
+
imageProps={{
|
|
564
|
+
alt: "Alt text",
|
|
565
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
566
|
+
size: ImageSizes.Medium,
|
|
567
|
+
src: "https://placeimg.com/400/200/animals",
|
|
568
|
+
}}
|
|
569
|
+
isCentered
|
|
570
|
+
layout={LayoutTypes.Row}
|
|
470
571
|
>
|
|
471
572
|
<CardHeading level={HeadingLevels.Three} id="row3-heading2">
|
|
472
573
|
Medium Image
|
|
@@ -480,12 +581,14 @@ prop to override the default width.
|
|
|
480
581
|
</CardContent>
|
|
481
582
|
</Card>
|
|
482
583
|
<Card
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
584
|
+
imageProps={{
|
|
585
|
+
alt: "Alt text",
|
|
586
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
587
|
+
size: ImageSizes.Large,
|
|
588
|
+
src: "https://placeimg.com/400/200/animals",
|
|
589
|
+
}}
|
|
590
|
+
isCentered
|
|
591
|
+
layout={LayoutTypes.Row}
|
|
489
592
|
>
|
|
490
593
|
<CardHeading level={HeadingLevels.Three} id="row4-heading1">
|
|
491
594
|
Large Image
|
|
@@ -500,11 +603,13 @@ prop to override the default width.
|
|
|
500
603
|
</CardContent>
|
|
501
604
|
</Card>
|
|
502
605
|
<Card
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
606
|
+
imageProps={{
|
|
607
|
+
alt: "Alt text",
|
|
608
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
609
|
+
src: "https://placeimg.com/400/200/animals",
|
|
610
|
+
}}
|
|
611
|
+
isCentered
|
|
612
|
+
layout={LayoutTypes.Row}
|
|
508
613
|
>
|
|
509
614
|
<CardHeading level={HeadingLevels.Three} id="row5-heading2">
|
|
510
615
|
Default Image
|
|
@@ -522,15 +627,223 @@ prop to override the default width.
|
|
|
522
627
|
</DSProvider>
|
|
523
628
|
</Canvas>
|
|
524
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
|
+
|
|
525
836
|
## Cards in a Grid
|
|
526
837
|
|
|
527
838
|
<Canvas>
|
|
528
839
|
<Story name="Cards in a Grid">
|
|
529
840
|
<SimpleGrid columns={3}>
|
|
530
841
|
<Card
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
842
|
+
imageProps={{
|
|
843
|
+
alt: "Alt text",
|
|
844
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
845
|
+
src: "https://placeimg.com/400/200/animals",
|
|
846
|
+
}}
|
|
534
847
|
>
|
|
535
848
|
<CardHeading level={HeadingLevels.Three} id="grid1-heading1">
|
|
536
849
|
Card Heading
|
|
@@ -541,9 +854,11 @@ prop to override the default width.
|
|
|
541
854
|
</CardContent>
|
|
542
855
|
</Card>
|
|
543
856
|
<Card
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
857
|
+
imageProps={{
|
|
858
|
+
alt: "Alt text",
|
|
859
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
860
|
+
src: "https://placeimg.com/410/210/animals",
|
|
861
|
+
}}
|
|
547
862
|
>
|
|
548
863
|
<CardHeading level={HeadingLevels.Three} id="grid2-heading1">
|
|
549
864
|
Card Heading
|
|
@@ -554,9 +869,11 @@ prop to override the default width.
|
|
|
554
869
|
</CardContent>
|
|
555
870
|
</Card>
|
|
556
871
|
<Card
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
872
|
+
imageProps={{
|
|
873
|
+
alt: "Alt text",
|
|
874
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
875
|
+
src: "https://placeimg.com/420/220/animals",
|
|
876
|
+
}}
|
|
560
877
|
>
|
|
561
878
|
<CardHeading level={HeadingLevels.Three} id="grid3-heading1">
|
|
562
879
|
Card Heading
|
|
@@ -567,9 +884,11 @@ prop to override the default width.
|
|
|
567
884
|
</CardContent>
|
|
568
885
|
</Card>
|
|
569
886
|
<Card
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
887
|
+
imageProps={{
|
|
888
|
+
alt: "Alt text",
|
|
889
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
890
|
+
src: "https://placeimg.com/430/230/animals",
|
|
891
|
+
}}
|
|
573
892
|
>
|
|
574
893
|
<CardHeading level={HeadingLevels.Three} id="grid4-heading1">
|
|
575
894
|
Card Heading
|
|
@@ -580,9 +899,11 @@ prop to override the default width.
|
|
|
580
899
|
</CardContent>
|
|
581
900
|
</Card>
|
|
582
901
|
<Card
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
902
|
+
imageProps={{
|
|
903
|
+
alt: "Alt text",
|
|
904
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
905
|
+
src: "https://placeimg.com/440/200/animals",
|
|
906
|
+
}}
|
|
586
907
|
>
|
|
587
908
|
<CardHeading level={HeadingLevels.Three} id="grid5-heading1">
|
|
588
909
|
Card Heading
|
|
@@ -593,9 +914,11 @@ prop to override the default width.
|
|
|
593
914
|
</CardContent>
|
|
594
915
|
</Card>
|
|
595
916
|
<Card
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
917
|
+
imageProps={{
|
|
918
|
+
alt: "Alt text",
|
|
919
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
920
|
+
src: "https://placeimg.com/450/200/animals",
|
|
921
|
+
}}
|
|
599
922
|
>
|
|
600
923
|
<CardHeading level={HeadingLevels.Three} id="grid6-heading1">
|
|
601
924
|
Card Heading
|
|
@@ -615,11 +938,13 @@ prop to override the default width.
|
|
|
615
938
|
<Story name="Cards in a Stack">
|
|
616
939
|
<SimpleGrid columns={1}>
|
|
617
940
|
<Card
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
941
|
+
imageProps={{
|
|
942
|
+
alt: "Alt text",
|
|
943
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
944
|
+
src: "https://placeimg.com/400/200/animals",
|
|
945
|
+
}}
|
|
946
|
+
isCentered
|
|
947
|
+
layout={LayoutTypes.Row}
|
|
623
948
|
>
|
|
624
949
|
<CardHeading level={HeadingLevels.Four} id="stack1-heading1">
|
|
625
950
|
Card Heading
|
|
@@ -631,11 +956,13 @@ prop to override the default width.
|
|
|
631
956
|
</CardContent>
|
|
632
957
|
</Card>
|
|
633
958
|
<Card
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
959
|
+
imageProps={{
|
|
960
|
+
alt: "Alt text",
|
|
961
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
962
|
+
src: "https://placeimg.com/410/210/animals",
|
|
963
|
+
}}
|
|
964
|
+
isCentered
|
|
965
|
+
layout={LayoutTypes.Row}
|
|
639
966
|
>
|
|
640
967
|
<CardHeading level={HeadingLevels.Four} id="stack2-heading2">
|
|
641
968
|
Card Heading
|
|
@@ -647,11 +974,13 @@ prop to override the default width.
|
|
|
647
974
|
</CardContent>
|
|
648
975
|
</Card>
|
|
649
976
|
<Card
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
977
|
+
imageProps={{
|
|
978
|
+
alt: "Alt text",
|
|
979
|
+
aspectRatio: ImageRatios.TwoByOne,
|
|
980
|
+
src: "https://placeimg.com/420/220/animals",
|
|
981
|
+
}}
|
|
982
|
+
isCentered
|
|
983
|
+
layout={LayoutTypes.Row}
|
|
655
984
|
>
|
|
656
985
|
<CardHeading level={HeadingLevels.Four} id="stack3-heading3">
|
|
657
986
|
Card Heading
|
|
@@ -666,51 +995,12 @@ prop to override the default width.
|
|
|
666
995
|
</Story>
|
|
667
996
|
</Canvas>
|
|
668
997
|
|
|
669
|
-
## Custom Image Component
|
|
670
|
-
|
|
671
|
-
Instead of passing a path for the `imageSrc` prop, you can pass a custom image
|
|
672
|
-
component in using the `imageComponent` prop.
|
|
673
|
-
|
|
674
|
-
<Canvas withToolbar>
|
|
675
|
-
<Story name="Custom Image Component">
|
|
676
|
-
<Card
|
|
677
|
-
imageAlt="Alt text"
|
|
678
|
-
imageAspectRatio={ImageRatios.SixteenByNine}
|
|
679
|
-
imageComponent={
|
|
680
|
-
<Image src="https://placeimg.com/400/400/animals" alt="Alt text" />
|
|
681
|
-
}
|
|
682
|
-
>
|
|
683
|
-
<CardHeading level={HeadingLevels.Two} id="img1-heading1">
|
|
684
|
-
Card Component with Custom Image Component
|
|
685
|
-
</CardHeading>
|
|
686
|
-
<CardHeading level={HeadingLevels.Three} id="img2-heading2">
|
|
687
|
-
Secondary Heading
|
|
688
|
-
</CardHeading>
|
|
689
|
-
<CardContent>
|
|
690
|
-
Nulla vitae elit libero, a pharetra augue. Lorem ipsum dolor sit amet,
|
|
691
|
-
consectetur adipiscing elit. Aenean lacinia bibendum nulla sed
|
|
692
|
-
consectetur. Vestibulum id ligula porta felis euismod semper. Cras justo
|
|
693
|
-
odio, dapibus ac facilisis in, egestas eget quam. Sed posuere
|
|
694
|
-
consectetur est at lobortis.
|
|
695
|
-
</CardContent>
|
|
696
|
-
<CardActions>
|
|
697
|
-
<Link type={LinkTypes.Button} href="#">
|
|
698
|
-
Reserve
|
|
699
|
-
</Link>
|
|
700
|
-
<Link href="#url" type={LinkTypes.Forwards}>
|
|
701
|
-
View Book Details
|
|
702
|
-
</Link>
|
|
703
|
-
</CardActions>
|
|
704
|
-
</Card>
|
|
705
|
-
</Story>
|
|
706
|
-
</Canvas>
|
|
707
|
-
|
|
708
998
|
## Cards Without Images
|
|
709
999
|
|
|
710
1000
|
<Canvas>
|
|
711
1001
|
<Story name="Cards Without Images">
|
|
712
1002
|
<SimpleGrid columns={3}>
|
|
713
|
-
<Card
|
|
1003
|
+
<Card isBordered>
|
|
714
1004
|
<CardHeading level={HeadingLevels.Three} id="no-img1-heading1">
|
|
715
1005
|
Card Heading
|
|
716
1006
|
</CardHeading>
|
|
@@ -720,7 +1010,7 @@ component in using the `imageComponent` prop.
|
|
|
720
1010
|
Praesent commodo cursus magna, vel scelerisque nisl.
|
|
721
1011
|
</CardContent>
|
|
722
1012
|
</Card>
|
|
723
|
-
<Card
|
|
1013
|
+
<Card isBordered>
|
|
724
1014
|
<CardHeading level={HeadingLevels.Three} id="no-img2-heading1">
|
|
725
1015
|
Card Heading
|
|
726
1016
|
</CardHeading>
|
|
@@ -730,7 +1020,7 @@ component in using the `imageComponent` prop.
|
|
|
730
1020
|
Praesent commodo cursus magna, vel scelerisque nisl.
|
|
731
1021
|
</CardContent>
|
|
732
1022
|
</Card>
|
|
733
|
-
<Card
|
|
1023
|
+
<Card isBordered>
|
|
734
1024
|
<CardHeading level={HeadingLevels.Three} id="no-img3-heading1">
|
|
735
1025
|
Card Heading
|
|
736
1026
|
</CardHeading>
|
|
@@ -743,7 +1033,7 @@ component in using the `imageComponent` prop.
|
|
|
743
1033
|
</SimpleGrid>
|
|
744
1034
|
<br />
|
|
745
1035
|
<SimpleGrid columns={1}>
|
|
746
|
-
<Card layout={
|
|
1036
|
+
<Card layout={LayoutTypes.Row} isBordered>
|
|
747
1037
|
<CardHeading level={HeadingLevels.Three} id="no-img4-heading1">
|
|
748
1038
|
Card Heading
|
|
749
1039
|
</CardHeading>
|
|
@@ -756,7 +1046,7 @@ component in using the `imageComponent` prop.
|
|
|
756
1046
|
eget metus.
|
|
757
1047
|
</CardContent>
|
|
758
1048
|
</Card>
|
|
759
|
-
<Card layout={
|
|
1049
|
+
<Card layout={LayoutTypes.Row} isBordered>
|
|
760
1050
|
<CardHeading level={HeadingLevels.Three} id="no-img5-heading1">
|
|
761
1051
|
Card Heading
|
|
762
1052
|
</CardHeading>
|
|
@@ -769,7 +1059,7 @@ component in using the `imageComponent` prop.
|
|
|
769
1059
|
eget metus.
|
|
770
1060
|
</CardContent>
|
|
771
1061
|
</Card>
|
|
772
|
-
<Card layout={
|
|
1062
|
+
<Card layout={LayoutTypes.Row} isBordered>
|
|
773
1063
|
<CardHeading level={HeadingLevels.Three} id="no-img6-heading1">
|
|
774
1064
|
Card Heading
|
|
775
1065
|
</CardHeading>
|
|
@@ -785,129 +1075,3 @@ component in using the `imageComponent` prop.
|
|
|
785
1075
|
</SimpleGrid>
|
|
786
1076
|
</Story>
|
|
787
1077
|
</Canvas>
|
|
788
|
-
|
|
789
|
-
## Card with Link Heading
|
|
790
|
-
|
|
791
|
-
The `CardHeading` component works just like the DS `Heading` component. This
|
|
792
|
-
means that a URL can be passed in the `url` prop for `CardHeading` or a `Link`
|
|
793
|
-
component can be used as a child. Click on "Show code" in the example below to
|
|
794
|
-
see both patterns.
|
|
795
|
-
|
|
796
|
-
<Canvas>
|
|
797
|
-
<Story name="Card With Link Heading">
|
|
798
|
-
<Card
|
|
799
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
800
|
-
imageAlt="Alt text"
|
|
801
|
-
imageAspectRatio={ImageRatios.TwoByOne}
|
|
802
|
-
>
|
|
803
|
-
<CardHeading
|
|
804
|
-
level={HeadingLevels.Three}
|
|
805
|
-
id="link-heading1"
|
|
806
|
-
url="http://nypl.org"
|
|
807
|
-
>
|
|
808
|
-
Go to NYPL home page.
|
|
809
|
-
</CardHeading>
|
|
810
|
-
<CardHeading level={HeadingLevels.Four} id="link-heading2">
|
|
811
|
-
<>
|
|
812
|
-
Go to NYPL <Link href="http://nypl.org">home page</Link>.
|
|
813
|
-
</>
|
|
814
|
-
</CardHeading>
|
|
815
|
-
<CardContent>
|
|
816
|
-
This entire `Card` component is clickable, but the links below are still
|
|
817
|
-
accessible by tabbing through the `Card` and pressing `enter` or
|
|
818
|
-
clicking with a mouse.
|
|
819
|
-
</CardContent>
|
|
820
|
-
<CardActions>
|
|
821
|
-
<Link href="#" type={LinkTypes.Button}>
|
|
822
|
-
Button
|
|
823
|
-
</Link>
|
|
824
|
-
<Link href="#" type={LinkTypes.Forwards}>
|
|
825
|
-
Other link
|
|
826
|
-
</Link>
|
|
827
|
-
</CardActions>
|
|
828
|
-
</Card>
|
|
829
|
-
</Story>
|
|
830
|
-
</Canvas>
|
|
831
|
-
|
|
832
|
-
## Card With Full-Click Functionality
|
|
833
|
-
|
|
834
|
-
To enable the full-click functionality in the `Card` component, pass a URL in
|
|
835
|
-
the `mainActionLink` prop. This will make the entire `Card` component clickable.
|
|
836
|
-
If the `Card` has action links or buttons, they can still be accessed by tabbing
|
|
837
|
-
through the `Card` and pressing `enter` or clicking like a regular link.
|
|
838
|
-
|
|
839
|
-
Internally, if multiple `CardHeading` components are passed, only the first one
|
|
840
|
-
will have the full-click link. This, however, does not affect the `Card` itself
|
|
841
|
-
from being having the full-click functionality.
|
|
842
|
-
|
|
843
|
-
<Canvas>
|
|
844
|
-
<Story name="Card With Full-Click Functionality">
|
|
845
|
-
<SimpleGrid columns={2}>
|
|
846
|
-
<Card
|
|
847
|
-
imageAlt="Alt text"
|
|
848
|
-
imageAspectRatio={ImageRatios.TwoByOne}
|
|
849
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
850
|
-
mainActionLink="http://nypl.org"
|
|
851
|
-
>
|
|
852
|
-
<CardHeading level={HeadingLevels.Three} id="fullclick1-heading1">
|
|
853
|
-
Go to NYPL home page.
|
|
854
|
-
</CardHeading>
|
|
855
|
-
<CardHeading level={HeadingLevels.Four} id="fullclick1-heading2">
|
|
856
|
-
Some other heading.
|
|
857
|
-
</CardHeading>
|
|
858
|
-
<CardContent>
|
|
859
|
-
This entire `Card` component is clickable, but the links below are
|
|
860
|
-
still accessible by tabbing through the `Card` and pressing `enter` or
|
|
861
|
-
clicking with a mouse.
|
|
862
|
-
</CardContent>
|
|
863
|
-
<CardActions>
|
|
864
|
-
<Link href="#" type={LinkTypes.Button}>
|
|
865
|
-
Button
|
|
866
|
-
</Link>
|
|
867
|
-
<Link href="#" type={LinkTypes.Forwards}>
|
|
868
|
-
Other link
|
|
869
|
-
</Link>
|
|
870
|
-
</CardActions>
|
|
871
|
-
</Card>
|
|
872
|
-
<Card
|
|
873
|
-
imageAlt="Alt text"
|
|
874
|
-
imageAspectRatio={ImageRatios.TwoByOne}
|
|
875
|
-
imageAtEnd
|
|
876
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
877
|
-
mainActionLink="http://nypl.org"
|
|
878
|
-
>
|
|
879
|
-
<CardHeading level={HeadingLevels.Three} id="fullclick2-heading1">
|
|
880
|
-
Go to NYPL home page.
|
|
881
|
-
</CardHeading>
|
|
882
|
-
<CardContent>
|
|
883
|
-
This `Card` component does not have any extra links.
|
|
884
|
-
</CardContent>
|
|
885
|
-
</Card>
|
|
886
|
-
</SimpleGrid>
|
|
887
|
-
</Story>
|
|
888
|
-
</Canvas>
|
|
889
|
-
|
|
890
|
-
## Accessibility
|
|
891
|
-
|
|
892
|
-
### Headings
|
|
893
|
-
|
|
894
|
-
In general, headings from `h1` through `h6` must be in sequential order in the
|
|
895
|
-
DOM tree. Rendering an `h4` following an `h2` will throw an error. Therefore,
|
|
896
|
-
when adding `CardHeading` components, make sure to add them in sequential order
|
|
897
|
-
with the `level` prop.
|
|
898
|
-
|
|
899
|
-
```tsx
|
|
900
|
-
<CardHeading level={HeadingLevels.Three} id="headingthree">
|
|
901
|
-
Heading level three
|
|
902
|
-
</CardHeading>
|
|
903
|
-
<CardHeading level={HeadingLevels.Four} id="headingfour">
|
|
904
|
-
Heading level four
|
|
905
|
-
</CardHeading>
|
|
906
|
-
```
|
|
907
|
-
|
|
908
|
-
### Full-Click Functionality
|
|
909
|
-
|
|
910
|
-
Passing in a URL in the `mainActionLink` prop will make the entire `Card`
|
|
911
|
-
clickable. Other links in the `CardActions` component can still be accessed by
|
|
912
|
-
tabbing through and pressing "enter" or by clicking as you normally would on a
|
|
913
|
-
link.
|