@nypl/design-system-react-components 0.25.1 → 0.25.5
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 +118 -1
- package/README.md +98 -50
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/dist/components/Button/Button.d.ts +13 -8
- package/dist/components/Button/ButtonTypes.d.ts +2 -1
- package/dist/components/Card/Card.d.ts +36 -52
- package/dist/components/Card/CardTypes.d.ts +0 -15
- package/dist/components/Checkbox/Checkbox.d.ts +17 -13
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +4 -2
- package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +15 -0
- package/dist/components/DatePicker/DatePicker.d.ts +36 -34
- package/dist/components/Fieldset/Fieldset.d.ts +25 -0
- package/dist/components/Heading/Heading.d.ts +4 -4
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +17 -14
- package/dist/components/HorizontalRule/HorizontalRule.d.ts +10 -9
- package/dist/components/Icons/Icon.d.ts +8 -0
- package/dist/components/Icons/IconSvgs.d.ts +11 -0
- package/dist/components/Icons/IconTypes.d.ts +11 -0
- package/dist/components/Image/Image.d.ts +19 -9
- package/dist/components/Image/ImageTypes.d.ts +20 -0
- package/dist/components/Link/Link.d.ts +4 -0
- package/dist/components/List/List.d.ts +19 -14
- package/dist/components/Notification/Notification.d.ts +37 -16
- package/dist/components/Pagination/Pagination.d.ts +16 -13
- package/dist/components/Pagination/Pagination.stories.d.ts +2 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +29 -0
- package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +8 -0
- package/dist/components/Radio/Radio.d.ts +2 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +4 -2
- package/dist/components/SearchBar/SearchBar.d.ts +3 -3
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +18 -14
- package/dist/components/Slider/Slider.d.ts +57 -0
- package/dist/components/StyleGuide/ColorCard.d.ts +12 -0
- package/dist/components/Tabs/Tabs.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +12 -0
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +6 -8
- package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +2 -2
- package/dist/design-system-react-components.cjs.development.js +6131 -3715
- 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 +6124 -3699
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/hooks/tests/useCarouselStyles.test.d.ts +1 -0
- package/dist/hooks/useCarouselStyles.d.ts +16 -0
- package/dist/hooks/useNYPLTheme.d.ts +54 -0
- package/dist/hooks/useWindowSize.d.ts +10 -0
- package/dist/index.d.ts +13 -8
- package/dist/resources.scss +180 -170
- package/dist/styles.css +1 -1
- package/dist/theme/components/button.d.ts +22 -8
- package/dist/theme/components/card.d.ts +168 -0
- package/dist/theme/components/checkbox.d.ts +5 -1
- package/dist/theme/components/checkboxGroup.d.ts +12 -0
- package/dist/theme/components/componentWrapper.d.ts +11 -0
- package/dist/theme/components/datePicker.d.ts +16 -0
- package/dist/theme/components/fieldset.d.ts +27 -0
- package/dist/theme/components/global.d.ts +23 -13
- package/dist/theme/components/globalMixins.d.ts +9 -1
- package/dist/theme/components/heading.d.ts +5 -0
- package/dist/theme/components/helperErrorText.d.ts +10 -0
- package/dist/theme/components/hero.d.ts +1 -0
- package/dist/theme/components/horizontalRule.d.ts +14 -0
- package/dist/theme/components/image.d.ts +31 -0
- package/dist/theme/components/label.d.ts +5 -3
- package/dist/theme/components/link.d.ts +4 -0
- package/dist/theme/components/list.d.ts +89 -0
- package/dist/theme/components/notification.d.ts +75 -0
- package/dist/theme/components/pagination.d.ts +19 -0
- package/dist/theme/components/progressIndicator.d.ts +50 -0
- package/dist/theme/components/radioGroup.d.ts +12 -0
- package/dist/theme/components/select.d.ts +11 -2
- package/dist/theme/components/skeletonLoader.d.ts +98 -0
- package/dist/theme/components/slider.d.ts +51 -0
- package/dist/theme/components/tabs.d.ts +54 -3
- package/dist/theme/components/textInput.d.ts +8 -1
- package/dist/theme/components/videoPlayer.d.ts +40 -0
- package/dist/theme/foundations/breakpoints.d.ts +8 -8
- package/dist/theme/foundations/global.d.ts +6 -1
- package/dist/theme/foundations/radii.d.ts +5 -0
- package/dist/theme/foundations/spacing.d.ts +16 -16
- package/package.json +72 -83
- package/src/__tests__/setup.ts +2 -2
- package/src/components/Accordion/Accordion.stories.mdx +39 -44
- package/src/components/Autosuggest/Autosuggest.stories.mdx +3 -3
- package/src/components/Autosuggest/Autosuggest.stories.tsx +2 -1
- package/src/components/Autosuggest/_Autosuggest.scss +5 -5
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +14 -10
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +23 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +5 -1
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +199 -1
- package/src/components/Button/Button.stories.mdx +15 -10
- package/src/components/Button/Button.test.tsx +21 -7
- package/src/components/Button/Button.tsx +22 -34
- package/src/components/Button/ButtonTypes.tsx +1 -0
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +41 -10
- package/src/components/Card/Card.stories.mdx +296 -259
- package/src/components/Card/Card.test.tsx +156 -84
- package/src/components/Card/Card.tsx +195 -145
- package/src/components/Card/CardTypes.tsx +0 -17
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +410 -0
- package/src/components/CardEdition/CardEdition.stories.tsx +15 -47
- package/src/components/CardEdition/_CardEdition.scss +22 -23
- package/src/components/Chakra/Box.stories.mdx +15 -16
- package/src/components/Chakra/Center.stories.mdx +31 -16
- package/src/components/Chakra/Grid.stories.mdx +28 -15
- package/src/components/Chakra/Stack.stories.mdx +35 -18
- package/src/components/Checkbox/Checkbox.stories.mdx +33 -11
- package/src/components/Checkbox/Checkbox.test.tsx +47 -2
- package/src/components/Checkbox/Checkbox.tsx +39 -33
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +90 -2
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +82 -2
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +29 -2
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +22 -18
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +47 -81
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +63 -0
- package/src/components/DatePicker/DatePicker.stories.mdx +163 -62
- package/src/components/DatePicker/DatePicker.test.tsx +264 -64
- package/src/components/DatePicker/DatePicker.tsx +159 -128
- package/src/components/DatePicker/_DatePicker.scss +33 -67
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +818 -0
- package/src/components/Fieldset/Fieldset.stories.mdx +55 -0
- package/src/components/Fieldset/Fieldset.test.tsx +125 -0
- package/src/components/Fieldset/Fieldset.tsx +52 -0
- package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +68 -0
- package/src/components/Form/Form.stories.mdx +24 -6
- package/src/components/Form/Form.test.tsx +1 -1
- package/src/components/Form/Form.tsx +1 -0
- package/src/components/Grid/SimpleGrid.stories.mdx +32 -39
- package/src/components/Grid/SimpleGrid.test.tsx +4 -4
- package/src/components/Heading/Heading.stories.mdx +3 -4
- package/src/components/Heading/Heading.tsx +5 -5
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +124 -0
- package/src/components/HelperErrorText/HelperErrorText.test.tsx +39 -44
- package/src/components/HelperErrorText/HelperErrorText.tsx +37 -39
- package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +25 -0
- package/src/components/Hero/Hero.stories.mdx +12 -2
- package/src/components/Hero/Hero.tsx +1 -1
- package/src/components/Hero/HeroTypes.tsx +1 -0
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +7 -7
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +8 -6
- package/src/components/HorizontalRule/HorizontalRule.test.tsx +33 -28
- package/src/components/HorizontalRule/HorizontalRule.tsx +27 -29
- package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +27 -9
- package/src/components/Icons/Icon.stories.mdx +12 -4
- package/src/components/Icons/Icon.test.tsx +18 -0
- package/src/components/Icons/Icon.tsx +16 -1
- package/src/components/Icons/IconSvgs.tsx +22 -0
- package/src/components/Icons/IconTypes.tsx +11 -0
- package/src/components/Image/Image.stories.mdx +220 -0
- package/src/components/Image/Image.test.tsx +131 -29
- package/src/components/Image/Image.tsx +84 -56
- package/src/components/Image/ImageTypes.ts +22 -0
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +190 -0
- package/src/components/Input/Input.stories.tsx +23 -67
- package/src/components/Input/Input.test.tsx +4 -4
- package/src/components/Input/_Input.scss +23 -14
- package/src/components/Link/Link.tsx +4 -1
- package/src/components/List/List.stories.mdx +124 -49
- package/src/components/List/List.test.tsx +142 -63
- package/src/components/List/List.tsx +89 -93
- package/src/components/List/__snapshots__/List.test.tsx.snap +109 -0
- package/src/components/Modal/Modal.stories.mdx +3 -3
- package/src/components/Modal/_Modal.scss +2 -2
- package/src/components/Notification/Notification.stories.mdx +109 -112
- package/src/components/Notification/Notification.test.tsx +99 -110
- package/src/components/Notification/Notification.tsx +156 -159
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +159 -8
- package/src/components/Pagination/Pagination.stories.mdx +26 -27
- package/src/components/Pagination/Pagination.stories.tsx +11 -16
- package/src/components/Pagination/Pagination.test.tsx +276 -146
- package/src/components/Pagination/Pagination.tsx +174 -154
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +285 -0
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +292 -0
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +225 -0
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +126 -0
- package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +8 -0
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +357 -0
- package/src/components/Radio/Radio.test.tsx +20 -4
- package/src/components/Radio/Radio.tsx +6 -3
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +3 -0
- package/src/components/RadioGroup/RadioGroup.stories.mdx +3 -4
- package/src/components/RadioGroup/RadioGroup.test.tsx +24 -1
- package/src/components/RadioGroup/RadioGroup.tsx +19 -19
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +42 -72
- package/src/components/SearchBar/SearchBar.Test.tsx +20 -1
- package/src/components/SearchBar/SearchBar.stories.mdx +113 -8
- package/src/components/SearchBar/SearchBar.tsx +20 -10
- package/src/components/Select/Select.test.tsx +12 -0
- package/src/components/Select/Select.tsx +5 -2
- package/src/components/Select/SelectTypes.tsx +1 -0
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +28 -59
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +97 -177
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +74 -71
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +739 -0
- package/src/components/Slider/Slider.stories.mdx +529 -0
- package/src/components/Slider/Slider.test.tsx +653 -0
- package/src/components/Slider/Slider.tsx +303 -0
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +1946 -0
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +1 -1
- package/src/components/StyleGuide/Breakpoints.stories.mdx +34 -10
- package/src/components/StyleGuide/Buttons.stories.mdx +89 -73
- package/src/components/StyleGuide/ColorCard.tsx +46 -0
- package/src/components/StyleGuide/Colors.stories.mdx +171 -311
- package/src/components/StyleGuide/DesignTokens.stories.mdx +170 -0
- package/src/components/StyleGuide/Forms.stories.mdx +9 -7
- package/src/components/StyleGuide/Iconography.stories.mdx +85 -91
- package/src/components/StyleGuide/Spacing.stories.mdx +31 -23
- package/src/components/StyleGuide/Typography.stories.mdx +202 -189
- package/src/components/StyleGuide/UIDocCard.tsx +1 -1
- package/src/components/Tabs/Tabs.stories.mdx +73 -11
- package/src/components/Tabs/Tabs.tsx +87 -64
- package/src/components/Template/Template.stories.mdx +25 -27
- package/src/components/TextInput/TextInput.stories.mdx +1 -1
- package/src/components/TextInput/TextInput.test.tsx +22 -2
- package/src/components/TextInput/TextInput.tsx +28 -8
- package/src/components/TextInput/TextInputTypes.tsx +2 -0
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +17 -4
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +54 -53
- package/src/components/VideoPlayer/VideoPlayer.tsx +50 -51
- package/src/components/VideoPlayer/VideoPlayerTypes.tsx +2 -2
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +91 -0
- package/src/docs/Chakra.stories.mdx +244 -63
- package/src/docs/Intro.stories.mdx +5 -2
- package/src/hooks/tests/useCarouselStyles.test.ts +140 -0
- package/src/hooks/tests/useNYPLTheme.test.tsx +36 -0
- package/src/hooks/useCarouselStyles.ts +34 -0
- package/src/hooks/useNYPLTheme.ts +67 -0
- package/src/hooks/useWindowSize.ts +40 -0
- package/src/index.ts +22 -19
- package/src/resources.scss +5 -5
- package/src/styles/base/{_02-breakpoints.scss → _01-breakpoints.scss} +9 -10
- package/src/styles/base/{_03-mixins.scss → _02-mixins.scss} +16 -5
- package/src/styles/base/{_04-base.scss → _03-base.scss} +7 -2
- package/src/styles/base/{_05-focus.scss → _04-focus.scss} +0 -15
- package/src/styles/base/_place-holder.scss +14 -3
- package/src/styles/{03-space → space}/_space-inline.scss +14 -14
- package/src/styles/{03-space → space}/_space-inset.scss +10 -10
- package/src/styles/space/_space-stack.scss +116 -0
- package/src/styles.scss +13 -60
- package/src/theme/components/button.ts +21 -15
- package/src/theme/components/card.ts +174 -0
- package/src/theme/components/checkbox.ts +8 -3
- package/src/theme/components/checkboxGroup.ts +8 -0
- package/src/theme/components/componentWrapper.ts +10 -0
- package/src/theme/components/datePicker.ts +17 -0
- package/src/theme/components/fieldset.ts +18 -0
- package/src/theme/components/global.ts +26 -15
- package/src/theme/components/globalMixins.ts +9 -1
- package/src/theme/components/heading.ts +10 -5
- package/src/theme/components/helperErrorText.ts +9 -0
- package/src/theme/components/hero.ts +4 -3
- package/src/theme/components/horizontalRule.ts +13 -0
- package/src/theme/components/icon.ts +9 -9
- package/src/theme/components/image.ts +116 -0
- package/src/theme/components/label.ts +3 -10
- package/src/theme/components/link.ts +5 -1
- package/src/theme/components/list.ts +73 -0
- package/src/theme/components/notification.ts +93 -0
- package/src/theme/components/pagination.ts +20 -0
- package/src/theme/components/progressIndicator.ts +62 -0
- package/src/theme/components/radio.ts +2 -2
- package/src/theme/components/radioGroup.ts +8 -0
- package/src/theme/components/select.ts +6 -3
- package/src/theme/components/skeletonLoader.ts +107 -0
- package/src/theme/components/slider.ts +79 -0
- package/src/theme/components/statusBadge.ts +1 -2
- package/src/theme/components/tabs.ts +49 -19
- package/src/theme/components/template.ts +8 -8
- package/src/theme/components/textInput.ts +5 -4
- package/src/theme/components/videoPlayer.ts +49 -0
- package/src/theme/foundations/breakpoints.ts +8 -8
- package/src/theme/foundations/global.ts +6 -1
- package/src/theme/foundations/radii.ts +6 -0
- package/src/theme/foundations/spacing.ts +24 -24
- package/src/theme/index.ts +41 -10
- package/src/utils/componentCategories.ts +4 -3
- package/dist/components/HelperErrorText/HelperErrorText.stories.d.ts +0 -16
- package/dist/components/Image/Image.stories.d.ts +0 -18
- package/dist/components/List/List.stories.d.ts +0 -7
- package/dist/theme/components/customCheckboxGroup.d.ts +0 -18
- package/dist/theme/components/customRadioGroup.d.ts +0 -18
- package/src/components/Button/_Button.scss +0 -32
- package/src/components/Card/_Card.scss +0 -308
- package/src/components/HelperErrorText/HelperErrorText.stories.tsx +0 -48
- package/src/components/HelperErrorText/_HelperErrorText.scss +0 -9
- package/src/components/HorizontalRule/_HorizontalRule.scss +0 -15
- package/src/components/Image/Image.stories.tsx +0 -54
- package/src/components/Image/_Image.scss +0 -38
- package/src/components/List/List.stories.tsx +0 -139
- package/src/components/List/_List.scss +0 -76
- package/src/components/Notification/_Notification.scss +0 -110
- package/src/components/Pagination/_Pagination.scss +0 -40
- package/src/components/SkeletonLoader/_SkeletonLoader.scss +0 -142
- package/src/components/VideoPlayer/_VideoPlayer.scss +0 -38
- package/src/styles/01-colors/_colors-brand.scss +0 -62
- package/src/styles/01-colors/_colors-utility.scss +0 -67
- package/src/styles/02-typography/_type-scale.css +0 -11
- package/src/styles/02-typography/_type-weight.css +0 -7
- package/src/styles/02-typography/_typefaces.css +0 -4
- package/src/styles/03-space/_space-stack.scss +0 -116
- package/src/styles/03-space/_space.css +0 -30
- package/src/styles/base/_card-grid.scss +0 -78
- package/src/styles/base/_typography.scss +0 -11
- package/src/theme/components/customCheckboxGroup.ts +0 -12
- package/src/theme/components/customRadioGroup.ts +0 -12
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
Story,
|
|
4
4
|
Canvas,
|
|
5
5
|
ArgsTable,
|
|
6
|
-
Preview,
|
|
7
6
|
Description,
|
|
8
7
|
} from "@storybook/addon-docs/blocks";
|
|
9
8
|
import { withDesign } from "storybook-addon-designs";
|
|
@@ -11,8 +10,8 @@ import { action } from "@storybook/addon-actions";
|
|
|
11
10
|
|
|
12
11
|
import Button from "../Button/Button";
|
|
13
12
|
import { ButtonTypes } from "../Button/ButtonTypes";
|
|
14
|
-
import Card, {
|
|
15
|
-
import {
|
|
13
|
+
import Card, { CardHeading, CardContent, CardActions } from "./Card";
|
|
14
|
+
import { CardLayouts } from "./CardTypes";
|
|
16
15
|
import Link from "../Link/Link";
|
|
17
16
|
import Heading from "../Heading/Heading";
|
|
18
17
|
import HorizontalRule from "../HorizontalRule/HorizontalRule";
|
|
@@ -20,7 +19,10 @@ import { LinkTypes } from "../Link/LinkTypes";
|
|
|
20
19
|
import { HeadingDisplaySizes, HeadingLevels } from "../Heading/HeadingTypes";
|
|
21
20
|
import Icon from "../Icons/Icon";
|
|
22
21
|
import Image from "../Image/Image";
|
|
22
|
+
import { ImageRatios, ImageSizes } from "../Image/ImageTypes";
|
|
23
|
+
import SimpleGrid from "../Grid/SimpleGrid";
|
|
23
24
|
import { getCategory } from "../../utils/componentCategories";
|
|
25
|
+
import DSProvider from "../../theme/provider";
|
|
24
26
|
|
|
25
27
|
<Meta
|
|
26
28
|
title={getCategory("Card")}
|
|
@@ -30,23 +32,13 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
30
32
|
design: {
|
|
31
33
|
type: "figma",
|
|
32
34
|
url:
|
|
33
|
-
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/
|
|
35
|
+
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=36835%3A25747",
|
|
34
36
|
},
|
|
35
37
|
}}
|
|
36
38
|
argTypes={{
|
|
37
|
-
blockName: { table: { disable: true } },
|
|
38
39
|
className: { table: { disable: true } },
|
|
39
|
-
modifiers: { table: { disable: true } },
|
|
40
40
|
id: { table: { disable: true } },
|
|
41
41
|
imageComponent: { table: { disable: true } },
|
|
42
|
-
layout: { table: { disable: false } },
|
|
43
|
-
imageSrc: { table: { disable: false } },
|
|
44
|
-
imageAlt: { table: { disable: false } },
|
|
45
|
-
imageSize: { table: { disable: false } },
|
|
46
|
-
imageAspectRatio: { table: { disable: false } },
|
|
47
|
-
imageAtEnd: { table: { disable: false } },
|
|
48
|
-
border: { table: { disable: false } },
|
|
49
|
-
padding: { table: { disable: false } },
|
|
50
42
|
backgroundColor: { control: { type: "color" } },
|
|
51
43
|
foregroundColor: { control: { type: "color" } },
|
|
52
44
|
}}
|
|
@@ -57,7 +49,7 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
57
49
|
| Component Version | DS Version |
|
|
58
50
|
| ----------------- | ---------- |
|
|
59
51
|
| Added | `0.24.0` |
|
|
60
|
-
| Latest | `0.
|
|
52
|
+
| Latest | `0.25.3` |
|
|
61
53
|
|
|
62
54
|
<Description of={Card} />
|
|
63
55
|
|
|
@@ -75,23 +67,27 @@ The `CardActions` component is used to display "call to action" (CTA) buttons an
|
|
|
75
67
|
|
|
76
68
|
The `CardContent` component should be used to display all content other than headings and CTAs.
|
|
77
69
|
|
|
78
|
-
<
|
|
70
|
+
<Canvas withToolbar>
|
|
79
71
|
<Story
|
|
80
72
|
name="Card Props"
|
|
81
73
|
args={{
|
|
82
74
|
id: "custom-card",
|
|
83
75
|
layout: CardLayouts.Row,
|
|
84
76
|
imageSrc: "https://placeimg.com/400/300/animals",
|
|
85
|
-
imageAspectRatio:
|
|
77
|
+
imageAspectRatio: ImageRatios.ThreeByFour,
|
|
78
|
+
imageSize: ImageSizes.Default,
|
|
86
79
|
imageAlt: "Alt text",
|
|
80
|
+
imageAtEnd: false,
|
|
81
|
+
border: false,
|
|
82
|
+
center: false,
|
|
87
83
|
}}
|
|
88
84
|
>
|
|
89
85
|
{(args) => (
|
|
90
86
|
<Card {...args}>
|
|
91
|
-
<CardHeading level={HeadingLevels.Two} id="heading1">
|
|
87
|
+
<CardHeading level={HeadingLevels.Two} id="main-heading1">
|
|
92
88
|
Optional Header
|
|
93
89
|
</CardHeading>
|
|
94
|
-
<CardHeading level={HeadingLevels.
|
|
90
|
+
<CardHeading level={HeadingLevels.Three} id="main-heading2">
|
|
95
91
|
Sollicitudin Lorem Tortor Purus Ornare
|
|
96
92
|
</CardHeading>
|
|
97
93
|
<CardContent>
|
|
@@ -102,7 +98,7 @@ The `CardContent` component should be used to display all content other than hea
|
|
|
102
98
|
<CardActions topBorder bottomBorder>
|
|
103
99
|
<Button
|
|
104
100
|
onClick={action("clicked")}
|
|
105
|
-
id="button1"
|
|
101
|
+
id="main-button1"
|
|
106
102
|
buttonType={ButtonTypes.Primary}
|
|
107
103
|
type="submit"
|
|
108
104
|
>
|
|
@@ -110,7 +106,7 @@ The `CardContent` component should be used to display all content other than hea
|
|
|
110
106
|
</Button>
|
|
111
107
|
<Button
|
|
112
108
|
onClick={action("clicked")}
|
|
113
|
-
id="button2"
|
|
109
|
+
id="main-button2"
|
|
114
110
|
buttonType={ButtonTypes.Secondary}
|
|
115
111
|
type="submit"
|
|
116
112
|
>
|
|
@@ -125,7 +121,7 @@ The `CardContent` component should be used to display all content other than hea
|
|
|
125
121
|
</Card>
|
|
126
122
|
)}
|
|
127
123
|
</Story>
|
|
128
|
-
</
|
|
124
|
+
</Canvas>
|
|
129
125
|
|
|
130
126
|
<ArgsTable story="Card Props" />
|
|
131
127
|
|
|
@@ -138,21 +134,15 @@ the default placement and move the image to the last element within a `Card`.
|
|
|
138
134
|
|
|
139
135
|
### Column Cards
|
|
140
136
|
|
|
141
|
-
<
|
|
137
|
+
<Canvas>
|
|
142
138
|
<Story name="Card Image Position">
|
|
143
|
-
<
|
|
144
|
-
style={{
|
|
145
|
-
display: "grid",
|
|
146
|
-
"grid-gap": "2rem",
|
|
147
|
-
"grid-template-columns": "repeat(2, 1fr)",
|
|
148
|
-
}}
|
|
149
|
-
>
|
|
139
|
+
<SimpleGrid columns={2}>
|
|
150
140
|
<Card
|
|
151
141
|
imageSrc="https://placeimg.com/400/200/animals"
|
|
152
142
|
imageAlt="Alt text"
|
|
153
|
-
imageAspectRatio={
|
|
143
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
154
144
|
>
|
|
155
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
145
|
+
<CardHeading level={HeadingLevels.Three} id="props-heading1">
|
|
156
146
|
Image on Top (default)
|
|
157
147
|
</CardHeading>
|
|
158
148
|
<CardContent>
|
|
@@ -163,10 +153,10 @@ the default placement and move the image to the last element within a `Card`.
|
|
|
163
153
|
<Card
|
|
164
154
|
imageSrc="https://placeimg.com/410/210/animals"
|
|
165
155
|
imageAlt="Alt text"
|
|
166
|
-
imageAspectRatio={
|
|
156
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
167
157
|
imageAtEnd
|
|
168
158
|
>
|
|
169
|
-
<CardHeading level={HeadingLevels.Three} id="
|
|
159
|
+
<CardHeading level={HeadingLevels.Three} id="props-heading2">
|
|
170
160
|
Image on Bottom
|
|
171
161
|
</CardHeading>
|
|
172
162
|
<CardContent>
|
|
@@ -174,55 +164,51 @@ the default placement and move the image to the last element within a `Card`.
|
|
|
174
164
|
libero, a pharetra augue.
|
|
175
165
|
</CardContent>
|
|
176
166
|
</Card>
|
|
177
|
-
</
|
|
167
|
+
</SimpleGrid>
|
|
178
168
|
</Story>
|
|
179
|
-
</
|
|
169
|
+
</Canvas>
|
|
180
170
|
|
|
181
171
|
### Row Cards
|
|
182
172
|
|
|
183
|
-
<
|
|
184
|
-
<
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
</CardContent>
|
|
223
|
-
</Card>
|
|
224
|
-
</div>
|
|
225
|
-
</Preview>
|
|
173
|
+
<Canvas>
|
|
174
|
+
<DSProvider>
|
|
175
|
+
<SimpleGrid columns={1}>
|
|
176
|
+
<Card
|
|
177
|
+
layout={CardLayouts.Row}
|
|
178
|
+
center
|
|
179
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
180
|
+
imageAlt="Alt text"
|
|
181
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
182
|
+
>
|
|
183
|
+
<CardHeading level={HeadingLevels.Four} id="row-heading1">
|
|
184
|
+
Image on Left (default)
|
|
185
|
+
</CardHeading>
|
|
186
|
+
<CardContent>
|
|
187
|
+
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
188
|
+
Sed posuere consectetur est at lobortis. Cras justo odio, dapibus ac
|
|
189
|
+
facilisis in, egestas eget quam.
|
|
190
|
+
</CardContent>
|
|
191
|
+
</Card>
|
|
192
|
+
<Card
|
|
193
|
+
layout={CardLayouts.Row}
|
|
194
|
+
center
|
|
195
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
196
|
+
imageAlt="Alt text"
|
|
197
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
198
|
+
imageAtEnd
|
|
199
|
+
>
|
|
200
|
+
<CardHeading level={HeadingLevels.Four} id="row-heading2">
|
|
201
|
+
Image on Right
|
|
202
|
+
</CardHeading>
|
|
203
|
+
<CardContent>
|
|
204
|
+
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
205
|
+
Sed posuere consectetur est at lobortis. Cras justo odio, dapibus ac
|
|
206
|
+
facilisis in, egestas eget quam.
|
|
207
|
+
</CardContent>
|
|
208
|
+
</Card>
|
|
209
|
+
</SimpleGrid>
|
|
210
|
+
</DSProvider>
|
|
211
|
+
</Canvas>
|
|
226
212
|
|
|
227
213
|
## Image Size
|
|
228
214
|
|
|
@@ -232,26 +218,20 @@ prop to override the default width.
|
|
|
232
218
|
|
|
233
219
|
### Column Cards
|
|
234
220
|
|
|
235
|
-
<
|
|
221
|
+
<Canvas>
|
|
236
222
|
<Story name="Card Image Size">
|
|
237
|
-
<
|
|
238
|
-
style={{
|
|
239
|
-
display: "grid",
|
|
240
|
-
"grid-gap": "4rem",
|
|
241
|
-
"grid-template-columns": "repeat(1, 1fr)",
|
|
242
|
-
}}
|
|
243
|
-
>
|
|
223
|
+
<SimpleGrid columns={1}>
|
|
244
224
|
<Card
|
|
245
225
|
center
|
|
246
226
|
imageSrc="https://placeimg.com/400/200/animals"
|
|
247
227
|
imageAlt="Alt text"
|
|
248
|
-
imageAspectRatio={
|
|
249
|
-
imageSize={
|
|
228
|
+
imageAspectRatio={ImageRatios.Square}
|
|
229
|
+
imageSize={ImageSizes.Small}
|
|
250
230
|
>
|
|
251
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
231
|
+
<CardHeading level={HeadingLevels.Three} id="column-heading1">
|
|
252
232
|
Small Image
|
|
253
233
|
</CardHeading>
|
|
254
|
-
<CardHeading level={HeadingLevels.
|
|
234
|
+
<CardHeading level={HeadingLevels.Four} id="column-heading2">
|
|
255
235
|
Max-Width: 165px
|
|
256
236
|
</CardHeading>
|
|
257
237
|
<CardContent>
|
|
@@ -264,13 +244,13 @@ prop to override the default width.
|
|
|
264
244
|
center
|
|
265
245
|
imageSrc="https://placeimg.com/400/200/animals"
|
|
266
246
|
imageAlt="Alt text"
|
|
267
|
-
imageAspectRatio={
|
|
268
|
-
imageSize={
|
|
247
|
+
imageAspectRatio={ImageRatios.Square}
|
|
248
|
+
imageSize={ImageSizes.Medium}
|
|
269
249
|
>
|
|
270
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
250
|
+
<CardHeading level={HeadingLevels.Three} id="column2-heading1">
|
|
271
251
|
Medium Image
|
|
272
252
|
</CardHeading>
|
|
273
|
-
<CardHeading level={HeadingLevels.
|
|
253
|
+
<CardHeading level={HeadingLevels.Four} id="column2-heading2">
|
|
274
254
|
Max-Width: 225px
|
|
275
255
|
</CardHeading>
|
|
276
256
|
<CardContent>
|
|
@@ -278,17 +258,18 @@ prop to override the default width.
|
|
|
278
258
|
libero, a pharetra augue.
|
|
279
259
|
</CardContent>
|
|
280
260
|
</Card>
|
|
261
|
+
<HorizontalRule />
|
|
281
262
|
<Card
|
|
282
263
|
center
|
|
283
264
|
imageSrc="https://placeimg.com/410/210/animals"
|
|
284
265
|
imageAlt="Alt text"
|
|
285
|
-
imageAspectRatio={
|
|
286
|
-
imageSize={
|
|
266
|
+
imageAspectRatio={ImageRatios.Square}
|
|
267
|
+
imageSize={ImageSizes.Large}
|
|
287
268
|
>
|
|
288
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
269
|
+
<CardHeading level={HeadingLevels.Three} id="column3-heading1">
|
|
289
270
|
Large Image
|
|
290
271
|
</CardHeading>
|
|
291
|
-
<CardHeading level={HeadingLevels.
|
|
272
|
+
<CardHeading level={HeadingLevels.Four} id="column3-heading2">
|
|
292
273
|
Max-Width: 360px
|
|
293
274
|
</CardHeading>
|
|
294
275
|
<CardContent>
|
|
@@ -296,16 +277,17 @@ prop to override the default width.
|
|
|
296
277
|
libero, a pharetra augue.
|
|
297
278
|
</CardContent>
|
|
298
279
|
</Card>
|
|
280
|
+
<HorizontalRule />
|
|
299
281
|
<Card
|
|
300
282
|
center
|
|
301
283
|
imageSrc="https://placeimg.com/410/210/animals"
|
|
302
284
|
imageAlt="Alt text"
|
|
303
|
-
imageAspectRatio={
|
|
285
|
+
imageAspectRatio={ImageRatios.Square}
|
|
304
286
|
>
|
|
305
|
-
<CardHeading level={HeadingLevels.Three} id="
|
|
287
|
+
<CardHeading level={HeadingLevels.Three} id="column-4heading1">
|
|
306
288
|
Default Image
|
|
307
289
|
</CardHeading>
|
|
308
|
-
<CardHeading level={HeadingLevels.
|
|
290
|
+
<CardHeading level={HeadingLevels.Four} id="column-4heading2">
|
|
309
291
|
Width: 100%
|
|
310
292
|
</CardHeading>
|
|
311
293
|
<CardContent>
|
|
@@ -313,116 +295,106 @@ prop to override the default width.
|
|
|
313
295
|
libero, a pharetra augue.
|
|
314
296
|
</CardContent>
|
|
315
297
|
</Card>
|
|
316
|
-
</
|
|
298
|
+
</SimpleGrid>
|
|
317
299
|
</Story>
|
|
318
|
-
</
|
|
300
|
+
</Canvas>
|
|
319
301
|
|
|
320
302
|
### Row Cards
|
|
321
303
|
|
|
322
|
-
<
|
|
323
|
-
<
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
</
|
|
362
|
-
<
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
</CardContent>
|
|
405
|
-
</Card>
|
|
406
|
-
</div>
|
|
407
|
-
</Preview>
|
|
304
|
+
<Canvas>
|
|
305
|
+
<DSProvider>
|
|
306
|
+
<SimpleGrid columns={1}>
|
|
307
|
+
<Card
|
|
308
|
+
layout={CardLayouts.Row}
|
|
309
|
+
center
|
|
310
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
311
|
+
imageAlt="Alt text"
|
|
312
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
313
|
+
imageSize={ImageSizes.Small}
|
|
314
|
+
>
|
|
315
|
+
<CardHeading level={HeadingLevels.Three} id="row2-heading1">
|
|
316
|
+
Small Image
|
|
317
|
+
</CardHeading>
|
|
318
|
+
<CardHeading level={HeadingLevels.Four} id="row2-heading2">
|
|
319
|
+
Max-Width: 165px
|
|
320
|
+
</CardHeading>
|
|
321
|
+
<CardContent>
|
|
322
|
+
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
323
|
+
</CardContent>
|
|
324
|
+
</Card>
|
|
325
|
+
<Card
|
|
326
|
+
layout={CardLayouts.Row}
|
|
327
|
+
center
|
|
328
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
329
|
+
imageAlt="Alt text"
|
|
330
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
331
|
+
imageSize={ImageSizes.Medium}
|
|
332
|
+
>
|
|
333
|
+
<CardHeading level={HeadingLevels.Three} id="row3-heading2">
|
|
334
|
+
Medium Image
|
|
335
|
+
</CardHeading>
|
|
336
|
+
<CardHeading level={HeadingLevels.Four} id="row3-heading2">
|
|
337
|
+
Max-Width: 225px
|
|
338
|
+
</CardHeading>
|
|
339
|
+
<CardContent>
|
|
340
|
+
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
341
|
+
Sed posuere consectetur est at lobortis.
|
|
342
|
+
</CardContent>
|
|
343
|
+
</Card>
|
|
344
|
+
<Card
|
|
345
|
+
layout={CardLayouts.Row}
|
|
346
|
+
center
|
|
347
|
+
imageSrc="https://placeimg.com/400/250/animals"
|
|
348
|
+
imageAlt="Alt text"
|
|
349
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
350
|
+
imageSize={ImageSizes.Large}
|
|
351
|
+
>
|
|
352
|
+
<CardHeading level={HeadingLevels.Three} id="row4-heading1">
|
|
353
|
+
Large Image
|
|
354
|
+
</CardHeading>
|
|
355
|
+
<CardHeading level={HeadingLevels.Four} id="row4-heading2">
|
|
356
|
+
Max-Width: 360px
|
|
357
|
+
</CardHeading>
|
|
358
|
+
<CardContent>
|
|
359
|
+
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
360
|
+
Sed posuere consectetur est at lobortis. Cras justo odio, dapibus ac
|
|
361
|
+
facilisis in, egestas eget quam.
|
|
362
|
+
</CardContent>
|
|
363
|
+
</Card>
|
|
364
|
+
<Card
|
|
365
|
+
layout={CardLayouts.Row}
|
|
366
|
+
center
|
|
367
|
+
imageSrc="https://placeimg.com/450/250/animals"
|
|
368
|
+
imageAlt="Alt text"
|
|
369
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
370
|
+
>
|
|
371
|
+
<CardHeading level={HeadingLevels.Three} id="row5-heading2">
|
|
372
|
+
Default Image
|
|
373
|
+
</CardHeading>
|
|
374
|
+
<CardHeading level={HeadingLevels.Four} id="row5-heading2">
|
|
375
|
+
Max-Width: 225px
|
|
376
|
+
</CardHeading>
|
|
377
|
+
<CardContent>
|
|
378
|
+
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
379
|
+
Sed posuere consectetur est at lobortis. Cras justo odio, dapibus ac
|
|
380
|
+
facilisis in, egestas eget quam.
|
|
381
|
+
</CardContent>
|
|
382
|
+
</Card>
|
|
383
|
+
</SimpleGrid>
|
|
384
|
+
</DSProvider>
|
|
385
|
+
</Canvas>
|
|
408
386
|
|
|
409
387
|
## Cards in a Grid
|
|
410
388
|
|
|
411
|
-
<
|
|
389
|
+
<Canvas>
|
|
412
390
|
<Story name="Cards in a Grid">
|
|
413
|
-
<
|
|
414
|
-
style={{
|
|
415
|
-
display: "grid",
|
|
416
|
-
"grid-gap": "2rem",
|
|
417
|
-
"grid-template-columns": "repeat(3, 1fr)",
|
|
418
|
-
}}
|
|
419
|
-
>
|
|
391
|
+
<SimpleGrid columns={3}>
|
|
420
392
|
<Card
|
|
421
393
|
imageSrc="https://placeimg.com/400/200/animals"
|
|
422
394
|
imageAlt="Alt text"
|
|
423
|
-
imageAspectRatio={
|
|
395
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
424
396
|
>
|
|
425
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
397
|
+
<CardHeading level={HeadingLevels.Three} id="grid1-heading1">
|
|
426
398
|
Card Heading
|
|
427
399
|
</CardHeading>
|
|
428
400
|
<CardContent>
|
|
@@ -433,9 +405,9 @@ prop to override the default width.
|
|
|
433
405
|
<Card
|
|
434
406
|
imageSrc="https://placeimg.com/410/210/animals"
|
|
435
407
|
imageAlt="Alt text"
|
|
436
|
-
imageAspectRatio={
|
|
408
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
437
409
|
>
|
|
438
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
410
|
+
<CardHeading level={HeadingLevels.Three} id="grid2-heading1">
|
|
439
411
|
Card Heading
|
|
440
412
|
</CardHeading>
|
|
441
413
|
<CardContent>
|
|
@@ -446,9 +418,9 @@ prop to override the default width.
|
|
|
446
418
|
<Card
|
|
447
419
|
imageSrc="https://placeimg.com/420/220/animals"
|
|
448
420
|
imageAlt="Alt text"
|
|
449
|
-
imageAspectRatio={
|
|
421
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
450
422
|
>
|
|
451
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
423
|
+
<CardHeading level={HeadingLevels.Three} id="grid3-heading1">
|
|
452
424
|
Card Heading
|
|
453
425
|
</CardHeading>
|
|
454
426
|
<CardContent>
|
|
@@ -459,9 +431,9 @@ prop to override the default width.
|
|
|
459
431
|
<Card
|
|
460
432
|
imageSrc="https://placeimg.com/430/230/animals"
|
|
461
433
|
imageAlt="Alt text"
|
|
462
|
-
imageAspectRatio={
|
|
434
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
463
435
|
>
|
|
464
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
436
|
+
<CardHeading level={HeadingLevels.Three} id="grid4-heading1">
|
|
465
437
|
Card Heading
|
|
466
438
|
</CardHeading>
|
|
467
439
|
<CardContent>
|
|
@@ -472,9 +444,9 @@ prop to override the default width.
|
|
|
472
444
|
<Card
|
|
473
445
|
imageSrc="https://placeimg.com/440/240/animals"
|
|
474
446
|
imageAlt="Alt text"
|
|
475
|
-
imageAspectRatio={
|
|
447
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
476
448
|
>
|
|
477
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
449
|
+
<CardHeading level={HeadingLevels.Three} id="grid5-heading1">
|
|
478
450
|
Card Heading
|
|
479
451
|
</CardHeading>
|
|
480
452
|
<CardContent>
|
|
@@ -485,9 +457,9 @@ prop to override the default width.
|
|
|
485
457
|
<Card
|
|
486
458
|
imageSrc="https://placeimg.com/450/250/animals"
|
|
487
459
|
imageAlt="Alt text"
|
|
488
|
-
imageAspectRatio={
|
|
460
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
489
461
|
>
|
|
490
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
462
|
+
<CardHeading level={HeadingLevels.Three} id="grid6-heading1">
|
|
491
463
|
Card Heading
|
|
492
464
|
</CardHeading>
|
|
493
465
|
<CardContent>
|
|
@@ -495,29 +467,23 @@ prop to override the default width.
|
|
|
495
467
|
libero, a pharetra augue.
|
|
496
468
|
</CardContent>
|
|
497
469
|
</Card>
|
|
498
|
-
</
|
|
470
|
+
</SimpleGrid>
|
|
499
471
|
</Story>
|
|
500
|
-
</
|
|
472
|
+
</Canvas>
|
|
501
473
|
|
|
502
474
|
## Cards in a Stack
|
|
503
475
|
|
|
504
|
-
<
|
|
476
|
+
<Canvas>
|
|
505
477
|
<Story name="Cards in a Stack">
|
|
506
|
-
<
|
|
507
|
-
style={{
|
|
508
|
-
display: "grid",
|
|
509
|
-
"grid-gap": "2rem",
|
|
510
|
-
"grid-template-columns": "repeat(1, 1fr)",
|
|
511
|
-
}}
|
|
512
|
-
>
|
|
478
|
+
<SimpleGrid columns={1}>
|
|
513
479
|
<Card
|
|
514
480
|
layout={CardLayouts.Row}
|
|
515
481
|
center
|
|
516
482
|
imageSrc="https://placeimg.com/400/200/animals"
|
|
517
483
|
imageAlt="Alt text"
|
|
518
|
-
imageAspectRatio={
|
|
484
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
519
485
|
>
|
|
520
|
-
<CardHeading level={HeadingLevels.Four} id="heading1">
|
|
486
|
+
<CardHeading level={HeadingLevels.Four} id="stack1-heading1">
|
|
521
487
|
Card Heading
|
|
522
488
|
</CardHeading>
|
|
523
489
|
<CardContent>
|
|
@@ -531,9 +497,9 @@ prop to override the default width.
|
|
|
531
497
|
center
|
|
532
498
|
imageSrc="https://placeimg.com/410/210/animals"
|
|
533
499
|
imageAlt="Alt text"
|
|
534
|
-
imageAspectRatio={
|
|
500
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
535
501
|
>
|
|
536
|
-
<CardHeading level={HeadingLevels.Four} id="heading2">
|
|
502
|
+
<CardHeading level={HeadingLevels.Four} id="stack2-heading2">
|
|
537
503
|
Card Heading
|
|
538
504
|
</CardHeading>
|
|
539
505
|
<CardContent>
|
|
@@ -547,9 +513,9 @@ prop to override the default width.
|
|
|
547
513
|
center
|
|
548
514
|
imageSrc="https://placeimg.com/420/220/animals"
|
|
549
515
|
imageAlt="Alt text"
|
|
550
|
-
imageAspectRatio={
|
|
516
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
551
517
|
>
|
|
552
|
-
<CardHeading level={HeadingLevels.Four} id="heading3">
|
|
518
|
+
<CardHeading level={HeadingLevels.Four} id="stack3-heading3">
|
|
553
519
|
Card Heading
|
|
554
520
|
</CardHeading>
|
|
555
521
|
<CardContent>
|
|
@@ -558,27 +524,27 @@ prop to override the default width.
|
|
|
558
524
|
facilisis in, egestas eget quam.
|
|
559
525
|
</CardContent>
|
|
560
526
|
</Card>
|
|
561
|
-
</
|
|
527
|
+
</SimpleGrid>
|
|
562
528
|
</Story>
|
|
563
|
-
</
|
|
529
|
+
</Canvas>
|
|
564
530
|
|
|
565
531
|
## Custom Image Component
|
|
566
532
|
|
|
567
533
|
Instead of passing a path for the `imageSrc` prop, you can pass a custom image component in using the `imageComponent` prop.
|
|
568
534
|
|
|
569
|
-
<
|
|
535
|
+
<Canvas withToolbar>
|
|
570
536
|
<Story name="Custom Image Component">
|
|
571
537
|
<Card
|
|
572
538
|
imageAlt="Alt text"
|
|
573
|
-
imageAspectRatio={
|
|
539
|
+
imageAspectRatio={ImageRatios.SixteenByNine}
|
|
574
540
|
imageComponent={
|
|
575
541
|
<Image src="https://placeimg.com/400/400/animals" alt="Alt text" />
|
|
576
542
|
}
|
|
577
543
|
>
|
|
578
|
-
<CardHeading level={HeadingLevels.Two} id="heading1">
|
|
544
|
+
<CardHeading level={HeadingLevels.Two} id="img1-heading1">
|
|
579
545
|
Card Component with Custom Image Component
|
|
580
546
|
</CardHeading>
|
|
581
|
-
<CardHeading level={HeadingLevels.
|
|
547
|
+
<CardHeading level={HeadingLevels.Three} id="img2-heading2">
|
|
582
548
|
Secondary Heading
|
|
583
549
|
</CardHeading>
|
|
584
550
|
<CardContent>
|
|
@@ -589,7 +555,7 @@ Instead of passing a path for the `imageSrc` prop, you can pass a custom image c
|
|
|
589
555
|
consectetur est at lobortis.
|
|
590
556
|
</CardContent>
|
|
591
557
|
<CardActions>
|
|
592
|
-
<Link type={LinkTypes.Button} href="
|
|
558
|
+
<Link type={LinkTypes.Button} href="#">
|
|
593
559
|
Reserve
|
|
594
560
|
</Link>
|
|
595
561
|
<Link href="#url" type={LinkTypes.Forwards}>
|
|
@@ -598,22 +564,15 @@ Instead of passing a path for the `imageSrc` prop, you can pass a custom image c
|
|
|
598
564
|
</CardActions>
|
|
599
565
|
</Card>
|
|
600
566
|
</Story>
|
|
601
|
-
</
|
|
567
|
+
</Canvas>
|
|
602
568
|
|
|
603
569
|
## Cards Without Images
|
|
604
570
|
|
|
605
|
-
<
|
|
571
|
+
<Canvas>
|
|
606
572
|
<Story name="Cards Without Images">
|
|
607
|
-
<
|
|
608
|
-
style={{
|
|
609
|
-
display: "grid",
|
|
610
|
-
"grid-gap": "2rem",
|
|
611
|
-
"grid-template-columns": "repeat(3, 1fr)",
|
|
612
|
-
"margin-bottom": "2rem",
|
|
613
|
-
}}
|
|
614
|
-
>
|
|
573
|
+
<SimpleGrid columns={3}>
|
|
615
574
|
<Card border>
|
|
616
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
575
|
+
<CardHeading level={HeadingLevels.Three} id="no-img1-heading1">
|
|
617
576
|
Card Heading
|
|
618
577
|
</CardHeading>
|
|
619
578
|
<CardContent>
|
|
@@ -623,7 +582,7 @@ Instead of passing a path for the `imageSrc` prop, you can pass a custom image c
|
|
|
623
582
|
</CardContent>
|
|
624
583
|
</Card>
|
|
625
584
|
<Card border>
|
|
626
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
585
|
+
<CardHeading level={HeadingLevels.Three} id="no-img2-heading1">
|
|
627
586
|
Card Heading
|
|
628
587
|
</CardHeading>
|
|
629
588
|
<CardContent>
|
|
@@ -633,7 +592,7 @@ Instead of passing a path for the `imageSrc` prop, you can pass a custom image c
|
|
|
633
592
|
</CardContent>
|
|
634
593
|
</Card>
|
|
635
594
|
<Card border>
|
|
636
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
595
|
+
<CardHeading level={HeadingLevels.Three} id="no-img3-heading1">
|
|
637
596
|
Card Heading
|
|
638
597
|
</CardHeading>
|
|
639
598
|
<CardContent>
|
|
@@ -642,16 +601,11 @@ Instead of passing a path for the `imageSrc` prop, you can pass a custom image c
|
|
|
642
601
|
Praesent commodo cursus magna, vel scelerisque nisl.
|
|
643
602
|
</CardContent>
|
|
644
603
|
</Card>
|
|
645
|
-
</
|
|
646
|
-
<
|
|
647
|
-
|
|
648
|
-
display: "grid",
|
|
649
|
-
"grid-gap": "2rem",
|
|
650
|
-
"grid-template-columns": "repeat(1, 1fr)",
|
|
651
|
-
}}
|
|
652
|
-
>
|
|
604
|
+
</SimpleGrid>
|
|
605
|
+
<br />
|
|
606
|
+
<SimpleGrid columns={1}>
|
|
653
607
|
<Card layout={CardLayouts.Row} border>
|
|
654
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
608
|
+
<CardHeading level={HeadingLevels.Three} id="no-img4-heading1">
|
|
655
609
|
Card Heading
|
|
656
610
|
</CardHeading>
|
|
657
611
|
<CardContent>
|
|
@@ -664,7 +618,7 @@ Instead of passing a path for the `imageSrc` prop, you can pass a custom image c
|
|
|
664
618
|
</CardContent>
|
|
665
619
|
</Card>
|
|
666
620
|
<Card layout={CardLayouts.Row} border>
|
|
667
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
621
|
+
<CardHeading level={HeadingLevels.Three} id="no-img5-heading1">
|
|
668
622
|
Card Heading
|
|
669
623
|
</CardHeading>
|
|
670
624
|
<CardContent>
|
|
@@ -677,7 +631,7 @@ Instead of passing a path for the `imageSrc` prop, you can pass a custom image c
|
|
|
677
631
|
</CardContent>
|
|
678
632
|
</Card>
|
|
679
633
|
<Card layout={CardLayouts.Row} border>
|
|
680
|
-
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
634
|
+
<CardHeading level={HeadingLevels.Three} id="no-img6-heading1">
|
|
681
635
|
Card Heading
|
|
682
636
|
</CardHeading>
|
|
683
637
|
<CardContent>
|
|
@@ -689,6 +643,89 @@ Instead of passing a path for the `imageSrc` prop, you can pass a custom image c
|
|
|
689
643
|
eget metus.
|
|
690
644
|
</CardContent>
|
|
691
645
|
</Card>
|
|
692
|
-
</
|
|
646
|
+
</SimpleGrid>
|
|
693
647
|
</Story>
|
|
694
|
-
</
|
|
648
|
+
</Canvas>
|
|
649
|
+
|
|
650
|
+
## Card With Full-Click Functionality
|
|
651
|
+
|
|
652
|
+
To enable the full-click functionality in the `Card` component, pass a URL in
|
|
653
|
+
the `mainActionLink` prop. This will make the entire `Card` component clickable.
|
|
654
|
+
If the `Card` has action links or buttons, they can still be accessed by tabbing
|
|
655
|
+
through the `Card` and pressing `enter` or clicking like a regular link.
|
|
656
|
+
|
|
657
|
+
Internally, if multiple `CardHeading` components are passed, only the first one
|
|
658
|
+
will have the full-click link. This, however, does not affect the `Card` itself
|
|
659
|
+
from being having the full-click functionality.
|
|
660
|
+
|
|
661
|
+
<Canvas>
|
|
662
|
+
<Story name="Card With Full-Click Functionality">
|
|
663
|
+
<SimpleGrid columns={2}>
|
|
664
|
+
<Card
|
|
665
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
666
|
+
imageAlt="Alt text"
|
|
667
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
668
|
+
mainActionLink="http://nypl.org"
|
|
669
|
+
>
|
|
670
|
+
<CardHeading level={HeadingLevels.Three} id="fullclick1-heading1">
|
|
671
|
+
Go to NYPL home page.
|
|
672
|
+
</CardHeading>
|
|
673
|
+
<CardHeading level={HeadingLevels.Four} id="fullclick1-heading2">
|
|
674
|
+
Some other heading.
|
|
675
|
+
</CardHeading>
|
|
676
|
+
<CardContent>
|
|
677
|
+
This entire `Card` component is clickable, but the links below are
|
|
678
|
+
still accessible by tabbing through the `Card` and pressing `enter` or
|
|
679
|
+
clicking with a mouse.
|
|
680
|
+
</CardContent>
|
|
681
|
+
<CardActions>
|
|
682
|
+
<Link href="#" type={LinkTypes.Button}>
|
|
683
|
+
Button
|
|
684
|
+
</Link>
|
|
685
|
+
<Link href="#" type={LinkTypes.Forwards}>
|
|
686
|
+
Other link
|
|
687
|
+
</Link>
|
|
688
|
+
</CardActions>
|
|
689
|
+
</Card>
|
|
690
|
+
<Card
|
|
691
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
692
|
+
imageAlt="Alt text"
|
|
693
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
694
|
+
mainActionLink="http://nypl.org"
|
|
695
|
+
imageAtEnd
|
|
696
|
+
>
|
|
697
|
+
<CardHeading level={HeadingLevels.Three} id="fullclick2-heading1">
|
|
698
|
+
Go to NYPL home page.
|
|
699
|
+
</CardHeading>
|
|
700
|
+
<CardContent>
|
|
701
|
+
This `Card` component does not have any extra links.
|
|
702
|
+
</CardContent>
|
|
703
|
+
</Card>
|
|
704
|
+
</SimpleGrid>
|
|
705
|
+
</Story>
|
|
706
|
+
</Canvas>
|
|
707
|
+
|
|
708
|
+
## Accessibility
|
|
709
|
+
|
|
710
|
+
### Headings
|
|
711
|
+
|
|
712
|
+
In general, headings from `h1` through `h6` must be in sequential order in the
|
|
713
|
+
DOM tree. Rendering an `h4` following an `h2` will throw an error. Therefore,
|
|
714
|
+
when adding `CardHeading` components, make sure to add them in sequential order
|
|
715
|
+
with the `level` prop.
|
|
716
|
+
|
|
717
|
+
```tsx
|
|
718
|
+
<CardHeading level={HeadingLevels.Three} id="headingthree">
|
|
719
|
+
Heading level three
|
|
720
|
+
</CardHeading>
|
|
721
|
+
<CardHeading level={HeadingLevels.Four} id="headingfour">
|
|
722
|
+
Heading level four
|
|
723
|
+
</CardHeading>
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
### Full-Click Functionality
|
|
727
|
+
|
|
728
|
+
Passing in a URL in the `mainActionLink` prop will make the entire `Card`
|
|
729
|
+
clickable. Other links in the `CardActions` component can still be accessed by
|
|
730
|
+
tabbing through and pressing "enter" or by clicking as you normally would on a
|
|
731
|
+
link.
|