@nypl/design-system-react-components 0.25.5 → 0.25.9
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 +91 -1
- package/README.md +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -0
- 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 +3 -2
- package/dist/components/Form/Form.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 +2 -2
- package/dist/components/Icons/Icon.d.ts +4 -4
- package/dist/components/Icons/IconSvgs.d.ts +1 -21
- package/dist/components/Icons/IconTypes.d.ts +1 -23
- package/dist/components/Image/Image.d.ts +11 -3
- package/dist/components/Image/ImageTypes.d.ts +3 -1
- package/dist/components/Link/LinkTypes.d.ts +1 -0
- package/dist/components/Logo/Logo.d.ts +28 -0
- package/dist/components/Logo/LogoSvgs.d.ts +18 -0
- package/dist/components/Logo/LogoTypes.d.ts +30 -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 +3 -2
- package/dist/components/SearchBar/SearchBar.d.ts +10 -2
- package/dist/components/Select/Select.d.ts +5 -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 +23 -0
- package/dist/components/Template/Template.d.ts +8 -3
- 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 +48 -0
- package/dist/components/Toggle/ToggleSizes.d.ts +4 -0
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +17 -6
- package/dist/design-system-react-components.cjs.development.js +5989 -5490
- 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 +6057 -5551
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +11 -4
- package/dist/styles.css +2 -2
- package/dist/theme/components/breadcrumb.d.ts +9 -0
- 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 +47 -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 +8 -4
- package/dist/theme/components/searchBar.d.ts +7 -13
- 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 +2 -0
- package/dist/theme/components/toggle.d.ts +71 -0
- package/dist/theme/foundations/spacing.d.ts +2 -0
- package/dist/utils/utils.d.ts +10 -0
- package/package.json +2 -3
- package/src/__tests__/utils/utils.test.ts +23 -1
- package/src/components/Accordion/Accordion.stories.mdx +15 -14
- 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 +50 -14
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +20 -0
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +198 -0
- 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 -8
- 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 +246 -64
- package/src/components/Card/Card.test.tsx +45 -22
- package/src/components/Card/Card.tsx +26 -13
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +75 -37
- package/src/components/Chakra/Box.stories.mdx +3 -3
- package/src/components/Chakra/Center.stories.mdx +5 -5
- package/src/components/Chakra/Grid.stories.mdx +14 -17
- 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 +8 -6
- package/src/components/DatePicker/DatePicker.tsx +10 -6
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +41 -22
- package/src/components/Fieldset/Fieldset.stories.mdx +19 -8
- package/src/components/Form/Form.stories.mdx +49 -41
- package/src/components/Form/Form.tsx +5 -4
- 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 +9 -8
- package/src/components/HorizontalRule/HorizontalRule.tsx +2 -4
- package/src/components/Icons/Icon.stories.mdx +77 -75
- package/src/components/Icons/Icon.tsx +4 -5
- package/src/components/Icons/IconSvgs.tsx +2 -42
- package/src/components/Icons/IconTypes.tsx +1 -24
- package/src/components/Image/Image.stories.mdx +214 -104
- package/src/components/Image/Image.test.tsx +10 -0
- package/src/components/Image/Image.tsx +21 -10
- package/src/components/Image/ImageTypes.ts +2 -0
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +24 -8
- package/src/components/Label/Label.stories.mdx +21 -20
- package/src/components/Link/Link.stories.mdx +103 -53
- package/src/components/Link/Link.test.tsx +108 -7
- package/src/components/Link/Link.tsx +58 -19
- package/src/components/Link/LinkTypes.tsx +1 -0
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +261 -0
- package/src/components/List/List.stories.mdx +36 -24
- package/src/components/Logo/Logo.stories.mdx +220 -0
- package/src/components/Logo/Logo.test.tsx +98 -0
- package/src/components/Logo/Logo.tsx +97 -0
- package/src/components/Logo/LogoSvgs.tsx +34 -0
- package/src/components/Logo/LogoTypes.tsx +32 -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 +96 -40
- package/src/components/Notification/Notification.test.tsx +62 -16
- package/src/components/Notification/Notification.tsx +26 -9
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +121 -0
- package/src/components/Pagination/Pagination.stories.mdx +18 -8
- package/src/components/Pagination/Pagination.tsx +1 -1
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +42 -0
- package/src/components/Placeholder/Placeholder.tsx +7 -14
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +74 -46
- package/src/components/Radio/Radio.stories.mdx +39 -19
- package/src/components/Radio/Radio.tsx +13 -9
- package/src/components/RadioGroup/RadioGroup.stories.mdx +50 -16
- package/src/components/RadioGroup/RadioGroup.tsx +15 -11
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +6 -3
- package/src/components/SearchBar/SearchBar.Test.tsx +114 -22
- package/src/components/SearchBar/SearchBar.stories.mdx +111 -33
- package/src/components/SearchBar/SearchBar.tsx +57 -33
- package/src/components/Select/Select.stories.mdx +177 -66
- package/src/components/Select/Select.test.tsx +2 -2
- package/src/components/Select/Select.tsx +22 -12
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +50 -16
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +8 -4
- package/src/components/Slider/Slider.stories.mdx +74 -23
- package/src/components/Slider/Slider.test.tsx +35 -0
- package/src/components/Slider/Slider.tsx +22 -11
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +60 -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 +66 -0
- package/src/components/Table/Table.test.tsx +60 -0
- package/src/components/Table/Table.tsx +116 -0
- package/src/components/Tabs/Tabs.stories.mdx +19 -13
- package/src/components/Tabs/Tabs.test.tsx +1 -1
- package/src/components/Template/Template.stories.mdx +57 -49
- package/src/components/Template/Template.test.tsx +65 -5
- package/src/components/Template/Template.tsx +35 -5
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +76 -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 +200 -0
- package/src/components/Toggle/Toggle.test.tsx +140 -0
- package/src/components/Toggle/Toggle.tsx +123 -0
- package/src/components/Toggle/ToggleSizes.tsx +4 -0
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +255 -0
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +96 -25
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +103 -1
- package/src/components/VideoPlayer/VideoPlayer.tsx +72 -22
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +57 -3
- package/src/docs/Chakra.stories.mdx +5 -8
- package/src/docs/Intro.stories.mdx +2 -2
- package/src/index.ts +13 -4
- 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 +14 -4
- package/src/theme/components/button.ts +5 -12
- package/src/theme/components/card.ts +9 -7
- package/src/theme/components/checkbox.ts +1 -1
- package/src/theme/components/customTable.ts +50 -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/icon.ts +2 -2
- package/src/theme/components/image.ts +9 -1
- package/src/theme/components/link.ts +17 -5
- package/src/theme/components/list.ts +1 -3
- package/src/theme/components/logo.ts +54 -0
- package/src/theme/components/notification.ts +9 -7
- package/src/theme/components/searchBar.ts +7 -13
- package/src/theme/components/select.ts +1 -0
- package/src/theme/components/statusBadge.ts +1 -1
- package/src/theme/components/structuredContent.ts +54 -0
- package/src/theme/components/template.ts +10 -10
- package/src/theme/components/text.ts +6 -6
- package/src/theme/components/textInput.ts +1 -0
- package/src/theme/components/toggle.ts +69 -0
- package/src/theme/components/videoPlayer.ts +0 -2
- package/src/theme/foundations/global.ts +2 -2
- package/src/theme/foundations/spacing.ts +3 -0
- package/src/theme/foundations/typography.ts +84 -12
- package/src/theme/index.ts +8 -0
- package/src/utils/componentCategories.ts +4 -2
- 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")}
|
|
@@ -31,16 +45,46 @@ import DSProvider from "../../theme/provider";
|
|
|
31
45
|
parameters={{
|
|
32
46
|
design: {
|
|
33
47
|
type: "figma",
|
|
34
|
-
url:
|
|
35
|
-
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=36835%3A25747",
|
|
48
|
+
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=36835%3A25747",
|
|
36
49
|
},
|
|
50
|
+
jest: ["Card.test.tsx"],
|
|
37
51
|
}}
|
|
38
52
|
argTypes={{
|
|
39
|
-
className: { table: { disable: true } },
|
|
40
|
-
id: { table: { disable: true } },
|
|
41
|
-
imageComponent: { table: { disable: true } },
|
|
42
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 },
|
|
43
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
|
+
},
|
|
44
88
|
}}
|
|
45
89
|
/>
|
|
46
90
|
|
|
@@ -49,41 +93,61 @@ import DSProvider from "../../theme/provider";
|
|
|
49
93
|
| Component Version | DS Version |
|
|
50
94
|
| ----------------- | ---------- |
|
|
51
95
|
| Added | `0.24.0` |
|
|
52
|
-
| Latest | `0.25.
|
|
96
|
+
| Latest | `0.25.9` |
|
|
53
97
|
|
|
54
98
|
<Description of={Card} />
|
|
55
99
|
|
|
56
|
-
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.
|
|
57
107
|
|
|
58
108
|
#### CardHeading
|
|
59
109
|
|
|
60
|
-
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).
|
|
61
112
|
|
|
62
113
|
#### CardActions
|
|
63
114
|
|
|
64
|
-
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.
|
|
65
118
|
|
|
66
119
|
#### CardContent
|
|
67
120
|
|
|
68
|
-
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.
|
|
69
123
|
|
|
70
124
|
<Canvas withToolbar>
|
|
71
125
|
<Story
|
|
72
|
-
name="Card
|
|
126
|
+
name="Card with Controls"
|
|
73
127
|
args={{
|
|
74
|
-
|
|
75
|
-
layout: CardLayouts.Row,
|
|
76
|
-
imageSrc: "https://placeimg.com/400/300/animals",
|
|
77
|
-
imageAspectRatio: ImageRatios.ThreeByFour,
|
|
78
|
-
imageSize: ImageSizes.Default,
|
|
79
|
-
imageAlt: "Alt text",
|
|
80
|
-
imageAtEnd: false,
|
|
128
|
+
backgroundColor: undefined,
|
|
81
129
|
border: false,
|
|
82
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,
|
|
83
142
|
}}
|
|
84
143
|
>
|
|
85
144
|
{(args) => (
|
|
86
|
-
<Card
|
|
145
|
+
<Card
|
|
146
|
+
{...args}
|
|
147
|
+
imageAspectRatio={imageRatiosEnumValues.getValue(args.imageAspectRatio)}
|
|
148
|
+
imageSize={imageSizesEnumValues.getValue(args.imageSize)}
|
|
149
|
+
layout={cardLayoutsEnumValues.getValue(args.layout)}
|
|
150
|
+
>
|
|
87
151
|
<CardHeading level={HeadingLevels.Two} id="main-heading1">
|
|
88
152
|
Optional Header
|
|
89
153
|
</CardHeading>
|
|
@@ -114,23 +178,23 @@ The `CardContent` component should be used to display all content other than hea
|
|
|
114
178
|
</Button>
|
|
115
179
|
</CardActions>
|
|
116
180
|
<CardActions>
|
|
117
|
-
<Link href="
|
|
118
|
-
<Link href="
|
|
119
|
-
<Link href="javascript:void(0);">#hash3</Link>
|
|
181
|
+
<Link href="#">#hash1</Link>,<Link href="#">#hash2</Link>,
|
|
182
|
+
<Link href="#">#hash3</Link>
|
|
120
183
|
</CardActions>
|
|
121
184
|
</Card>
|
|
122
185
|
)}
|
|
123
186
|
</Story>
|
|
124
187
|
</Canvas>
|
|
125
188
|
|
|
126
|
-
<ArgsTable story="Card
|
|
189
|
+
<ArgsTable story="Card with Controls" />
|
|
127
190
|
|
|
128
191
|
## Image Position
|
|
129
192
|
|
|
130
193
|
By default, the image is always the first element within a `Card`. This means
|
|
131
194
|
the image is at the top of a `Card` with a column layout and on the left side of
|
|
132
|
-
a `Card` with a row layout. However, you can use the `imageAtEnd` prop
|
|
133
|
-
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`.
|
|
134
198
|
|
|
135
199
|
### Column Cards
|
|
136
200
|
|
|
@@ -138,9 +202,9 @@ the default placement and move the image to the last element within a `Card`.
|
|
|
138
202
|
<Story name="Card Image Position">
|
|
139
203
|
<SimpleGrid columns={2}>
|
|
140
204
|
<Card
|
|
141
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
142
205
|
imageAlt="Alt text"
|
|
143
206
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
207
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
144
208
|
>
|
|
145
209
|
<CardHeading level={HeadingLevels.Three} id="props-heading1">
|
|
146
210
|
Image on Top (default)
|
|
@@ -151,10 +215,10 @@ the default placement and move the image to the last element within a `Card`.
|
|
|
151
215
|
</CardContent>
|
|
152
216
|
</Card>
|
|
153
217
|
<Card
|
|
154
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
155
218
|
imageAlt="Alt text"
|
|
156
219
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
157
220
|
imageAtEnd
|
|
221
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
158
222
|
>
|
|
159
223
|
<CardHeading level={HeadingLevels.Three} id="props-heading2">
|
|
160
224
|
Image on Bottom
|
|
@@ -174,11 +238,11 @@ the default placement and move the image to the last element within a `Card`.
|
|
|
174
238
|
<DSProvider>
|
|
175
239
|
<SimpleGrid columns={1}>
|
|
176
240
|
<Card
|
|
177
|
-
layout={CardLayouts.Row}
|
|
178
241
|
center
|
|
179
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
180
242
|
imageAlt="Alt text"
|
|
181
243
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
244
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
245
|
+
layout={CardLayouts.Row}
|
|
182
246
|
>
|
|
183
247
|
<CardHeading level={HeadingLevels.Four} id="row-heading1">
|
|
184
248
|
Image on Left (default)
|
|
@@ -190,12 +254,12 @@ the default placement and move the image to the last element within a `Card`.
|
|
|
190
254
|
</CardContent>
|
|
191
255
|
</Card>
|
|
192
256
|
<Card
|
|
193
|
-
layout={CardLayouts.Row}
|
|
194
257
|
center
|
|
195
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
196
258
|
imageAlt="Alt text"
|
|
197
259
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
198
260
|
imageAtEnd
|
|
261
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
262
|
+
layout={CardLayouts.Row}
|
|
199
263
|
>
|
|
200
264
|
<CardHeading level={HeadingLevels.Four} id="row-heading2">
|
|
201
265
|
Image on Right
|
|
@@ -223,10 +287,48 @@ prop to override the default width.
|
|
|
223
287
|
<SimpleGrid columns={1}>
|
|
224
288
|
<Card
|
|
225
289
|
center
|
|
290
|
+
imageAlt="Alt text"
|
|
291
|
+
imageAspectRatio={ImageRatios.Square}
|
|
292
|
+
imageSize={ImageSizes.ExtraExtraSmall}
|
|
293
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
294
|
+
>
|
|
295
|
+
<CardHeading level={HeadingLevels.Three} id="column-heading1">
|
|
296
|
+
Extra Extra Small Image
|
|
297
|
+
</CardHeading>
|
|
298
|
+
<CardHeading level={HeadingLevels.Four} id="column-heading2">
|
|
299
|
+
Max-Width: 64px
|
|
300
|
+
</CardHeading>
|
|
301
|
+
<CardContent>
|
|
302
|
+
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
303
|
+
libero, a pharetra augue.
|
|
304
|
+
</CardContent>
|
|
305
|
+
</Card>
|
|
306
|
+
<HorizontalRule />
|
|
307
|
+
<Card
|
|
308
|
+
center
|
|
309
|
+
imageAlt="Alt text"
|
|
310
|
+
imageAspectRatio={ImageRatios.Square}
|
|
311
|
+
imageSize={ImageSizes.ExtraSmall}
|
|
226
312
|
imageSrc="https://placeimg.com/400/200/animals"
|
|
313
|
+
>
|
|
314
|
+
<CardHeading level={HeadingLevels.Three} id="column-heading1">
|
|
315
|
+
Extra Small Image
|
|
316
|
+
</CardHeading>
|
|
317
|
+
<CardHeading level={HeadingLevels.Four} id="column-heading2">
|
|
318
|
+
Max-Width: 96px
|
|
319
|
+
</CardHeading>
|
|
320
|
+
<CardContent>
|
|
321
|
+
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
322
|
+
libero, a pharetra augue.
|
|
323
|
+
</CardContent>
|
|
324
|
+
</Card>
|
|
325
|
+
<HorizontalRule />
|
|
326
|
+
<Card
|
|
327
|
+
center
|
|
227
328
|
imageAlt="Alt text"
|
|
228
329
|
imageAspectRatio={ImageRatios.Square}
|
|
229
330
|
imageSize={ImageSizes.Small}
|
|
331
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
230
332
|
>
|
|
231
333
|
<CardHeading level={HeadingLevels.Three} id="column-heading1">
|
|
232
334
|
Small Image
|
|
@@ -242,10 +344,10 @@ prop to override the default width.
|
|
|
242
344
|
<HorizontalRule />
|
|
243
345
|
<Card
|
|
244
346
|
center
|
|
245
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
246
347
|
imageAlt="Alt text"
|
|
247
348
|
imageAspectRatio={ImageRatios.Square}
|
|
248
349
|
imageSize={ImageSizes.Medium}
|
|
350
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
249
351
|
>
|
|
250
352
|
<CardHeading level={HeadingLevels.Three} id="column2-heading1">
|
|
251
353
|
Medium Image
|
|
@@ -261,10 +363,10 @@ prop to override the default width.
|
|
|
261
363
|
<HorizontalRule />
|
|
262
364
|
<Card
|
|
263
365
|
center
|
|
264
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
265
366
|
imageAlt="Alt text"
|
|
266
367
|
imageAspectRatio={ImageRatios.Square}
|
|
267
368
|
imageSize={ImageSizes.Large}
|
|
369
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
268
370
|
>
|
|
269
371
|
<CardHeading level={HeadingLevels.Three} id="column3-heading1">
|
|
270
372
|
Large Image
|
|
@@ -280,9 +382,9 @@ prop to override the default width.
|
|
|
280
382
|
<HorizontalRule />
|
|
281
383
|
<Card
|
|
282
384
|
center
|
|
283
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
284
385
|
imageAlt="Alt text"
|
|
285
386
|
imageAspectRatio={ImageRatios.Square}
|
|
387
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
286
388
|
>
|
|
287
389
|
<CardHeading level={HeadingLevels.Three} id="column-4heading1">
|
|
288
390
|
Default Image
|
|
@@ -305,12 +407,48 @@ prop to override the default width.
|
|
|
305
407
|
<DSProvider>
|
|
306
408
|
<SimpleGrid columns={1}>
|
|
307
409
|
<Card
|
|
410
|
+
center
|
|
411
|
+
imageAlt="Alt text"
|
|
412
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
413
|
+
imageSize={ImageSizes.ExtraExtraSmall}
|
|
414
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
308
415
|
layout={CardLayouts.Row}
|
|
416
|
+
>
|
|
417
|
+
<CardHeading level={HeadingLevels.Three} id="row2-heading1">
|
|
418
|
+
Extra Extra Small Image
|
|
419
|
+
</CardHeading>
|
|
420
|
+
<CardHeading level={HeadingLevels.Four} id="row2-heading2">
|
|
421
|
+
Max-Width: 64px
|
|
422
|
+
</CardHeading>
|
|
423
|
+
<CardContent>
|
|
424
|
+
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
425
|
+
</CardContent>
|
|
426
|
+
</Card>
|
|
427
|
+
<Card
|
|
309
428
|
center
|
|
429
|
+
imageAlt="Alt text"
|
|
430
|
+
imageAspectRatio={ImageRatios.TwoByOne}
|
|
431
|
+
imageSize={ImageSizes.ExtraSmall}
|
|
310
432
|
imageSrc="https://placeimg.com/400/200/animals"
|
|
433
|
+
layout={CardLayouts.Row}
|
|
434
|
+
>
|
|
435
|
+
<CardHeading level={HeadingLevels.Three} id="row2-heading1">
|
|
436
|
+
Extra Small Image
|
|
437
|
+
</CardHeading>
|
|
438
|
+
<CardHeading level={HeadingLevels.Four} id="row2-heading2">
|
|
439
|
+
Max-Width: 96px
|
|
440
|
+
</CardHeading>
|
|
441
|
+
<CardContent>
|
|
442
|
+
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
443
|
+
</CardContent>
|
|
444
|
+
</Card>
|
|
445
|
+
<Card
|
|
446
|
+
center
|
|
311
447
|
imageAlt="Alt text"
|
|
312
448
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
313
449
|
imageSize={ImageSizes.Small}
|
|
450
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
451
|
+
layout={CardLayouts.Row}
|
|
314
452
|
>
|
|
315
453
|
<CardHeading level={HeadingLevels.Three} id="row2-heading1">
|
|
316
454
|
Small Image
|
|
@@ -323,12 +461,12 @@ prop to override the default width.
|
|
|
323
461
|
</CardContent>
|
|
324
462
|
</Card>
|
|
325
463
|
<Card
|
|
326
|
-
layout={CardLayouts.Row}
|
|
327
464
|
center
|
|
328
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
329
465
|
imageAlt="Alt text"
|
|
330
466
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
331
467
|
imageSize={ImageSizes.Medium}
|
|
468
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
469
|
+
layout={CardLayouts.Row}
|
|
332
470
|
>
|
|
333
471
|
<CardHeading level={HeadingLevels.Three} id="row3-heading2">
|
|
334
472
|
Medium Image
|
|
@@ -342,12 +480,12 @@ prop to override the default width.
|
|
|
342
480
|
</CardContent>
|
|
343
481
|
</Card>
|
|
344
482
|
<Card
|
|
345
|
-
layout={CardLayouts.Row}
|
|
346
483
|
center
|
|
347
|
-
imageSrc="https://placeimg.com/400/250/animals"
|
|
348
484
|
imageAlt="Alt text"
|
|
349
485
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
350
486
|
imageSize={ImageSizes.Large}
|
|
487
|
+
imageSrc="https://placeimg.com/400/250/animals"
|
|
488
|
+
layout={CardLayouts.Row}
|
|
351
489
|
>
|
|
352
490
|
<CardHeading level={HeadingLevels.Three} id="row4-heading1">
|
|
353
491
|
Large Image
|
|
@@ -362,11 +500,11 @@ prop to override the default width.
|
|
|
362
500
|
</CardContent>
|
|
363
501
|
</Card>
|
|
364
502
|
<Card
|
|
365
|
-
layout={CardLayouts.Row}
|
|
366
503
|
center
|
|
367
|
-
imageSrc="https://placeimg.com/450/250/animals"
|
|
368
504
|
imageAlt="Alt text"
|
|
369
505
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
506
|
+
imageSrc="https://placeimg.com/450/250/animals"
|
|
507
|
+
layout={CardLayouts.Row}
|
|
370
508
|
>
|
|
371
509
|
<CardHeading level={HeadingLevels.Three} id="row5-heading2">
|
|
372
510
|
Default Image
|
|
@@ -390,9 +528,9 @@ prop to override the default width.
|
|
|
390
528
|
<Story name="Cards in a Grid">
|
|
391
529
|
<SimpleGrid columns={3}>
|
|
392
530
|
<Card
|
|
393
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
394
531
|
imageAlt="Alt text"
|
|
395
532
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
533
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
396
534
|
>
|
|
397
535
|
<CardHeading level={HeadingLevels.Three} id="grid1-heading1">
|
|
398
536
|
Card Heading
|
|
@@ -403,9 +541,9 @@ prop to override the default width.
|
|
|
403
541
|
</CardContent>
|
|
404
542
|
</Card>
|
|
405
543
|
<Card
|
|
406
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
407
544
|
imageAlt="Alt text"
|
|
408
545
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
546
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
409
547
|
>
|
|
410
548
|
<CardHeading level={HeadingLevels.Three} id="grid2-heading1">
|
|
411
549
|
Card Heading
|
|
@@ -416,9 +554,9 @@ prop to override the default width.
|
|
|
416
554
|
</CardContent>
|
|
417
555
|
</Card>
|
|
418
556
|
<Card
|
|
419
|
-
imageSrc="https://placeimg.com/420/220/animals"
|
|
420
557
|
imageAlt="Alt text"
|
|
421
558
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
559
|
+
imageSrc="https://placeimg.com/420/220/animals"
|
|
422
560
|
>
|
|
423
561
|
<CardHeading level={HeadingLevels.Three} id="grid3-heading1">
|
|
424
562
|
Card Heading
|
|
@@ -429,9 +567,9 @@ prop to override the default width.
|
|
|
429
567
|
</CardContent>
|
|
430
568
|
</Card>
|
|
431
569
|
<Card
|
|
432
|
-
imageSrc="https://placeimg.com/430/230/animals"
|
|
433
570
|
imageAlt="Alt text"
|
|
434
571
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
572
|
+
imageSrc="https://placeimg.com/430/230/animals"
|
|
435
573
|
>
|
|
436
574
|
<CardHeading level={HeadingLevels.Three} id="grid4-heading1">
|
|
437
575
|
Card Heading
|
|
@@ -442,9 +580,9 @@ prop to override the default width.
|
|
|
442
580
|
</CardContent>
|
|
443
581
|
</Card>
|
|
444
582
|
<Card
|
|
445
|
-
imageSrc="https://placeimg.com/440/240/animals"
|
|
446
583
|
imageAlt="Alt text"
|
|
447
584
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
585
|
+
imageSrc="https://placeimg.com/440/240/animals"
|
|
448
586
|
>
|
|
449
587
|
<CardHeading level={HeadingLevels.Three} id="grid5-heading1">
|
|
450
588
|
Card Heading
|
|
@@ -455,9 +593,9 @@ prop to override the default width.
|
|
|
455
593
|
</CardContent>
|
|
456
594
|
</Card>
|
|
457
595
|
<Card
|
|
458
|
-
imageSrc="https://placeimg.com/450/250/animals"
|
|
459
596
|
imageAlt="Alt text"
|
|
460
597
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
598
|
+
imageSrc="https://placeimg.com/450/250/animals"
|
|
461
599
|
>
|
|
462
600
|
<CardHeading level={HeadingLevels.Three} id="grid6-heading1">
|
|
463
601
|
Card Heading
|
|
@@ -477,11 +615,11 @@ prop to override the default width.
|
|
|
477
615
|
<Story name="Cards in a Stack">
|
|
478
616
|
<SimpleGrid columns={1}>
|
|
479
617
|
<Card
|
|
480
|
-
layout={CardLayouts.Row}
|
|
481
618
|
center
|
|
482
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
483
619
|
imageAlt="Alt text"
|
|
484
620
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
621
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
622
|
+
layout={CardLayouts.Row}
|
|
485
623
|
>
|
|
486
624
|
<CardHeading level={HeadingLevels.Four} id="stack1-heading1">
|
|
487
625
|
Card Heading
|
|
@@ -493,11 +631,11 @@ prop to override the default width.
|
|
|
493
631
|
</CardContent>
|
|
494
632
|
</Card>
|
|
495
633
|
<Card
|
|
496
|
-
layout={CardLayouts.Row}
|
|
497
634
|
center
|
|
498
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
499
635
|
imageAlt="Alt text"
|
|
500
636
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
637
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
638
|
+
layout={CardLayouts.Row}
|
|
501
639
|
>
|
|
502
640
|
<CardHeading level={HeadingLevels.Four} id="stack2-heading2">
|
|
503
641
|
Card Heading
|
|
@@ -509,11 +647,11 @@ prop to override the default width.
|
|
|
509
647
|
</CardContent>
|
|
510
648
|
</Card>
|
|
511
649
|
<Card
|
|
512
|
-
layout={CardLayouts.Row}
|
|
513
650
|
center
|
|
514
|
-
imageSrc="https://placeimg.com/420/220/animals"
|
|
515
651
|
imageAlt="Alt text"
|
|
516
652
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
653
|
+
imageSrc="https://placeimg.com/420/220/animals"
|
|
654
|
+
layout={CardLayouts.Row}
|
|
517
655
|
>
|
|
518
656
|
<CardHeading level={HeadingLevels.Four} id="stack3-heading3">
|
|
519
657
|
Card Heading
|
|
@@ -530,7 +668,8 @@ prop to override the default width.
|
|
|
530
668
|
|
|
531
669
|
## Custom Image Component
|
|
532
670
|
|
|
533
|
-
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.
|
|
534
673
|
|
|
535
674
|
<Canvas withToolbar>
|
|
536
675
|
<Story name="Custom Image Component">
|
|
@@ -647,6 +786,49 @@ Instead of passing a path for the `imageSrc` prop, you can pass a custom image c
|
|
|
647
786
|
</Story>
|
|
648
787
|
</Canvas>
|
|
649
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
|
+
|
|
650
832
|
## Card With Full-Click Functionality
|
|
651
833
|
|
|
652
834
|
To enable the full-click functionality in the `Card` component, pass a URL in
|
|
@@ -662,9 +844,9 @@ from being having the full-click functionality.
|
|
|
662
844
|
<Story name="Card With Full-Click Functionality">
|
|
663
845
|
<SimpleGrid columns={2}>
|
|
664
846
|
<Card
|
|
665
|
-
imageSrc="https://placeimg.com/400/200/animals"
|
|
666
847
|
imageAlt="Alt text"
|
|
667
848
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
849
|
+
imageSrc="https://placeimg.com/400/200/animals"
|
|
668
850
|
mainActionLink="http://nypl.org"
|
|
669
851
|
>
|
|
670
852
|
<CardHeading level={HeadingLevels.Three} id="fullclick1-heading1">
|
|
@@ -688,11 +870,11 @@ from being having the full-click functionality.
|
|
|
688
870
|
</CardActions>
|
|
689
871
|
</Card>
|
|
690
872
|
<Card
|
|
691
|
-
imageSrc="https://placeimg.com/410/210/animals"
|
|
692
873
|
imageAlt="Alt text"
|
|
693
874
|
imageAspectRatio={ImageRatios.TwoByOne}
|
|
694
|
-
mainActionLink="http://nypl.org"
|
|
695
875
|
imageAtEnd
|
|
876
|
+
imageSrc="https://placeimg.com/410/210/animals"
|
|
877
|
+
mainActionLink="http://nypl.org"
|
|
696
878
|
>
|
|
697
879
|
<CardHeading level={HeadingLevels.Three} id="fullclick2-heading1">
|
|
698
880
|
Go to NYPL home page.
|