@nypl/design-system-react-components 0.25.8 → 0.25.11
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 +110 -1
- package/README.md +1 -1
- package/dist/components/Button/Button.d.ts +6 -6
- package/dist/components/Button/ButtonTypes.d.ts +0 -1
- package/dist/components/Card/Card.d.ts +6 -4
- package/dist/components/Checkbox/Checkbox.d.ts +3 -2
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +3 -2
- package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +8 -2
- package/dist/components/DatePicker/DatePicker.d.ts +4 -3
- package/dist/components/Fieldset/Fieldset.d.ts +1 -3
- package/dist/components/Form/Form.d.ts +15 -14
- package/dist/components/Form/FormTypes.d.ts +2 -2
- package/dist/components/Heading/Heading.d.ts +7 -3
- package/dist/components/Heading/HeadingTypes.d.ts +6 -6
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +5 -2
- package/dist/components/HorizontalRule/HorizontalRule.d.ts +3 -3
- package/dist/components/Icons/Icon.d.ts +4 -4
- package/dist/components/Icons/IconSvgs.d.ts +0 -21
- package/dist/components/Icons/IconTypes.d.ts +0 -23
- package/dist/components/Image/Image.d.ts +11 -3
- package/dist/components/List/List.d.ts +1 -1
- package/dist/components/Logo/Logo.d.ts +28 -0
- package/dist/components/Logo/LogoSvgs.d.ts +34 -0
- package/dist/components/Logo/LogoTypes.d.ts +46 -0
- package/dist/components/Modal/Modal.d.ts +0 -4
- package/dist/components/Notification/Notification.d.ts +4 -2
- package/dist/components/Placeholder/Placeholder.d.ts +3 -5
- package/dist/components/Radio/Radio.d.ts +6 -5
- package/dist/components/RadioGroup/RadioGroup.d.ts +6 -5
- package/dist/components/SearchBar/SearchBar.d.ts +15 -7
- package/dist/components/Select/Select.d.ts +7 -2
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +8 -4
- package/dist/components/Slider/Slider.d.ts +3 -2
- package/dist/components/StatusBadge/StatusBadge.d.ts +2 -1
- package/dist/components/StructuredContent/StructuredContent.d.ts +41 -0
- package/dist/components/StructuredContent/StructuredContentTypes.d.ts +5 -0
- package/dist/components/Table/Table.d.ts +29 -0
- package/dist/components/Template/Template.d.ts +30 -6
- package/dist/components/Text/Text.d.ts +2 -2
- package/dist/components/TextInput/TextInput.d.ts +4 -3
- package/dist/components/Toggle/Toggle.d.ts +3 -2
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +14 -5
- package/dist/design-system-react-components.cjs.development.js +6721 -5777
- 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 +6774 -5839
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +10 -8
- package/dist/resources.scss +0 -2
- package/dist/styles.css +2 -2
- package/dist/theme/components/breadcrumb.d.ts +1 -1
- package/dist/theme/components/button.d.ts +0 -12
- package/dist/theme/components/card.d.ts +14 -2
- package/dist/theme/components/customTable.d.ts +56 -0
- package/dist/theme/components/fieldset.d.ts +2 -2
- package/dist/theme/components/global.d.ts +1 -1
- package/dist/theme/components/heading.d.ts +4 -0
- package/dist/theme/components/label.d.ts +1 -1
- package/dist/theme/components/link.d.ts +14 -1
- package/dist/theme/components/list.d.ts +0 -2
- package/dist/theme/components/logo.d.ts +4 -0
- package/dist/theme/components/notification.d.ts +13 -4
- package/dist/theme/components/searchBar.d.ts +9 -11
- package/dist/theme/components/select.d.ts +1 -0
- package/dist/theme/components/structuredContent.d.ts +33 -0
- package/dist/theme/components/template.d.ts +10 -10
- package/dist/theme/components/textInput.d.ts +4 -0
- package/dist/theme/components/toggle.d.ts +8 -5
- package/dist/utils/utils.d.ts +10 -0
- package/package.json +40 -37
- package/src/__tests__/utils/utils.test.ts +23 -1
- package/src/components/Accordion/Accordion.stories.mdx +15 -13
- package/src/components/Accordion/Accordion.test.tsx +45 -1
- package/src/components/Accordion/Accordion.tsx +20 -8
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +243 -0
- package/src/components/Autosuggest/Autosuggest.stories.mdx +2 -1
- package/src/components/Autosuggest/Autosuggest.stories.tsx +24 -48
- package/src/components/Autosuggest/_Autosuggest.scss +2 -6
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +43 -13
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +15 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +9 -3
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +5 -5
- package/src/components/Button/Button.stories.mdx +93 -48
- package/src/components/Button/Button.test.tsx +0 -12
- package/src/components/Button/Button.tsx +7 -7
- package/src/components/Button/ButtonTypes.tsx +0 -1
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +0 -12
- package/src/components/Card/Card.stories.mdx +186 -71
- package/src/components/Card/Card.test.tsx +45 -22
- package/src/components/Card/Card.tsx +21 -6
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +9 -3
- package/src/components/Chakra/Box.stories.mdx +3 -3
- package/src/components/Chakra/Center.stories.mdx +5 -5
- package/src/components/Chakra/Flex.stories.mdx +113 -0
- package/src/components/Chakra/Grid.stories.mdx +3 -3
- package/src/components/Chakra/Stack.stories.mdx +2 -2
- package/src/components/Checkbox/Checkbox.stories.mdx +37 -15
- package/src/components/Checkbox/Checkbox.tsx +13 -8
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +48 -16
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +14 -10
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +6 -3
- package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +151 -0
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +36 -23
- package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +85 -0
- package/src/components/DatePicker/DatePicker.stories.mdx +63 -18
- package/src/components/DatePicker/DatePicker.test.tsx +6 -6
- package/src/components/DatePicker/DatePicker.tsx +17 -11
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +50 -24
- package/src/components/Fieldset/Fieldset.stories.mdx +20 -9
- package/src/components/Fieldset/Fieldset.tsx +2 -4
- package/src/components/Form/Form.stories.mdx +75 -49
- package/src/components/Form/Form.test.tsx +92 -3
- package/src/components/Form/Form.tsx +28 -23
- package/src/components/Form/FormTypes.tsx +2 -2
- package/src/components/Form/__snapshots__/Form.test.tsx.snap +0 -1
- package/src/components/Grid/SimpleGrid.stories.mdx +26 -26
- package/src/components/Heading/Heading.stories.mdx +59 -23
- package/src/components/Heading/Heading.test.tsx +82 -18
- package/src/components/Heading/Heading.tsx +31 -31
- package/src/components/Heading/HeadingTypes.tsx +6 -6
- package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +71 -0
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +55 -27
- package/src/components/HelperErrorText/HelperErrorText.test.tsx +42 -15
- package/src/components/HelperErrorText/HelperErrorText.tsx +24 -24
- package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +41 -4
- package/src/components/Hero/Hero.stories.mdx +72 -53
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +11 -9
- package/src/components/HorizontalRule/HorizontalRule.tsx +4 -6
- package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +4 -4
- package/src/components/Icons/Icon.stories.mdx +78 -77
- package/src/components/Icons/Icon.test.tsx +1 -1
- package/src/components/Icons/Icon.tsx +5 -6
- package/src/components/Icons/IconSvgs.tsx +0 -42
- package/src/components/Icons/IconTypes.tsx +0 -24
- package/src/components/Image/Image.stories.mdx +66 -18
- package/src/components/Image/Image.tsx +21 -10
- package/src/components/Label/Label.stories.mdx +20 -19
- package/src/components/Link/Link.stories.mdx +102 -51
- package/src/components/Link/Link.test.tsx +38 -8
- package/src/components/Link/Link.tsx +19 -12
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +60 -0
- package/src/components/List/List.stories.mdx +60 -29
- package/src/components/List/List.test.tsx +1 -1
- package/src/components/List/List.tsx +2 -2
- package/src/components/List/__snapshots__/List.test.tsx.snap +3 -1
- package/src/components/Logo/Logo.stories.mdx +222 -0
- package/src/components/Logo/Logo.test.tsx +98 -0
- package/src/components/Logo/Logo.tsx +97 -0
- package/src/components/Logo/LogoSvgs.tsx +66 -0
- package/src/components/Logo/LogoTypes.tsx +48 -0
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +71 -0
- package/src/components/Modal/Modal.stories.mdx +20 -5
- package/src/components/Modal/Modal.tsx +2 -8
- package/src/components/Notification/Notification.stories.mdx +128 -38
- package/src/components/Notification/Notification.test.tsx +49 -1
- package/src/components/Notification/Notification.tsx +25 -12
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +4 -0
- package/src/components/Pagination/Pagination.stories.mdx +18 -7
- package/src/components/Pagination/Pagination.tsx +3 -3
- package/src/components/Placeholder/Placeholder.tsx +7 -14
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +72 -43
- package/src/components/Radio/Radio.stories.mdx +39 -19
- package/src/components/Radio/Radio.tsx +13 -9
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +5 -5
- package/src/components/RadioGroup/RadioGroup.stories.mdx +50 -16
- package/src/components/RadioGroup/RadioGroup.test.tsx +13 -11
- package/src/components/RadioGroup/RadioGroup.tsx +97 -94
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +24 -21
- package/src/components/SearchBar/SearchBar.Test.tsx +160 -34
- package/src/components/SearchBar/SearchBar.stories.mdx +115 -33
- package/src/components/SearchBar/SearchBar.tsx +72 -51
- package/src/components/Select/Select.stories.mdx +48 -14
- package/src/components/Select/Select.test.tsx +89 -0
- package/src/components/Select/Select.tsx +27 -12
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +545 -0
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +50 -16
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +8 -4
- package/src/components/Slider/Slider.stories.mdx +72 -22
- package/src/components/Slider/Slider.tsx +15 -10
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +67 -30
- package/src/components/StatusBadge/StatusBadge.stories.mdx +33 -18
- package/src/components/StatusBadge/StatusBadge.tsx +2 -1
- package/src/components/StructuredContent/StructuredContent.stories.mdx +427 -0
- package/src/components/StructuredContent/StructuredContent.test.tsx +376 -0
- package/src/components/StructuredContent/StructuredContent.tsx +153 -0
- package/src/components/StructuredContent/StructuredContentTypes.tsx +5 -0
- package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +283 -0
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +32 -83
- package/src/components/StyleGuide/Breakpoints.stories.mdx +1 -11
- package/src/components/StyleGuide/Buttons.stories.mdx +3 -18
- package/src/components/StyleGuide/ColorCard.tsx +1 -2
- package/src/components/StyleGuide/Colors.stories.mdx +3 -11
- package/src/components/StyleGuide/DesignTokens.stories.mdx +3 -8
- package/src/components/StyleGuide/Forms.stories.mdx +2 -10
- package/src/components/StyleGuide/Iconography.stories.mdx +8 -34
- package/src/components/StyleGuide/Spacing.stories.mdx +3 -14
- package/src/components/StyleGuide/Typography.stories.mdx +64 -76
- package/src/components/Table/Table.stories.mdx +165 -0
- package/src/components/Table/Table.test.tsx +137 -0
- package/src/components/Table/Table.tsx +126 -0
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +1179 -0
- package/src/components/Tabs/Tabs.stories.mdx +20 -14
- package/src/components/Tabs/Tabs.test.tsx +21 -5
- package/src/components/Tabs/Tabs.tsx +35 -20
- package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +195 -0
- package/src/components/Template/Template.stories.mdx +132 -48
- package/src/components/Template/Template.test.tsx +128 -6
- package/src/components/Template/Template.tsx +93 -13
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +169 -0
- package/src/components/Text/Text.stories.mdx +33 -11
- package/src/components/Text/Text.tsx +2 -2
- package/src/components/TextInput/TextInput.stories.mdx +84 -17
- package/src/components/TextInput/TextInput.test.tsx +96 -0
- package/src/components/TextInput/TextInput.tsx +12 -8
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +240 -0
- package/src/components/Toggle/Toggle.stories.mdx +33 -9
- package/src/components/Toggle/Toggle.tsx +14 -9
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +4 -4
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +64 -14
- package/src/components/VideoPlayer/VideoPlayer.tsx +17 -7
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +12 -6
- package/src/docs/Chakra.stories.mdx +5 -8
- package/src/docs/Intro.stories.mdx +2 -2
- package/src/index.ts +13 -6
- package/src/styles/base/_03-base.scss +1 -1
- package/src/styles/base/_place-holder.scss +7 -7
- package/src/styles.scss +1 -5
- package/src/theme/components/breadcrumb.ts +4 -4
- package/src/theme/components/button.ts +5 -12
- package/src/theme/components/card.ts +5 -2
- package/src/theme/components/checkbox.ts +1 -1
- package/src/theme/components/customTable.ts +63 -0
- package/src/theme/components/datePicker.ts +1 -1
- package/src/theme/components/global.ts +7 -7
- package/src/theme/components/heading.ts +13 -11
- package/src/theme/components/helperErrorText.ts +1 -1
- package/src/theme/components/image.ts +1 -1
- package/src/theme/components/link.ts +17 -5
- package/src/theme/components/list.ts +3 -5
- package/src/theme/components/logo.ts +54 -0
- package/src/theme/components/notification.ts +19 -9
- package/src/theme/components/searchBar.ts +11 -13
- package/src/theme/components/select.ts +1 -0
- package/src/theme/components/statusBadge.ts +1 -1
- package/src/theme/components/structuredContent.ts +74 -0
- package/src/theme/components/template.ts +10 -10
- package/src/theme/components/text.ts +6 -6
- package/src/theme/components/textInput.ts +2 -0
- package/src/theme/components/toggle.ts +10 -6
- package/src/theme/components/videoPlayer.ts +0 -2
- package/src/theme/foundations/global.ts +2 -2
- package/src/theme/foundations/typography.ts +84 -12
- package/src/theme/index.ts +6 -0
- package/src/utils/componentCategories.ts +2 -1
- package/src/utils/utils.ts +17 -0
- package/dist/__tests__/utils/bem.test.d.ts +0 -1
- package/dist/components/CardEdition/CardEdition.d.ts +0 -21
- package/dist/components/CardEdition/CardEdition.stories.d.ts +0 -27
- package/dist/components/Input/Input.d.ts +0 -36
- package/dist/components/Input/Input.stories.d.ts +0 -29
- package/dist/components/Input/InputTypes.d.ts +0 -6
- package/dist/components/StyleGuide/UIDocCard.d.ts +0 -11
- package/dist/helpers/CSSVariablesHelper.d.ts +0 -3
- package/dist/helpers/getCSSVariable.d.ts +0 -1
- package/dist/interfaces.d.ts +0 -3
- package/dist/utils/bem.d.ts +0 -1
- package/src/__tests__/utils/bem.test.ts +0 -37
- package/src/components/CardEdition/CardEdition.stories.tsx +0 -122
- package/src/components/CardEdition/CardEdition.test.tsx +0 -395
- package/src/components/CardEdition/CardEdition.tsx +0 -60
- package/src/components/CardEdition/_CardEdition.scss +0 -137
- package/src/components/Input/Input.stories.tsx +0 -133
- package/src/components/Input/Input.test.tsx +0 -266
- package/src/components/Input/Input.tsx +0 -81
- package/src/components/Input/InputTypes.tsx +0 -8
- package/src/components/Input/_Input.scss +0 -78
- package/src/components/StyleGuide/UIDocCard.tsx +0 -36
- package/src/helpers/CSSVariablesHelper.tsx +0 -34
- package/src/helpers/getCSSVariable.tsx +0 -5
- package/src/interfaces.ts +0 -3
- package/src/utils/bem.ts +0 -44
|
@@ -1,28 +1,42 @@
|
|
|
1
|
+
import { action } from "@storybook/addon-actions";
|
|
1
2
|
import {
|
|
2
|
-
Meta,
|
|
3
|
-
Story,
|
|
4
|
-
Canvas,
|
|
5
3
|
ArgsTable,
|
|
4
|
+
Canvas,
|
|
6
5
|
Description,
|
|
7
|
-
|
|
6
|
+
Meta,
|
|
7
|
+
Story,
|
|
8
|
+
} from "@storybook/addon-docs";
|
|
8
9
|
import { withDesign } from "storybook-addon-designs";
|
|
9
|
-
import { action } from "@storybook/addon-actions";
|
|
10
10
|
|
|
11
11
|
import Button from "../Button/Button";
|
|
12
12
|
import { ButtonTypes } from "../Button/ButtonTypes";
|
|
13
13
|
import Card, { CardHeading, CardContent, CardActions } from "./Card";
|
|
14
14
|
import { CardLayouts } from "./CardTypes";
|
|
15
|
-
import Link from "../Link/Link";
|
|
16
15
|
import Heading from "../Heading/Heading";
|
|
17
|
-
import HorizontalRule from "../HorizontalRule/HorizontalRule";
|
|
18
|
-
import { LinkTypes } from "../Link/LinkTypes";
|
|
19
16
|
import { HeadingDisplaySizes, HeadingLevels } from "../Heading/HeadingTypes";
|
|
17
|
+
import HorizontalRule from "../HorizontalRule/HorizontalRule";
|
|
20
18
|
import Icon from "../Icons/Icon";
|
|
21
19
|
import Image from "../Image/Image";
|
|
22
20
|
import { ImageRatios, ImageSizes } from "../Image/ImageTypes";
|
|
21
|
+
import Link from "../Link/Link";
|
|
22
|
+
import { LinkTypes } from "../Link/LinkTypes";
|
|
23
23
|
import SimpleGrid from "../Grid/SimpleGrid";
|
|
24
24
|
import { getCategory } from "../../utils/componentCategories";
|
|
25
25
|
import DSProvider from "../../theme/provider";
|
|
26
|
+
import { getStorybookEnumValues } from "../../utils/utils";
|
|
27
|
+
|
|
28
|
+
export const imageRatiosEnumValues = getStorybookEnumValues(
|
|
29
|
+
ImageRatios,
|
|
30
|
+
"ImageRatios"
|
|
31
|
+
);
|
|
32
|
+
export const imageSizesEnumValues = getStorybookEnumValues(
|
|
33
|
+
ImageSizes,
|
|
34
|
+
"ImageSizes"
|
|
35
|
+
);
|
|
36
|
+
export const cardLayoutsEnumValues = getStorybookEnumValues(
|
|
37
|
+
CardLayouts,
|
|
38
|
+
"CardLayouts"
|
|
39
|
+
);
|
|
26
40
|
|
|
27
41
|
<Meta
|
|
28
42
|
title={getCategory("Card")}
|
|
@@ -33,13 +47,44 @@ import DSProvider from "../../theme/provider";
|
|
|
33
47
|
type: "figma",
|
|
34
48
|
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=36835%3A25747",
|
|
35
49
|
},
|
|
50
|
+
jest: ["Card.test.tsx"],
|
|
36
51
|
}}
|
|
37
52
|
argTypes={{
|
|
38
|
-
className: { table: { disable: true } },
|
|
39
|
-
id: { table: { disable: true } },
|
|
40
|
-
imageComponent: { table: { disable: true } },
|
|
41
53
|
backgroundColor: { control: { type: "color" } },
|
|
54
|
+
border: {
|
|
55
|
+
table: { defaultValue: { summary: false } },
|
|
56
|
+
},
|
|
57
|
+
center: {
|
|
58
|
+
table: { defaultValue: { summary: false } },
|
|
59
|
+
},
|
|
60
|
+
className: { control: false },
|
|
42
61
|
foregroundColor: { control: { type: "color" } },
|
|
62
|
+
id: { control: false },
|
|
63
|
+
imageAlt: {
|
|
64
|
+
table: { defaultValue: { summary: "" } },
|
|
65
|
+
},
|
|
66
|
+
imageAspectRatio: {
|
|
67
|
+
control: { type: "select" },
|
|
68
|
+
table: { defaultValue: { summary: "ImageRatios.Square" } },
|
|
69
|
+
options: imageRatiosEnumValues.options,
|
|
70
|
+
},
|
|
71
|
+
imageAtEnd: {
|
|
72
|
+
table: { defaultValue: { summary: false } },
|
|
73
|
+
},
|
|
74
|
+
imageComponent: { control: false },
|
|
75
|
+
imageSize: {
|
|
76
|
+
control: { type: "select" },
|
|
77
|
+
table: { defaultValue: { summary: "ImageSizes.Default" } },
|
|
78
|
+
options: imageSizesEnumValues.options,
|
|
79
|
+
},
|
|
80
|
+
imageSrc: {
|
|
81
|
+
table: { defaultValue: { summary: "" } },
|
|
82
|
+
},
|
|
83
|
+
layout: {
|
|
84
|
+
control: { type: "radio" },
|
|
85
|
+
table: { defaultValue: { summary: "CardLayouts.Column" } },
|
|
86
|
+
options: cardLayoutsEnumValues.options,
|
|
87
|
+
},
|
|
43
88
|
}}
|
|
44
89
|
/>
|
|
45
90
|
|
|
@@ -48,41 +93,61 @@ import DSProvider from "../../theme/provider";
|
|
|
48
93
|
| Component Version | DS Version |
|
|
49
94
|
| ----------------- | ---------- |
|
|
50
95
|
| Added | `0.24.0` |
|
|
51
|
-
| Latest | `0.25.
|
|
96
|
+
| Latest | `0.25.10` |
|
|
52
97
|
|
|
53
98
|
<Description of={Card} />
|
|
54
99
|
|
|
55
|
-
The `Card` component is viewed as a contained, stand-alone element. It is highly
|
|
100
|
+
The `Card` component is viewed as a contained, stand-alone element. It is highly
|
|
101
|
+
configurable and composable. It can be shown with or without an image and the
|
|
102
|
+
content area is composed using Card-specific child components: `CardHeading`,
|
|
103
|
+
`CardActions` and `CardContent`. These child components can be arranged in any
|
|
104
|
+
order and each child component may be used multiple times within the content
|
|
105
|
+
area. Although a `Card` is a self-contained unit, `Card` components are often
|
|
106
|
+
grouped together and displayed in some type of grid layout.
|
|
56
107
|
|
|
57
108
|
#### CardHeading
|
|
58
109
|
|
|
59
|
-
The `CardHeading` component mirrors the standard DS `Heading` component and
|
|
110
|
+
The `CardHeading` component mirrors the standard DS `Heading` component and
|
|
111
|
+
accepts the [same props](https://nypl.github.io/nypl-design-system/storybook-static/?path=/story/components-typography-styles-heading--heading-with-controls).
|
|
60
112
|
|
|
61
113
|
#### CardActions
|
|
62
114
|
|
|
63
|
-
The `CardActions` component is used to display "call to action" (CTA) buttons
|
|
115
|
+
The `CardActions` component is used to display "call to action" (CTA) buttons
|
|
116
|
+
and links for the card. The DS `Button` and `Link` components should be passed
|
|
117
|
+
as children into the `CardActions` component.
|
|
64
118
|
|
|
65
119
|
#### CardContent
|
|
66
120
|
|
|
67
|
-
The `CardContent` component should be used to display all content other than
|
|
121
|
+
The `CardContent` component should be used to display all content other than
|
|
122
|
+
headings and CTAs.
|
|
68
123
|
|
|
69
124
|
<Canvas withToolbar>
|
|
70
125
|
<Story
|
|
71
|
-
name="Card
|
|
126
|
+
name="Card with Controls"
|
|
72
127
|
args={{
|
|
73
|
-
|
|
74
|
-
layout: CardLayouts.Row,
|
|
75
|
-
imageSrc: "https://placeimg.com/400/300/animals",
|
|
76
|
-
imageAspectRatio: ImageRatios.ThreeByFour,
|
|
77
|
-
imageSize: ImageSizes.Default,
|
|
78
|
-
imageAlt: "Alt text",
|
|
79
|
-
imageAtEnd: false,
|
|
128
|
+
backgroundColor: undefined,
|
|
80
129
|
border: false,
|
|
81
130
|
center: false,
|
|
131
|
+
className: undefined,
|
|
132
|
+
foregroundColor: undefined,
|
|
133
|
+
id: "card-id",
|
|
134
|
+
imageAlt: "Alt text",
|
|
135
|
+
imageAspectRatio: "ImageRatios.Square",
|
|
136
|
+
imageAtEnd: false,
|
|
137
|
+
imageComponent: undefined,
|
|
138
|
+
imageSize: "ImageSizes.Default",
|
|
139
|
+
imageSrc: "https://placeimg.com/400/300/animals",
|
|
140
|
+
layout: "CardLayouts.Row",
|
|
141
|
+
mainActionLink: undefined,
|
|
82
142
|
}}
|
|
83
143
|
>
|
|
84
144
|
{(args) => (
|
|
85
|
-
<Card
|
|
145
|
+
<Card
|
|
146
|
+
{...args}
|
|
147
|
+
imageAspectRatio={imageRatiosEnumValues.getValue(args.imageAspectRatio)}
|
|
148
|
+
imageSize={imageSizesEnumValues.getValue(args.imageSize)}
|
|
149
|
+
layout={cardLayoutsEnumValues.getValue(args.layout)}
|
|
150
|
+
>
|
|
86
151
|
<CardHeading level={HeadingLevels.Two} id="main-heading1">
|
|
87
152
|
Optional Header
|
|
88
153
|
</CardHeading>
|
|
@@ -113,23 +178,23 @@ The `CardContent` component should be used to display all content other than hea
|
|
|
113
178
|
</Button>
|
|
114
179
|
</CardActions>
|
|
115
180
|
<CardActions>
|
|
116
|
-
<Link href="
|
|
117
|
-
<Link href="
|
|
118
|
-
<Link href="javascript:void(0);">#hash3</Link>
|
|
181
|
+
<Link href="#">#hash1</Link>,<Link href="#">#hash2</Link>,
|
|
182
|
+
<Link href="#">#hash3</Link>
|
|
119
183
|
</CardActions>
|
|
120
184
|
</Card>
|
|
121
185
|
)}
|
|
122
186
|
</Story>
|
|
123
187
|
</Canvas>
|
|
124
188
|
|
|
125
|
-
<ArgsTable story="Card
|
|
189
|
+
<ArgsTable story="Card with Controls" />
|
|
126
190
|
|
|
127
191
|
## Image Position
|
|
128
192
|
|
|
129
193
|
By default, the image is always the first element within a `Card`. This means
|
|
130
194
|
the image is at the top of a `Card` with a column layout and on the left side of
|
|
131
|
-
a `Card` with a row layout. However, you can use the `imageAtEnd` prop
|
|
132
|
-
the default placement and move the image to the last element within
|
|
195
|
+
a `Card` with a row layout. However, you can use the `imageAtEnd` boolean prop
|
|
196
|
+
to override the default placement and move the image to the last element within
|
|
197
|
+
a `Card`.
|
|
133
198
|
|
|
134
199
|
### Column Cards
|
|
135
200
|
|
|
@@ -137,9 +202,9 @@ the default placement and move the image to the last element within a `Card`.
|
|
|
137
202
|
<Story name="Card Image Position">
|
|
138
203
|
<SimpleGrid columns={2}>
|
|
139
204
|
<Card
|
|
140
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
141
205
|
imageAlt="Alt text"
|
|
142
206
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
207
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
143
208
|
>
|
|
144
209
|
<CardHeading level={HeadingLevels.Three} id="props-heading1">
|
|
145
210
|
Image on Top (default)
|
|
@@ -150,10 +215,10 @@ the default placement and move the image to the last element within a `Card`.
|
|
|
150
215
|
</CardContent>
|
|
151
216
|
</Card>
|
|
152
217
|
<Card
|
|
153
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
154
218
|
imageAlt="Alt text"
|
|
155
219
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
156
220
|
imageAtEnd
|
|
221
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
157
222
|
>
|
|
158
223
|
<CardHeading level={HeadingLevels.Three} id="props-heading2">
|
|
159
224
|
Image on Bottom
|
|
@@ -173,11 +238,11 @@ the default placement and move the image to the last element within a `Card`.
|
|
|
173
238
|
<DSProvider>
|
|
174
239
|
<SimpleGrid columns={1}>
|
|
175
240
|
<Card
|
|
176
|
-
layout={CardLayouts.Row}
|
|
177
241
|
center
|
|
178
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
179
242
|
imageAlt="Alt text"
|
|
180
243
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
244
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
245
|
+
layout={CardLayouts.Row}
|
|
181
246
|
>
|
|
182
247
|
<CardHeading level={HeadingLevels.Four} id="row-heading1">
|
|
183
248
|
Image on Left (default)
|
|
@@ -189,12 +254,12 @@ the default placement and move the image to the last element within a `Card`.
|
|
|
189
254
|
</CardContent>
|
|
190
255
|
</Card>
|
|
191
256
|
<Card
|
|
192
|
-
layout={CardLayouts.Row}
|
|
193
257
|
center
|
|
194
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
195
258
|
imageAlt="Alt text"
|
|
196
259
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
197
260
|
imageAtEnd
|
|
261
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
262
|
+
layout={CardLayouts.Row}
|
|
198
263
|
>
|
|
199
264
|
<CardHeading level={HeadingLevels.Four} id="row-heading2">
|
|
200
265
|
Image on Right
|
|
@@ -222,10 +287,10 @@ prop to override the default width.
|
|
|
222
287
|
<SimpleGrid columns={1}>
|
|
223
288
|
<Card
|
|
224
289
|
center
|
|
225
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
226
290
|
imageAlt="Alt text"
|
|
227
291
|
imageAspectRatio={ImageRatios.Square}
|
|
228
292
|
imageSize={ImageSizes.ExtraExtraSmall}
|
|
293
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
229
294
|
>
|
|
230
295
|
<CardHeading level={HeadingLevels.Three} id="column-heading1">
|
|
231
296
|
Extra Extra Small Image
|
|
@@ -241,10 +306,10 @@ prop to override the default width.
|
|
|
241
306
|
<HorizontalRule />
|
|
242
307
|
<Card
|
|
243
308
|
center
|
|
244
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
245
309
|
imageAlt="Alt text"
|
|
246
310
|
imageAspectRatio={ImageRatios.Square}
|
|
247
311
|
imageSize={ImageSizes.ExtraSmall}
|
|
312
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
248
313
|
>
|
|
249
314
|
<CardHeading level={HeadingLevels.Three} id="column-heading1">
|
|
250
315
|
Extra Small Image
|
|
@@ -260,10 +325,10 @@ prop to override the default width.
|
|
|
260
325
|
<HorizontalRule />
|
|
261
326
|
<Card
|
|
262
327
|
center
|
|
263
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
264
328
|
imageAlt="Alt text"
|
|
265
329
|
imageAspectRatio={ImageRatios.Square}
|
|
266
330
|
imageSize={ImageSizes.Small}
|
|
331
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
267
332
|
>
|
|
268
333
|
<CardHeading level={HeadingLevels.Three} id="column-heading1">
|
|
269
334
|
Small Image
|
|
@@ -279,10 +344,10 @@ prop to override the default width.
|
|
|
279
344
|
<HorizontalRule />
|
|
280
345
|
<Card
|
|
281
346
|
center
|
|
282
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
283
347
|
imageAlt="Alt text"
|
|
284
348
|
imageAspectRatio={ImageRatios.Square}
|
|
285
349
|
imageSize={ImageSizes.Medium}
|
|
350
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
286
351
|
>
|
|
287
352
|
<CardHeading level={HeadingLevels.Three} id="column2-heading1">
|
|
288
353
|
Medium Image
|
|
@@ -298,10 +363,10 @@ prop to override the default width.
|
|
|
298
363
|
<HorizontalRule />
|
|
299
364
|
<Card
|
|
300
365
|
center
|
|
301
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
302
366
|
imageAlt="Alt text"
|
|
303
367
|
imageAspectRatio={ImageRatios.Square}
|
|
304
368
|
imageSize={ImageSizes.Large}
|
|
369
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
305
370
|
>
|
|
306
371
|
<CardHeading level={HeadingLevels.Three} id="column3-heading1">
|
|
307
372
|
Large Image
|
|
@@ -317,9 +382,9 @@ prop to override the default width.
|
|
|
317
382
|
<HorizontalRule />
|
|
318
383
|
<Card
|
|
319
384
|
center
|
|
320
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
321
385
|
imageAlt="Alt text"
|
|
322
386
|
imageAspectRatio={ImageRatios.Square}
|
|
387
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
323
388
|
>
|
|
324
389
|
<CardHeading level={HeadingLevels.Three} id="column-4heading1">
|
|
325
390
|
Default Image
|
|
@@ -342,11 +407,12 @@ prop to override the default width.
|
|
|
342
407
|
<DSProvider>
|
|
343
408
|
<SimpleGrid columns={1}>
|
|
344
409
|
<Card
|
|
345
|
-
|
|
346
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
410
|
+
center
|
|
347
411
|
imageAlt="Alt text"
|
|
348
412
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
349
413
|
imageSize={ImageSizes.ExtraExtraSmall}
|
|
414
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
415
|
+
layout={CardLayouts.Row}
|
|
350
416
|
>
|
|
351
417
|
<CardHeading level={HeadingLevels.Three} id="row2-heading1">
|
|
352
418
|
Extra Extra Small Image
|
|
@@ -359,11 +425,12 @@ prop to override the default width.
|
|
|
359
425
|
</CardContent>
|
|
360
426
|
</Card>
|
|
361
427
|
<Card
|
|
362
|
-
|
|
363
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
428
|
+
center
|
|
364
429
|
imageAlt="Alt text"
|
|
365
430
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
366
431
|
imageSize={ImageSizes.ExtraSmall}
|
|
432
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
433
|
+
layout={CardLayouts.Row}
|
|
367
434
|
>
|
|
368
435
|
<CardHeading level={HeadingLevels.Three} id="row2-heading1">
|
|
369
436
|
Extra Small Image
|
|
@@ -376,11 +443,12 @@ prop to override the default width.
|
|
|
376
443
|
</CardContent>
|
|
377
444
|
</Card>
|
|
378
445
|
<Card
|
|
379
|
-
|
|
380
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
446
|
+
center
|
|
381
447
|
imageAlt="Alt text"
|
|
382
448
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
383
449
|
imageSize={ImageSizes.Small}
|
|
450
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
451
|
+
layout={CardLayouts.Row}
|
|
384
452
|
>
|
|
385
453
|
<CardHeading level={HeadingLevels.Three} id="row2-heading1">
|
|
386
454
|
Small Image
|
|
@@ -393,11 +461,12 @@ prop to override the default width.
|
|
|
393
461
|
</CardContent>
|
|
394
462
|
</Card>
|
|
395
463
|
<Card
|
|
396
|
-
|
|
397
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
464
|
+
center
|
|
398
465
|
imageAlt="Alt text"
|
|
399
466
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
400
467
|
imageSize={ImageSizes.Medium}
|
|
468
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
469
|
+
layout={CardLayouts.Row}
|
|
401
470
|
>
|
|
402
471
|
<CardHeading level={HeadingLevels.Three} id="row3-heading2">
|
|
403
472
|
Medium Image
|
|
@@ -411,11 +480,12 @@ prop to override the default width.
|
|
|
411
480
|
</CardContent>
|
|
412
481
|
</Card>
|
|
413
482
|
<Card
|
|
414
|
-
|
|
415
|
-
imageSrc="https://placeimg.com/400/250/animals"
|
|
483
|
+
center
|
|
416
484
|
imageAlt="Alt text"
|
|
417
485
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
418
486
|
imageSize={ImageSizes.Large}
|
|
487
|
+
imageSrc="https://placeimg.com/400/250/animals"
|
|
488
|
+
layout={CardLayouts.Row}
|
|
419
489
|
>
|
|
420
490
|
<CardHeading level={HeadingLevels.Three} id="row4-heading1">
|
|
421
491
|
Large Image
|
|
@@ -430,10 +500,11 @@ prop to override the default width.
|
|
|
430
500
|
</CardContent>
|
|
431
501
|
</Card>
|
|
432
502
|
<Card
|
|
433
|
-
|
|
434
|
-
imageSrc="https://placeimg.com/450/250/animals"
|
|
503
|
+
center
|
|
435
504
|
imageAlt="Alt text"
|
|
436
505
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
506
|
+
imageSrc="https://placeimg.com/450/250/animals"
|
|
507
|
+
layout={CardLayouts.Row}
|
|
437
508
|
>
|
|
438
509
|
<CardHeading level={HeadingLevels.Three} id="row5-heading2">
|
|
439
510
|
Default Image
|
|
@@ -457,9 +528,9 @@ prop to override the default width.
|
|
|
457
528
|
<Story name="Cards in a Grid">
|
|
458
529
|
<SimpleGrid columns={3}>
|
|
459
530
|
<Card
|
|
460
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
461
531
|
imageAlt="Alt text"
|
|
462
532
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
533
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
463
534
|
>
|
|
464
535
|
<CardHeading level={HeadingLevels.Three} id="grid1-heading1">
|
|
465
536
|
Card Heading
|
|
@@ -470,9 +541,9 @@ prop to override the default width.
|
|
|
470
541
|
</CardContent>
|
|
471
542
|
</Card>
|
|
472
543
|
<Card
|
|
473
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
474
544
|
imageAlt="Alt text"
|
|
475
545
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
546
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
476
547
|
>
|
|
477
548
|
<CardHeading level={HeadingLevels.Three} id="grid2-heading1">
|
|
478
549
|
Card Heading
|
|
@@ -483,9 +554,9 @@ prop to override the default width.
|
|
|
483
554
|
</CardContent>
|
|
484
555
|
</Card>
|
|
485
556
|
<Card
|
|
486
|
-
imageSrc="https://placeimg.com/420/220/animals"
|
|
487
557
|
imageAlt="Alt text"
|
|
488
558
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
559
|
+
imageSrc="https://placeimg.com/420/220/animals"
|
|
489
560
|
>
|
|
490
561
|
<CardHeading level={HeadingLevels.Three} id="grid3-heading1">
|
|
491
562
|
Card Heading
|
|
@@ -496,9 +567,9 @@ prop to override the default width.
|
|
|
496
567
|
</CardContent>
|
|
497
568
|
</Card>
|
|
498
569
|
<Card
|
|
499
|
-
imageSrc="https://placeimg.com/430/230/animals"
|
|
500
570
|
imageAlt="Alt text"
|
|
501
571
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
572
|
+
imageSrc="https://placeimg.com/430/230/animals"
|
|
502
573
|
>
|
|
503
574
|
<CardHeading level={HeadingLevels.Three} id="grid4-heading1">
|
|
504
575
|
Card Heading
|
|
@@ -509,9 +580,9 @@ prop to override the default width.
|
|
|
509
580
|
</CardContent>
|
|
510
581
|
</Card>
|
|
511
582
|
<Card
|
|
512
|
-
imageSrc="https://placeimg.com/440/240/animals"
|
|
513
583
|
imageAlt="Alt text"
|
|
514
584
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
585
|
+
imageSrc="https://placeimg.com/440/240/animals"
|
|
515
586
|
>
|
|
516
587
|
<CardHeading level={HeadingLevels.Three} id="grid5-heading1">
|
|
517
588
|
Card Heading
|
|
@@ -522,9 +593,9 @@ prop to override the default width.
|
|
|
522
593
|
</CardContent>
|
|
523
594
|
</Card>
|
|
524
595
|
<Card
|
|
525
|
-
imageSrc="https://placeimg.com/450/250/animals"
|
|
526
596
|
imageAlt="Alt text"
|
|
527
597
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
598
|
+
imageSrc="https://placeimg.com/450/250/animals"
|
|
528
599
|
>
|
|
529
600
|
<CardHeading level={HeadingLevels.Three} id="grid6-heading1">
|
|
530
601
|
Card Heading
|
|
@@ -544,11 +615,11 @@ prop to override the default width.
|
|
|
544
615
|
<Story name="Cards in a Stack">
|
|
545
616
|
<SimpleGrid columns={1}>
|
|
546
617
|
<Card
|
|
547
|
-
layout={CardLayouts.Row}
|
|
548
618
|
center
|
|
549
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
550
619
|
imageAlt="Alt text"
|
|
551
620
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
621
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
622
|
+
layout={CardLayouts.Row}
|
|
552
623
|
>
|
|
553
624
|
<CardHeading level={HeadingLevels.Four} id="stack1-heading1">
|
|
554
625
|
Card Heading
|
|
@@ -560,11 +631,11 @@ prop to override the default width.
|
|
|
560
631
|
</CardContent>
|
|
561
632
|
</Card>
|
|
562
633
|
<Card
|
|
563
|
-
layout={CardLayouts.Row}
|
|
564
634
|
center
|
|
565
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
566
635
|
imageAlt="Alt text"
|
|
567
636
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
637
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
638
|
+
layout={CardLayouts.Row}
|
|
568
639
|
>
|
|
569
640
|
<CardHeading level={HeadingLevels.Four} id="stack2-heading2">
|
|
570
641
|
Card Heading
|
|
@@ -576,11 +647,11 @@ prop to override the default width.
|
|
|
576
647
|
</CardContent>
|
|
577
648
|
</Card>
|
|
578
649
|
<Card
|
|
579
|
-
layout={CardLayouts.Row}
|
|
580
650
|
center
|
|
581
|
-
imageSrc="https://placeimg.com/420/220/animals"
|
|
582
651
|
imageAlt="Alt text"
|
|
583
652
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
653
|
+
imageSrc="https://placeimg.com/420/220/animals"
|
|
654
|
+
layout={CardLayouts.Row}
|
|
584
655
|
>
|
|
585
656
|
<CardHeading level={HeadingLevels.Four} id="stack3-heading3">
|
|
586
657
|
Card Heading
|
|
@@ -597,7 +668,8 @@ prop to override the default width.
|
|
|
597
668
|
|
|
598
669
|
## Custom Image Component
|
|
599
670
|
|
|
600
|
-
Instead of passing a path for the `imageSrc` prop, you can pass a custom image
|
|
671
|
+
Instead of passing a path for the `imageSrc` prop, you can pass a custom image
|
|
672
|
+
component in using the `imageComponent` prop.
|
|
601
673
|
|
|
602
674
|
<Canvas withToolbar>
|
|
603
675
|
<Story name="Custom Image Component">
|
|
@@ -714,6 +786,49 @@ Instead of passing a path for the `imageSrc` prop, you can pass a custom image c
|
|
|
714
786
|
</Story>
|
|
715
787
|
</Canvas>
|
|
716
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
|
+
|
|
717
832
|
## Card With Full-Click Functionality
|
|
718
833
|
|
|
719
834
|
To enable the full-click functionality in the `Card` component, pass a URL in
|
|
@@ -729,9 +844,9 @@ from being having the full-click functionality.
|
|
|
729
844
|
<Story name="Card With Full-Click Functionality">
|
|
730
845
|
<SimpleGrid columns={2}>
|
|
731
846
|
<Card
|
|
732
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
733
847
|
imageAlt="Alt text"
|
|
734
848
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
849
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
735
850
|
mainActionLink="http://nypl.org"
|
|
736
851
|
>
|
|
737
852
|
<CardHeading level={HeadingLevels.Three} id="fullclick1-heading1">
|
|
@@ -755,11 +870,11 @@ from being having the full-click functionality.
|
|
|
755
870
|
</CardActions>
|
|
756
871
|
</Card>
|
|
757
872
|
<Card
|
|
758
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
759
873
|
imageAlt="Alt text"
|
|
760
874
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
761
|
-
mainActionLink="http://nypl.org"
|
|
762
875
|
imageAtEnd
|
|
876
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
877
|
+
mainActionLink="http://nypl.org"
|
|
763
878
|
>
|
|
764
879
|
<CardHeading level={HeadingLevels.Three} id="fullclick2-heading1">
|
|
765
880
|
Go to NYPL home page.
|