@nypl/design-system-react-components 1.0.0 → 1.0.3-beta
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/README.md +3 -5
- package/dist/components/Checkbox/Checkbox.d.ts +0 -1
- package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +8 -0
- package/dist/components/Heading/Heading.d.ts +2 -0
- package/dist/components/Logo/Logo.d.ts +1 -1
- package/dist/components/Logo/LogoSvgs.d.ts +4 -0
- package/dist/components/Slider/Slider.d.ts +1 -2
- package/dist/components/TextInput/TextInput.d.ts +2 -1
- package/dist/design-system-react-components.cjs.development.js +1038 -674
- 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 +1039 -675
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/hooks/{tests → __tests__}/useCarouselStyles.test.d.ts +0 -0
- package/dist/theme/components/button.d.ts +1 -0
- package/dist/theme/components/card.d.ts +98 -13
- package/dist/theme/components/checkboxGroup.d.ts +1 -1
- package/dist/theme/components/global.d.ts +2 -2
- package/dist/theme/components/heading.d.ts +4 -16
- package/dist/theme/components/image.d.ts +6 -0
- package/dist/theme/components/radio.d.ts +8 -0
- package/dist/theme/components/radioGroup.d.ts +1 -1
- package/dist/theme/components/skipNavigation.d.ts +3 -0
- package/dist/theme/components/structuredContent.d.ts +0 -5
- package/dist/theme/components/template.d.ts +4 -1
- package/dist/utils/utils.d.ts +15 -0
- package/package.json +6 -7
- package/CHANGELOG.md +0 -1399
- package/src/__tests__/fileMock.ts +0 -6
- package/src/__tests__/setup.ts +0 -27
- package/src/__tests__/utils/utils.test.ts +0 -18
- package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +0 -42
- package/src/components/Accordion/Accordion.stories.mdx +0 -361
- package/src/components/Accordion/Accordion.test.tsx +0 -237
- package/src/components/Accordion/Accordion.tsx +0 -136
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +0 -734
- package/src/components/Autosuggest/Autosuggest.stories.mdx +0 -75
- package/src/components/Autosuggest/Autosuggest.stories.tsx +0 -211
- package/src/components/Autosuggest/_Autosuggest.scss +0 -51
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +0 -231
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +0 -144
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +0 -98
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +0 -695
- package/src/components/Button/Button.stories.mdx +0 -320
- package/src/components/Button/Button.test.tsx +0 -184
- package/src/components/Button/Button.tsx +0 -95
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +0 -106
- package/src/components/ButtonGroup/ButtonGroup.stories.mdx +0 -147
- package/src/components/ButtonGroup/ButtonGroup.test.tsx +0 -141
- package/src/components/ButtonGroup/ButtonGroup.tsx +0 -99
- package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +0 -117
- package/src/components/Card/Card.stories.mdx +0 -1043
- package/src/components/Card/Card.test.tsx +0 -388
- package/src/components/Card/Card.tsx +0 -345
- package/src/components/Card/__snapshots__/Card.test.tsx.snap +0 -568
- package/src/components/Chakra/Box.stories.mdx +0 -52
- package/src/components/Chakra/Center.stories.mdx +0 -96
- package/src/components/Chakra/Flex.stories.mdx +0 -111
- package/src/components/Chakra/Grid.stories.mdx +0 -89
- package/src/components/Chakra/Stack.stories.mdx +0 -109
- package/src/components/Checkbox/Checkbox.stories.mdx +0 -243
- package/src/components/Checkbox/Checkbox.test.tsx +0 -319
- package/src/components/Checkbox/Checkbox.tsx +0 -166
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +0 -616
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +0 -462
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +0 -492
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +0 -173
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -1722
- package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +0 -163
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +0 -67
- package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +0 -98
- package/src/components/DatePicker/DatePicker.stories.mdx +0 -452
- package/src/components/DatePicker/DatePicker.test.tsx +0 -940
- package/src/components/DatePicker/DatePicker.tsx +0 -450
- package/src/components/DatePicker/_DatePicker.scss +0 -100
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +0 -889
- package/src/components/Fieldset/Fieldset.stories.mdx +0 -96
- package/src/components/Fieldset/Fieldset.test.tsx +0 -155
- package/src/components/Fieldset/Fieldset.tsx +0 -55
- package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +0 -89
- package/src/components/Form/Form.stories.mdx +0 -426
- package/src/components/Form/Form.test.tsx +0 -234
- package/src/components/Form/Form.tsx +0 -124
- package/src/components/Form/__snapshots__/Form.test.tsx.snap +0 -115
- package/src/components/Grid/SimpleGrid.stories.mdx +0 -338
- package/src/components/Grid/SimpleGrid.test.tsx +0 -79
- package/src/components/Grid/SimpleGrid.tsx +0 -49
- package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +0 -23
- package/src/components/Heading/Heading.stories.mdx +0 -184
- package/src/components/Heading/Heading.test.tsx +0 -171
- package/src/components/Heading/Heading.tsx +0 -101
- package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +0 -90
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +0 -172
- package/src/components/HelperErrorText/HelperErrorText.test.tsx +0 -114
- package/src/components/HelperErrorText/HelperErrorText.tsx +0 -62
- package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +0 -93
- package/src/components/Hero/Hero.stories.mdx +0 -378
- package/src/components/Hero/Hero.test.tsx +0 -611
- package/src/components/Hero/Hero.tsx +0 -203
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +0 -379
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +0 -73
- package/src/components/HorizontalRule/HorizontalRule.test.tsx +0 -54
- package/src/components/HorizontalRule/HorizontalRule.tsx +0 -27
- package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +0 -44
- package/src/components/Icons/Icon.stories.mdx +0 -413
- package/src/components/Icons/Icon.test.tsx +0 -120
- package/src/components/Icons/Icon.tsx +0 -187
- package/src/components/Icons/IconSvgs.tsx +0 -64
- package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +0 -129
- package/src/components/Image/Image.stories.mdx +0 -332
- package/src/components/Image/Image.test.tsx +0 -155
- package/src/components/Image/Image.tsx +0 -171
- package/src/components/Image/__snapshots__/Image.test.tsx.snap +0 -269
- package/src/components/Label/Label.stories.mdx +0 -100
- package/src/components/Label/Label.test.tsx +0 -116
- package/src/components/Label/Label.tsx +0 -55
- package/src/components/Label/__snapshots__/Label.test.tsx.snap +0 -45
- package/src/components/Link/Link.stories.mdx +0 -249
- package/src/components/Link/Link.test.tsx +0 -224
- package/src/components/Link/Link.tsx +0 -178
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +0 -286
- package/src/components/List/List.stories.mdx +0 -393
- package/src/components/List/List.test.tsx +0 -265
- package/src/components/List/List.tsx +0 -156
- package/src/components/List/__snapshots__/List.test.tsx.snap +0 -213
- package/src/components/Logo/Logo.stories.mdx +0 -290
- package/src/components/Logo/Logo.test.tsx +0 -116
- package/src/components/Logo/Logo.tsx +0 -147
- package/src/components/Logo/LogoSvgs.tsx +0 -82
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +0 -142
- package/src/components/Modal/Modal.stories.mdx +0 -301
- package/src/components/Modal/Modal.test.tsx +0 -157
- package/src/components/Modal/Modal.tsx +0 -154
- package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +0 -25
- package/src/components/Notification/Notification.stories.mdx +0 -358
- package/src/components/Notification/Notification.test.tsx +0 -279
- package/src/components/Notification/Notification.tsx +0 -224
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +0 -525
- package/src/components/Pagination/Pagination.stories.mdx +0 -184
- package/src/components/Pagination/Pagination.test.tsx +0 -419
- package/src/components/Pagination/Pagination.tsx +0 -269
- package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +0 -544
- package/src/components/Placeholder/Placeholder.tsx +0 -19
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +0 -360
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +0 -298
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +0 -132
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -434
- package/src/components/Radio/Radio.stories.mdx +0 -216
- package/src/components/Radio/Radio.test.tsx +0 -247
- package/src/components/Radio/Radio.tsx +0 -128
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +0 -411
- package/src/components/RadioGroup/RadioGroup.stories.mdx +0 -478
- package/src/components/RadioGroup/RadioGroup.test.tsx +0 -471
- package/src/components/RadioGroup/RadioGroup.tsx +0 -170
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +0 -1430
- package/src/components/SearchBar/SearchBar.stories.mdx +0 -518
- package/src/components/SearchBar/SearchBar.test.tsx +0 -435
- package/src/components/SearchBar/SearchBar.tsx +0 -210
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +0 -1027
- package/src/components/Select/Select.stories.mdx +0 -439
- package/src/components/Select/Select.test.tsx +0 -358
- package/src/components/Select/Select.tsx +0 -181
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +0 -885
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +0 -142
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +0 -116
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +0 -123
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +0 -898
- package/src/components/SkipNavigation/SkipNavigation.stories.mdx +0 -90
- package/src/components/SkipNavigation/SkipNavigation.test.tsx +0 -63
- package/src/components/SkipNavigation/SkipNavigation.tsx +0 -51
- package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +0 -130
- package/src/components/Slider/Slider.stories.mdx +0 -628
- package/src/components/Slider/Slider.test.tsx +0 -736
- package/src/components/Slider/Slider.tsx +0 -322
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +0 -2153
- package/src/components/StatusBadge/StatusBadge.stories.mdx +0 -109
- package/src/components/StatusBadge/StatusBadge.test.tsx +0 -70
- package/src/components/StatusBadge/StatusBadge.tsx +0 -35
- package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +0 -47
- package/src/components/StructuredContent/StructuredContent.stories.mdx +0 -567
- package/src/components/StructuredContent/StructuredContent.test.tsx +0 -435
- package/src/components/StructuredContent/StructuredContent.tsx +0 -139
- package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +0 -368
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +0 -206
- package/src/components/StyleGuide/Breakpoints.stories.mdx +0 -55
- package/src/components/StyleGuide/Buttons.stories.mdx +0 -194
- package/src/components/StyleGuide/ColorCard.tsx +0 -43
- package/src/components/StyleGuide/Colors.stories.mdx +0 -201
- package/src/components/StyleGuide/DesignTokens.stories.mdx +0 -193
- package/src/components/StyleGuide/Forms.stories.mdx +0 -94
- package/src/components/StyleGuide/Iconography.stories.mdx +0 -142
- package/src/components/StyleGuide/Spacing.stories.mdx +0 -116
- package/src/components/StyleGuide/Typography.stories.mdx +0 -419
- package/src/components/Table/Table.stories.mdx +0 -276
- package/src/components/Table/Table.test.tsx +0 -208
- package/src/components/Table/Table.tsx +0 -131
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +0 -1703
- package/src/components/Tabs/Tabs.stories.mdx +0 -338
- package/src/components/Tabs/Tabs.test.tsx +0 -298
- package/src/components/Tabs/Tabs.tsx +0 -264
- package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +0 -584
- package/src/components/Template/Template.stories.mdx +0 -691
- package/src/components/Template/Template.test.tsx +0 -309
- package/src/components/Template/Template.tsx +0 -326
- package/src/components/Template/__snapshots__/Template.test.tsx.snap +0 -342
- package/src/components/Text/Text.stories.mdx +0 -103
- package/src/components/Text/Text.test.tsx +0 -63
- package/src/components/Text/Text.tsx +0 -50
- package/src/components/Text/__snapshots__/Text.test.tsx.snap +0 -50
- package/src/components/TextInput/TextInput.stories.mdx +0 -268
- package/src/components/TextInput/TextInput.test.tsx +0 -451
- package/src/components/TextInput/TextInput.tsx +0 -240
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +0 -264
- package/src/components/Toggle/Toggle.stories.mdx +0 -237
- package/src/components/Toggle/Toggle.test.tsx +0 -170
- package/src/components/Toggle/Toggle.tsx +0 -126
- package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +0 -442
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +0 -211
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +0 -308
- package/src/components/VideoPlayer/VideoPlayer.tsx +0 -188
- package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +0 -187
- package/src/docs/Chakra.stories.mdx +0 -563
- package/src/docs/Welcome.stories.mdx +0 -148
- package/src/helpers/types.ts +0 -1
- package/src/hooks/tests/useCarouselStyles.test.ts +0 -140
- package/src/hooks/tests/useNYPLTheme.test.tsx +0 -36
- package/src/hooks/useCarouselStyles.stories.mdx +0 -30
- package/src/hooks/useCarouselStyles.ts +0 -35
- package/src/hooks/useNYPLTheme.stories.mdx +0 -98
- package/src/hooks/useNYPLTheme.ts +0 -91
- package/src/hooks/useWindowSize.stories.mdx +0 -23
- package/src/hooks/useWindowSize.ts +0 -40
- package/src/index.ts +0 -136
- package/src/resources.scss +0 -6
- package/src/styles/base/_01-breakpoints.scss +0 -27
- package/src/styles/base/_02-mixins.scss +0 -103
- package/src/styles/base/_place-holder.scss +0 -33
- package/src/styles/space/_space-inline.scss +0 -79
- package/src/styles/space/_space-inset.scss +0 -57
- package/src/styles/space/_space-stack.scss +0 -116
- package/src/styles.scss +0 -23
- package/src/theme/components/accordion.ts +0 -25
- package/src/theme/components/breadcrumb.ts +0 -94
- package/src/theme/components/button.ts +0 -132
- package/src/theme/components/buttonGroup.ts +0 -10
- package/src/theme/components/card.ts +0 -231
- package/src/theme/components/checkbox.ts +0 -110
- package/src/theme/components/checkboxGroup.ts +0 -10
- package/src/theme/components/componentWrapper.ts +0 -14
- package/src/theme/components/customTable.ts +0 -77
- package/src/theme/components/datePicker.ts +0 -17
- package/src/theme/components/fieldset.ts +0 -23
- package/src/theme/components/global.ts +0 -91
- package/src/theme/components/globalMixins.ts +0 -24
- package/src/theme/components/heading.ts +0 -79
- package/src/theme/components/helperErrorText.ts +0 -14
- package/src/theme/components/hero.ts +0 -238
- package/src/theme/components/horizontalRule.ts +0 -17
- package/src/theme/components/icon.ts +0 -88
- package/src/theme/components/image.ts +0 -135
- package/src/theme/components/label.ts +0 -15
- package/src/theme/components/link.ts +0 -63
- package/src/theme/components/list.ts +0 -88
- package/src/theme/components/logo.ts +0 -58
- package/src/theme/components/notification.ts +0 -132
- package/src/theme/components/pagination.ts +0 -17
- package/src/theme/components/progressIndicator.ts +0 -67
- package/src/theme/components/radio.ts +0 -103
- package/src/theme/components/radioGroup.ts +0 -10
- package/src/theme/components/searchBar.ts +0 -19
- package/src/theme/components/select.ts +0 -72
- package/src/theme/components/skeletonLoader.ts +0 -113
- package/src/theme/components/skipNavigation.ts +0 -26
- package/src/theme/components/slider.ts +0 -95
- package/src/theme/components/statusBadge.ts +0 -26
- package/src/theme/components/structuredContent.ts +0 -149
- package/src/theme/components/tabs.ts +0 -109
- package/src/theme/components/template.ts +0 -114
- package/src/theme/components/text.ts +0 -38
- package/src/theme/components/textInput.ts +0 -65
- package/src/theme/components/toggle.ts +0 -109
- package/src/theme/components/videoPlayer.ts +0 -47
- package/src/theme/foundations/breakpoints.ts +0 -24
- package/src/theme/foundations/colors.ts +0 -212
- package/src/theme/foundations/global.ts +0 -43
- package/src/theme/foundations/radii.ts +0 -7
- package/src/theme/foundations/shadows.ts +0 -5
- package/src/theme/foundations/spacing.ts +0 -136
- package/src/theme/foundations/typography.ts +0 -107
- package/src/theme/index.ts +0 -131
- package/src/theme/provider.tsx +0 -9
- package/src/theme/types.ts +0 -1
- package/src/utils/componentCategories.ts +0 -152
- package/src/utils/interfaces.ts +0 -5
- package/src/utils/utils.ts +0 -44
|
@@ -1,1043 +0,0 @@
|
|
|
1
|
-
import { action } from "@storybook/addon-actions";
|
|
2
|
-
import {
|
|
3
|
-
ArgsTable,
|
|
4
|
-
Canvas,
|
|
5
|
-
Description,
|
|
6
|
-
Meta,
|
|
7
|
-
Story,
|
|
8
|
-
} from "@storybook/addon-docs";
|
|
9
|
-
import { withDesign } from "storybook-addon-designs";
|
|
10
|
-
|
|
11
|
-
import Button from "../Button/Button";
|
|
12
|
-
import Card, { CardHeading, CardContent, CardActions } from "./Card";
|
|
13
|
-
import Heading from "../Heading/Heading";
|
|
14
|
-
import HorizontalRule from "../HorizontalRule/HorizontalRule";
|
|
15
|
-
import Icon from "../Icons/Icon";
|
|
16
|
-
import Image from "../Image/Image";
|
|
17
|
-
import Link from "../Link/Link";
|
|
18
|
-
import SimpleGrid from "../Grid/SimpleGrid";
|
|
19
|
-
import { getCategory } from "../../utils/componentCategories";
|
|
20
|
-
import DSProvider from "../../theme/provider";
|
|
21
|
-
|
|
22
|
-
<Meta
|
|
23
|
-
title={getCategory("Card")}
|
|
24
|
-
component={Card}
|
|
25
|
-
decorators={[withDesign]}
|
|
26
|
-
parameters={{
|
|
27
|
-
design: {
|
|
28
|
-
type: "figma",
|
|
29
|
-
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=36835%3A25747",
|
|
30
|
-
},
|
|
31
|
-
jest: ["Card.test.tsx"],
|
|
32
|
-
}}
|
|
33
|
-
argTypes={{
|
|
34
|
-
backgroundColor: { control: { type: "color" } },
|
|
35
|
-
className: { control: false },
|
|
36
|
-
foregroundColor: { control: { type: "color" } },
|
|
37
|
-
id: { control: false },
|
|
38
|
-
imageProps: { disable: true },
|
|
39
|
-
"imageProps.alt": {
|
|
40
|
-
control: { type: "text" },
|
|
41
|
-
table: { defaultValue: { summary: "" } },
|
|
42
|
-
},
|
|
43
|
-
"imageProps.aspectRatio": {
|
|
44
|
-
table: { defaultValue: { summary: "square" } },
|
|
45
|
-
},
|
|
46
|
-
"imageProps.caption": { control: false },
|
|
47
|
-
"imageProps.component": { control: false },
|
|
48
|
-
"imageProps.credit": { control: false },
|
|
49
|
-
"imageProps.isAtEnd": {
|
|
50
|
-
table: { defaultValue: { summary: false } },
|
|
51
|
-
},
|
|
52
|
-
"imageProps.size": {
|
|
53
|
-
table: { defaultValue: { summary: "default" } },
|
|
54
|
-
},
|
|
55
|
-
"imageProps.src": {
|
|
56
|
-
table: { defaultValue: { summary: "" } },
|
|
57
|
-
},
|
|
58
|
-
isAlignedRightActions: {
|
|
59
|
-
table: { defaultValue: { summary: false } },
|
|
60
|
-
},
|
|
61
|
-
isBordered: {
|
|
62
|
-
table: { defaultValue: { summary: false } },
|
|
63
|
-
},
|
|
64
|
-
isCentered: {
|
|
65
|
-
table: { defaultValue: { summary: false } },
|
|
66
|
-
},
|
|
67
|
-
layout: {
|
|
68
|
-
table: { defaultValue: { summary: "column" } },
|
|
69
|
-
},
|
|
70
|
-
}}
|
|
71
|
-
/>
|
|
72
|
-
|
|
73
|
-
# Card
|
|
74
|
-
|
|
75
|
-
| Component Version | DS Version |
|
|
76
|
-
| ----------------- | ---------- |
|
|
77
|
-
| Added | `0.24.0` |
|
|
78
|
-
| Latest | `0.28.0` |
|
|
79
|
-
|
|
80
|
-
## Table of Contents
|
|
81
|
-
|
|
82
|
-
- [Overview](#overview)
|
|
83
|
-
- [Component Props](#component-props)
|
|
84
|
-
- [Accessibility](#accessibility)
|
|
85
|
-
- [Image Position](#image-position)
|
|
86
|
-
- [Image Size](#image-size)
|
|
87
|
-
- [Custom Image Component](#custom-image-component)
|
|
88
|
-
- [Card With Link Heading](#card-with-link-heading)
|
|
89
|
-
- [Card With Full-Click Functionality](#card-with-full-click-functionality)
|
|
90
|
-
- [Card with Right Side CardActions](#card-with-right-side-cardactions)
|
|
91
|
-
- [Cards in a Grid](#cards-in-a-grid)
|
|
92
|
-
- [Cards in a Stack](#cards-in-a-stack)
|
|
93
|
-
- [Card Without Images](#card-without-images)
|
|
94
|
-
|
|
95
|
-
## Overview
|
|
96
|
-
|
|
97
|
-
<Description of={Card} />
|
|
98
|
-
|
|
99
|
-
The `Card` component is viewed as a contained, stand-alone element. It is highly
|
|
100
|
-
configurable and composable. It can be shown with or without an image and the
|
|
101
|
-
content area is composed using Card-specific child components: `CardHeading`,
|
|
102
|
-
`CardActions` and `CardContent`. These child components can be arranged in any
|
|
103
|
-
order and each child component may be used multiple times within the content
|
|
104
|
-
area. Although a `Card` is a self-contained unit, `Card` components are often
|
|
105
|
-
grouped together and displayed in some type of grid layout.
|
|
106
|
-
|
|
107
|
-
### CardHeading
|
|
108
|
-
|
|
109
|
-
The `CardHeading` component mirrors the standard Reservoir Design System (DS)
|
|
110
|
-
`Heading` component and accepts the [same props](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/story/components-typography-styles-heading--heading-with-controls).
|
|
111
|
-
|
|
112
|
-
### CardActions
|
|
113
|
-
|
|
114
|
-
The `CardActions` component is used to display "call to action" (CTA) buttons
|
|
115
|
-
and links for the card. The DS `Button` and `Link` components should be passed
|
|
116
|
-
as children into the `CardActions` component.
|
|
117
|
-
|
|
118
|
-
Set the `isAlignedRightActions` prop to true in the `Card` component to align the
|
|
119
|
-
`CardActions` to the right of the the main content area. This is only applicable
|
|
120
|
-
in the row layout of the `Card` component.
|
|
121
|
-
|
|
122
|
-
### CardContent
|
|
123
|
-
|
|
124
|
-
The `CardContent` component should be used to display all content other than
|
|
125
|
-
headings and CTAs.
|
|
126
|
-
|
|
127
|
-
## Component Props
|
|
128
|
-
|
|
129
|
-
<Canvas withToolbar>
|
|
130
|
-
<Story
|
|
131
|
-
name="Card with Controls"
|
|
132
|
-
args={{
|
|
133
|
-
backgroundColor: undefined,
|
|
134
|
-
className: undefined,
|
|
135
|
-
foregroundColor: undefined,
|
|
136
|
-
id: "card-id",
|
|
137
|
-
"imageProps.alt": "Alt text",
|
|
138
|
-
"imageProps.aspectRatio": "square",
|
|
139
|
-
"imageProps.component": undefined,
|
|
140
|
-
"imageProps.isAtEnd": false,
|
|
141
|
-
"imageProps.size": "default",
|
|
142
|
-
"imageProps.src": "https://placeimg.com/400/300/animals",
|
|
143
|
-
isAlignedRightActions: false,
|
|
144
|
-
isBordered: false,
|
|
145
|
-
isCentered: false,
|
|
146
|
-
layout: "row",
|
|
147
|
-
mainActionLink: undefined,
|
|
148
|
-
}}
|
|
149
|
-
>
|
|
150
|
-
{(args) => (
|
|
151
|
-
<Card
|
|
152
|
-
backgroundColor={args.backgroundColor}
|
|
153
|
-
className={args.className}
|
|
154
|
-
foregroundColor={args.foregroundColor}
|
|
155
|
-
id={args.id}
|
|
156
|
-
imageProps={{
|
|
157
|
-
alt: args["imageProps.alt"],
|
|
158
|
-
aspectRatio: args["imageProps.aspectRatio"],
|
|
159
|
-
component: args["imageProps.component"],
|
|
160
|
-
isAtEnd: args["imageProps.isAtEnd"],
|
|
161
|
-
size: args["imageProps.size"],
|
|
162
|
-
src: args["imageProps.src"],
|
|
163
|
-
}}
|
|
164
|
-
isAlignedRightActions={args.isAlignedRightActions}
|
|
165
|
-
isBordered={args.isBordered}
|
|
166
|
-
isCentered={args.isCentered}
|
|
167
|
-
layout={args.layout}
|
|
168
|
-
mainActionLink={args.mainActionLink}
|
|
169
|
-
>
|
|
170
|
-
<CardHeading level="two" id="main-heading1">
|
|
171
|
-
Optional Header
|
|
172
|
-
</CardHeading>
|
|
173
|
-
<CardHeading level="three" id="main-heading2">
|
|
174
|
-
Sollicitudin Lorem Tortor Purus Ornare
|
|
175
|
-
</CardHeading>
|
|
176
|
-
<CardContent>
|
|
177
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
178
|
-
libero, a pharetra augue. Nullam quis risus eget urna mollis ornare
|
|
179
|
-
vel eu leo. Nulla vitae elit libero, a pharetra augue.
|
|
180
|
-
</CardContent>
|
|
181
|
-
<CardActions topBorder bottomBorder>
|
|
182
|
-
<Button id="main-button1" onClick={action("clicked")} type="submit">
|
|
183
|
-
Primary
|
|
184
|
-
</Button>
|
|
185
|
-
<Button
|
|
186
|
-
buttonType="secondary"
|
|
187
|
-
id="main-button2"
|
|
188
|
-
onClick={action("clicked")}
|
|
189
|
-
type="submit"
|
|
190
|
-
>
|
|
191
|
-
Secondary
|
|
192
|
-
</Button>
|
|
193
|
-
</CardActions>
|
|
194
|
-
<CardActions>
|
|
195
|
-
<Link href="#">#hash1</Link>,<Link href="#">#hash2</Link>,
|
|
196
|
-
<Link href="#">#hash3</Link>
|
|
197
|
-
</CardActions>
|
|
198
|
-
</Card>
|
|
199
|
-
)}
|
|
200
|
-
</Story>
|
|
201
|
-
</Canvas>
|
|
202
|
-
|
|
203
|
-
<ArgsTable story="Card with Controls" />
|
|
204
|
-
|
|
205
|
-
## Accessibility
|
|
206
|
-
|
|
207
|
-
### Headings
|
|
208
|
-
|
|
209
|
-
In general, headings from `h1` through `h6` must be in sequential order in the
|
|
210
|
-
DOM tree. Rendering an `h4` following an `h2` will throw an accessibility error.
|
|
211
|
-
Therefore, when adding `CardHeading` components, make sure to add them in
|
|
212
|
-
sequential order with the proper `level` prop.
|
|
213
|
-
|
|
214
|
-
```tsx
|
|
215
|
-
// Correct
|
|
216
|
-
<CardHeading level="three" id="headingthree">
|
|
217
|
-
Heading level three
|
|
218
|
-
</CardHeading>
|
|
219
|
-
<CardHeading level="four" id="headingfour">
|
|
220
|
-
Heading level four
|
|
221
|
-
</CardHeading>
|
|
222
|
-
|
|
223
|
-
// Incorrect
|
|
224
|
-
<CardHeading level="two" id="headingtwo">
|
|
225
|
-
Heading level Two
|
|
226
|
-
</CardHeading>
|
|
227
|
-
<CardHeading level="four" id="headingfour">
|
|
228
|
-
Heading level four
|
|
229
|
-
</CardHeading>
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
### Full-Click Functionality
|
|
233
|
-
|
|
234
|
-
Passing in a URL in the `mainActionLink` prop will make the entire `Card`
|
|
235
|
-
clickable. Other links in the `CardActions` component can still be accessed by
|
|
236
|
-
tabbing through and pressing "enter" or by clicking as you normally would on a
|
|
237
|
-
link.
|
|
238
|
-
|
|
239
|
-
## Image Position
|
|
240
|
-
|
|
241
|
-
By default, the image is always the first element within a `Card`. This means
|
|
242
|
-
the image is at the top of a `Card` with a column layout and on the left side of
|
|
243
|
-
a `Card` with a row layout. However, you can use the `imageProps.isAtEnd` boolean prop
|
|
244
|
-
to override the default placement and move the image to the last element within
|
|
245
|
-
a `Card`.
|
|
246
|
-
|
|
247
|
-
### Column Cards
|
|
248
|
-
|
|
249
|
-
<Canvas>
|
|
250
|
-
<Story name="Card Image Position">
|
|
251
|
-
<SimpleGrid columns={2}>
|
|
252
|
-
<Card
|
|
253
|
-
imageProps={{
|
|
254
|
-
alt: "Alt text",
|
|
255
|
-
aspectRatio: "twoByOne",
|
|
256
|
-
src: "https://placeimg.com/400/200/animals",
|
|
257
|
-
}}
|
|
258
|
-
>
|
|
259
|
-
<CardHeading level="three" id="props-heading1">
|
|
260
|
-
Image on Top (default)
|
|
261
|
-
</CardHeading>
|
|
262
|
-
<CardContent>
|
|
263
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
264
|
-
libero, a pharetra augue.
|
|
265
|
-
</CardContent>
|
|
266
|
-
</Card>
|
|
267
|
-
<Card
|
|
268
|
-
imageProps={{
|
|
269
|
-
alt: "Alt text",
|
|
270
|
-
aspectRatio: "twoByOne",
|
|
271
|
-
isAtEnd: true,
|
|
272
|
-
src: "https://placeimg.com/400/200/animals",
|
|
273
|
-
}}
|
|
274
|
-
>
|
|
275
|
-
<CardHeading level="three" id="props-heading2">
|
|
276
|
-
Image on Bottom
|
|
277
|
-
</CardHeading>
|
|
278
|
-
<CardContent>
|
|
279
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
280
|
-
libero, a pharetra augue.
|
|
281
|
-
</CardContent>
|
|
282
|
-
</Card>
|
|
283
|
-
</SimpleGrid>
|
|
284
|
-
</Story>
|
|
285
|
-
</Canvas>
|
|
286
|
-
|
|
287
|
-
### Row Cards
|
|
288
|
-
|
|
289
|
-
<Canvas>
|
|
290
|
-
<DSProvider>
|
|
291
|
-
<SimpleGrid columns={1}>
|
|
292
|
-
<Card
|
|
293
|
-
imageProps={{
|
|
294
|
-
alt: "Alt text",
|
|
295
|
-
aspectRatio: "twoByOne",
|
|
296
|
-
src: "https://placeimg.com/400/200/animals",
|
|
297
|
-
}}
|
|
298
|
-
isCentered
|
|
299
|
-
layout="row"
|
|
300
|
-
>
|
|
301
|
-
<CardHeading level="four" id="row-heading1">
|
|
302
|
-
Image on Left (default)
|
|
303
|
-
</CardHeading>
|
|
304
|
-
<CardContent>
|
|
305
|
-
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
306
|
-
Sed posuere consectetur est at lobortis. Cras justo odio, dapibus ac
|
|
307
|
-
facilisis in, egestas eget quam.
|
|
308
|
-
</CardContent>
|
|
309
|
-
</Card>
|
|
310
|
-
<Card
|
|
311
|
-
imageProps={{
|
|
312
|
-
alt: "Alt text",
|
|
313
|
-
aspectRatio: "twoByOne",
|
|
314
|
-
isAtEnd: true,
|
|
315
|
-
src: "https://placeimg.com/400/200/animals",
|
|
316
|
-
}}
|
|
317
|
-
isCentered
|
|
318
|
-
layout="row"
|
|
319
|
-
>
|
|
320
|
-
<CardHeading level="four" id="row-heading2">
|
|
321
|
-
Image on Right
|
|
322
|
-
</CardHeading>
|
|
323
|
-
<CardContent>
|
|
324
|
-
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
325
|
-
Sed posuere consectetur est at lobortis. Cras justo odio, dapibus ac
|
|
326
|
-
facilisis in, egestas eget quam.
|
|
327
|
-
</CardContent>
|
|
328
|
-
</Card>
|
|
329
|
-
</SimpleGrid>
|
|
330
|
-
</DSProvider>
|
|
331
|
-
</Canvas>
|
|
332
|
-
|
|
333
|
-
## Image Size
|
|
334
|
-
|
|
335
|
-
By default, the image width is `100%` for a `Card` with a column layout and
|
|
336
|
-
`225px` for a `Card` with a row layout. However, you can use the `imageProps.size`
|
|
337
|
-
prop to override the default width.
|
|
338
|
-
|
|
339
|
-
### Column Cards
|
|
340
|
-
|
|
341
|
-
<Canvas>
|
|
342
|
-
<Story name="Card Image Size">
|
|
343
|
-
<SimpleGrid columns={1}>
|
|
344
|
-
<Card
|
|
345
|
-
imageProps={{
|
|
346
|
-
alt: "Alt text",
|
|
347
|
-
aspectRatio: "square",
|
|
348
|
-
size: "xxsmall",
|
|
349
|
-
src: "https://placeimg.com/400/200/animals",
|
|
350
|
-
}}
|
|
351
|
-
isCentered
|
|
352
|
-
>
|
|
353
|
-
<CardHeading level="three" id="column-heading1">
|
|
354
|
-
Extra Extra Small Image
|
|
355
|
-
</CardHeading>
|
|
356
|
-
<CardHeading level="four" id="column-heading2">
|
|
357
|
-
Max-Width: 64px
|
|
358
|
-
</CardHeading>
|
|
359
|
-
<CardContent>
|
|
360
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
361
|
-
libero, a pharetra augue.
|
|
362
|
-
</CardContent>
|
|
363
|
-
</Card>
|
|
364
|
-
<HorizontalRule />
|
|
365
|
-
<Card
|
|
366
|
-
imageProps={{
|
|
367
|
-
alt: "Alt text",
|
|
368
|
-
aspectRatio: "square",
|
|
369
|
-
size: "xsmall",
|
|
370
|
-
src: "https://placeimg.com/400/200/animals",
|
|
371
|
-
}}
|
|
372
|
-
isCentered
|
|
373
|
-
>
|
|
374
|
-
<CardHeading level="three" id="column-heading1">
|
|
375
|
-
Extra Small Image
|
|
376
|
-
</CardHeading>
|
|
377
|
-
<CardHeading level="four" id="column-heading2">
|
|
378
|
-
Max-Width: 96px
|
|
379
|
-
</CardHeading>
|
|
380
|
-
<CardContent>
|
|
381
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
382
|
-
libero, a pharetra augue.
|
|
383
|
-
</CardContent>
|
|
384
|
-
</Card>
|
|
385
|
-
<HorizontalRule />
|
|
386
|
-
<Card
|
|
387
|
-
imageProps={{
|
|
388
|
-
alt: "Alt text",
|
|
389
|
-
aspectRatio: "square",
|
|
390
|
-
size: "small",
|
|
391
|
-
src: "https://placeimg.com/400/200/animals",
|
|
392
|
-
}}
|
|
393
|
-
isCentered
|
|
394
|
-
>
|
|
395
|
-
<CardHeading level="three" id="column-heading1">
|
|
396
|
-
Small Image
|
|
397
|
-
</CardHeading>
|
|
398
|
-
<CardHeading level="four" id="column-heading2">
|
|
399
|
-
Max-Width: 165px
|
|
400
|
-
</CardHeading>
|
|
401
|
-
<CardContent>
|
|
402
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
403
|
-
libero, a pharetra augue.
|
|
404
|
-
</CardContent>
|
|
405
|
-
</Card>
|
|
406
|
-
<HorizontalRule />
|
|
407
|
-
<Card
|
|
408
|
-
imageProps={{
|
|
409
|
-
alt: "Alt text",
|
|
410
|
-
aspectRatio: "square",
|
|
411
|
-
size: "medium",
|
|
412
|
-
src: "https://placeimg.com/400/200/animals",
|
|
413
|
-
}}
|
|
414
|
-
isCentered
|
|
415
|
-
>
|
|
416
|
-
<CardHeading level="three" id="column2-heading1">
|
|
417
|
-
Medium Image
|
|
418
|
-
</CardHeading>
|
|
419
|
-
<CardHeading level="four" id="column2-heading2">
|
|
420
|
-
Max-Width: 225px
|
|
421
|
-
</CardHeading>
|
|
422
|
-
<CardContent>
|
|
423
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
424
|
-
libero, a pharetra augue.
|
|
425
|
-
</CardContent>
|
|
426
|
-
</Card>
|
|
427
|
-
<HorizontalRule />
|
|
428
|
-
<Card
|
|
429
|
-
imageProps={{
|
|
430
|
-
alt: "Alt text",
|
|
431
|
-
aspectRatio: "square",
|
|
432
|
-
size: "large",
|
|
433
|
-
src: "https://placeimg.com/400/200/animals",
|
|
434
|
-
}}
|
|
435
|
-
isCentered
|
|
436
|
-
>
|
|
437
|
-
<CardHeading level="three" id="column3-heading1">
|
|
438
|
-
Large Image
|
|
439
|
-
</CardHeading>
|
|
440
|
-
<CardHeading level="four" id="column3-heading2">
|
|
441
|
-
Max-Width: 360px
|
|
442
|
-
</CardHeading>
|
|
443
|
-
<CardContent>
|
|
444
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
445
|
-
libero, a pharetra augue.
|
|
446
|
-
</CardContent>
|
|
447
|
-
</Card>
|
|
448
|
-
<HorizontalRule />
|
|
449
|
-
<Card
|
|
450
|
-
imageProps={{
|
|
451
|
-
alt: "Alt text",
|
|
452
|
-
aspectRatio: "square",
|
|
453
|
-
src: "https://placeimg.com/400/200/animals",
|
|
454
|
-
}}
|
|
455
|
-
isCentered
|
|
456
|
-
>
|
|
457
|
-
<CardHeading level="three" id="column-4heading1">
|
|
458
|
-
Default Image
|
|
459
|
-
</CardHeading>
|
|
460
|
-
<CardHeading level="four" id="column-4heading2">
|
|
461
|
-
Width: 100%
|
|
462
|
-
</CardHeading>
|
|
463
|
-
<CardContent>
|
|
464
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
465
|
-
libero, a pharetra augue.
|
|
466
|
-
</CardContent>
|
|
467
|
-
</Card>
|
|
468
|
-
</SimpleGrid>
|
|
469
|
-
</Story>
|
|
470
|
-
</Canvas>
|
|
471
|
-
|
|
472
|
-
### Row Cards
|
|
473
|
-
|
|
474
|
-
<Canvas>
|
|
475
|
-
<DSProvider>
|
|
476
|
-
<SimpleGrid columns={1}>
|
|
477
|
-
<Card
|
|
478
|
-
imageProps={{
|
|
479
|
-
alt: "Alt text",
|
|
480
|
-
aspectRatio: "twoByOne",
|
|
481
|
-
size: "xxsmall",
|
|
482
|
-
src: "https://placeimg.com/400/200/animals",
|
|
483
|
-
}}
|
|
484
|
-
isCentered
|
|
485
|
-
layout="row"
|
|
486
|
-
>
|
|
487
|
-
<CardHeading level="three" id="row2-heading1">
|
|
488
|
-
Extra Extra Small Image
|
|
489
|
-
</CardHeading>
|
|
490
|
-
<CardHeading level="four" id="row2-heading2">
|
|
491
|
-
Max-Width: 64px
|
|
492
|
-
</CardHeading>
|
|
493
|
-
<CardContent>
|
|
494
|
-
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
495
|
-
</CardContent>
|
|
496
|
-
</Card>
|
|
497
|
-
<Card
|
|
498
|
-
imageProps={{
|
|
499
|
-
alt: "Alt text",
|
|
500
|
-
aspectRatio: "twoByOne",
|
|
501
|
-
size: "xsmall",
|
|
502
|
-
src: "https://placeimg.com/400/200/animals",
|
|
503
|
-
}}
|
|
504
|
-
isCentered
|
|
505
|
-
layout="row"
|
|
506
|
-
>
|
|
507
|
-
<CardHeading level="three" id="row2-heading1">
|
|
508
|
-
Extra Small Image
|
|
509
|
-
</CardHeading>
|
|
510
|
-
<CardHeading level="four" id="row2-heading2">
|
|
511
|
-
Max-Width: 96px
|
|
512
|
-
</CardHeading>
|
|
513
|
-
<CardContent>
|
|
514
|
-
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
515
|
-
</CardContent>
|
|
516
|
-
</Card>
|
|
517
|
-
<Card
|
|
518
|
-
imageProps={{
|
|
519
|
-
alt: "Alt text",
|
|
520
|
-
aspectRatio: "twoByOne",
|
|
521
|
-
size: "small",
|
|
522
|
-
src: "https://placeimg.com/400/200/animals",
|
|
523
|
-
}}
|
|
524
|
-
isCentered
|
|
525
|
-
layout="row"
|
|
526
|
-
>
|
|
527
|
-
<CardHeading level="three" id="row2-heading1">
|
|
528
|
-
Small Image
|
|
529
|
-
</CardHeading>
|
|
530
|
-
<CardHeading level="four" id="row2-heading2">
|
|
531
|
-
Max-Width: 165px
|
|
532
|
-
</CardHeading>
|
|
533
|
-
<CardContent>
|
|
534
|
-
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
535
|
-
</CardContent>
|
|
536
|
-
</Card>
|
|
537
|
-
<Card
|
|
538
|
-
imageProps={{
|
|
539
|
-
alt: "Alt text",
|
|
540
|
-
aspectRatio: "twoByOne",
|
|
541
|
-
size: "medium",
|
|
542
|
-
src: "https://placeimg.com/400/200/animals",
|
|
543
|
-
}}
|
|
544
|
-
isCentered
|
|
545
|
-
layout="row"
|
|
546
|
-
>
|
|
547
|
-
<CardHeading level="three" id="row3-heading2">
|
|
548
|
-
Medium Image
|
|
549
|
-
</CardHeading>
|
|
550
|
-
<CardHeading level="four" id="row3-heading2">
|
|
551
|
-
Max-Width: 225px
|
|
552
|
-
</CardHeading>
|
|
553
|
-
<CardContent>
|
|
554
|
-
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
555
|
-
Sed posuere consectetur est at lobortis.
|
|
556
|
-
</CardContent>
|
|
557
|
-
</Card>
|
|
558
|
-
<Card
|
|
559
|
-
imageProps={{
|
|
560
|
-
alt: "Alt text",
|
|
561
|
-
aspectRatio: "twoByOne",
|
|
562
|
-
size: "large",
|
|
563
|
-
src: "https://placeimg.com/400/200/animals",
|
|
564
|
-
}}
|
|
565
|
-
isCentered
|
|
566
|
-
layout="row"
|
|
567
|
-
>
|
|
568
|
-
<CardHeading level="three" id="row4-heading1">
|
|
569
|
-
Large Image
|
|
570
|
-
</CardHeading>
|
|
571
|
-
<CardHeading level="four" id="row4-heading2">
|
|
572
|
-
Max-Width: 360px
|
|
573
|
-
</CardHeading>
|
|
574
|
-
<CardContent>
|
|
575
|
-
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
576
|
-
Sed posuere consectetur est at lobortis. Cras justo odio, dapibus ac
|
|
577
|
-
facilisis in, egestas eget quam.
|
|
578
|
-
</CardContent>
|
|
579
|
-
</Card>
|
|
580
|
-
<Card
|
|
581
|
-
imageProps={{
|
|
582
|
-
alt: "Alt text",
|
|
583
|
-
aspectRatio: "twoByOne",
|
|
584
|
-
src: "https://placeimg.com/400/200/animals",
|
|
585
|
-
}}
|
|
586
|
-
isCentered
|
|
587
|
-
layout="row"
|
|
588
|
-
>
|
|
589
|
-
<CardHeading level="three" id="row5-heading2">
|
|
590
|
-
Default Image
|
|
591
|
-
</CardHeading>
|
|
592
|
-
<CardHeading level="four" id="row5-heading2">
|
|
593
|
-
Max-Width: 225px
|
|
594
|
-
</CardHeading>
|
|
595
|
-
<CardContent>
|
|
596
|
-
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
597
|
-
Sed posuere consectetur est at lobortis. Cras justo odio, dapibus ac
|
|
598
|
-
facilisis in, egestas eget quam.
|
|
599
|
-
</CardContent>
|
|
600
|
-
</Card>
|
|
601
|
-
</SimpleGrid>
|
|
602
|
-
</DSProvider>
|
|
603
|
-
</Canvas>
|
|
604
|
-
|
|
605
|
-
## Custom Image Component
|
|
606
|
-
|
|
607
|
-
Instead of passing a path for the `imageProps.src` prop, you can pass a custom
|
|
608
|
-
image component in using the `imageProps.component` prop.
|
|
609
|
-
|
|
610
|
-
<Canvas withToolbar>
|
|
611
|
-
<Story name="Custom Image Component">
|
|
612
|
-
<Card
|
|
613
|
-
imageProps={{
|
|
614
|
-
alt: "Alt text",
|
|
615
|
-
aspectRatio: "sixteenByNine",
|
|
616
|
-
component: (
|
|
617
|
-
<Image src="https://placeimg.com/400/400/animals" alt="Alt text" />
|
|
618
|
-
),
|
|
619
|
-
src: "https://placeimg.com/400/200/animals",
|
|
620
|
-
}}
|
|
621
|
-
>
|
|
622
|
-
<CardHeading level="two" id="img1-heading1">
|
|
623
|
-
Card Component with Custom Image Component
|
|
624
|
-
</CardHeading>
|
|
625
|
-
<CardHeading level="three" id="img2-heading2">
|
|
626
|
-
Secondary Heading
|
|
627
|
-
</CardHeading>
|
|
628
|
-
<CardContent>
|
|
629
|
-
Nulla vitae elit libero, a pharetra augue. Lorem ipsum dolor sit amet,
|
|
630
|
-
consectetur adipiscing elit. Aenean lacinia bibendum nulla sed
|
|
631
|
-
consectetur. Vestibulum id ligula porta felis euismod semper. Cras justo
|
|
632
|
-
odio, dapibus ac facilisis in, egestas eget quam. Sed posuere
|
|
633
|
-
consectetur est at lobortis.
|
|
634
|
-
</CardContent>
|
|
635
|
-
<CardActions>
|
|
636
|
-
<Link type="button" href="#">
|
|
637
|
-
Reserve
|
|
638
|
-
</Link>
|
|
639
|
-
<Link href="#url" type="forwards">
|
|
640
|
-
View Book Details
|
|
641
|
-
</Link>
|
|
642
|
-
</CardActions>
|
|
643
|
-
</Card>
|
|
644
|
-
</Story>
|
|
645
|
-
</Canvas>
|
|
646
|
-
|
|
647
|
-
## Card with Link Heading
|
|
648
|
-
|
|
649
|
-
The `CardHeading` component works just like the DS `Heading` component. This
|
|
650
|
-
means that a URL can be passed in the `url` prop for `CardHeading` or a `Link`
|
|
651
|
-
component can be used as a child. Click on "Show code" in the example below to
|
|
652
|
-
see both patterns.
|
|
653
|
-
|
|
654
|
-
<Canvas>
|
|
655
|
-
<Story name="Card With Link Heading">
|
|
656
|
-
<Card
|
|
657
|
-
imageProps={{
|
|
658
|
-
alt: "Alt text",
|
|
659
|
-
aspectRatio: "twoByOne",
|
|
660
|
-
src: "https://placeimg.com/400/200/animals",
|
|
661
|
-
}}
|
|
662
|
-
>
|
|
663
|
-
<CardHeading level="three" id="link-heading1" url="http://nypl.org">
|
|
664
|
-
Go to NYPL home page.
|
|
665
|
-
</CardHeading>
|
|
666
|
-
<CardHeading level="four" id="link-heading2">
|
|
667
|
-
<>
|
|
668
|
-
Go to NYPL <Link href="http://nypl.org">home page</Link>.
|
|
669
|
-
</>
|
|
670
|
-
</CardHeading>
|
|
671
|
-
<CardContent>
|
|
672
|
-
This entire `Card` component is clickable, but the links below are still
|
|
673
|
-
accessible by tabbing through the `Card` and pressing `enter` or
|
|
674
|
-
clicking with a mouse.
|
|
675
|
-
</CardContent>
|
|
676
|
-
<CardActions>
|
|
677
|
-
<Link href="#" type="button">
|
|
678
|
-
Button
|
|
679
|
-
</Link>
|
|
680
|
-
<Link href="#" type="forwards">
|
|
681
|
-
Other link
|
|
682
|
-
</Link>
|
|
683
|
-
</CardActions>
|
|
684
|
-
</Card>
|
|
685
|
-
</Story>
|
|
686
|
-
</Canvas>
|
|
687
|
-
|
|
688
|
-
## Card With Full-Click Functionality
|
|
689
|
-
|
|
690
|
-
To enable the full-click functionality in the `Card` component, pass a URL in
|
|
691
|
-
the `mainActionLink` prop. This will make the entire `Card` component clickable.
|
|
692
|
-
If the `Card` has action links or buttons, they can still be accessed by tabbing
|
|
693
|
-
through the `Card` and pressing `enter` or clicking like a regular link.
|
|
694
|
-
|
|
695
|
-
Internally, if multiple `CardHeading` components are passed, only the first one
|
|
696
|
-
will have the full-click link. This, however, does not affect the `Card` itself
|
|
697
|
-
from being having the full-click functionality.
|
|
698
|
-
|
|
699
|
-
<Canvas>
|
|
700
|
-
<Story name="Card With Full-Click Functionality">
|
|
701
|
-
<SimpleGrid columns={2}>
|
|
702
|
-
<Card
|
|
703
|
-
imageProps={{
|
|
704
|
-
alt: "Alt text",
|
|
705
|
-
aspectRatio: "twoByOne",
|
|
706
|
-
src: "https://placeimg.com/400/200/animals",
|
|
707
|
-
}}
|
|
708
|
-
mainActionLink="http://nypl.org"
|
|
709
|
-
>
|
|
710
|
-
<CardHeading level="three" id="fullclick1-heading1">
|
|
711
|
-
Go to NYPL home page.
|
|
712
|
-
</CardHeading>
|
|
713
|
-
<CardHeading level="four" id="fullclick1-heading2">
|
|
714
|
-
Some other heading.
|
|
715
|
-
</CardHeading>
|
|
716
|
-
<CardContent>
|
|
717
|
-
This entire `Card` component is clickable, but the links below are
|
|
718
|
-
still accessible by tabbing through the `Card` and pressing `enter` or
|
|
719
|
-
clicking with a mouse.
|
|
720
|
-
</CardContent>
|
|
721
|
-
<CardActions>
|
|
722
|
-
<Link href="#" type="button">
|
|
723
|
-
Button
|
|
724
|
-
</Link>
|
|
725
|
-
<Link href="#" type="forwards">
|
|
726
|
-
Other link
|
|
727
|
-
</Link>
|
|
728
|
-
</CardActions>
|
|
729
|
-
</Card>
|
|
730
|
-
<Card
|
|
731
|
-
imageProps={{
|
|
732
|
-
alt: "Alt text",
|
|
733
|
-
aspectRatio: "twoByOne",
|
|
734
|
-
isAtEnd: true,
|
|
735
|
-
src: "https://placeimg.com/410/210/animals",
|
|
736
|
-
}}
|
|
737
|
-
mainActionLink="http://nypl.org"
|
|
738
|
-
>
|
|
739
|
-
<CardHeading level="three" id="fullclick2-heading1">
|
|
740
|
-
Go to NYPL home page.
|
|
741
|
-
</CardHeading>
|
|
742
|
-
<CardContent>
|
|
743
|
-
This `Card` component does not have any extra links.
|
|
744
|
-
</CardContent>
|
|
745
|
-
</Card>
|
|
746
|
-
</SimpleGrid>
|
|
747
|
-
</Story>
|
|
748
|
-
</Canvas>
|
|
749
|
-
|
|
750
|
-
## Card with Right Side CardActions
|
|
751
|
-
|
|
752
|
-
It's possible to set only the `CardActions` component on the right side of the
|
|
753
|
-
main content area of the `Card`. This is possible only in the `layout="row"`
|
|
754
|
-
layout and through the `Card` component's `isAlignedRightActions` prop which
|
|
755
|
-
must be set to `true`.
|
|
756
|
-
|
|
757
|
-
<Canvas>
|
|
758
|
-
<Story name="Card with Right Side CardActions">
|
|
759
|
-
<Card
|
|
760
|
-
imageProps={{
|
|
761
|
-
alt: "Alt text",
|
|
762
|
-
aspectRatio: "twoByOne",
|
|
763
|
-
size: "medium",
|
|
764
|
-
src: "https://placeimg.com/400/200/animals",
|
|
765
|
-
}}
|
|
766
|
-
isAlignedRightActions
|
|
767
|
-
isCentered
|
|
768
|
-
layout="row"
|
|
769
|
-
>
|
|
770
|
-
<CardHeading level="two" id="main-heading1">
|
|
771
|
-
Optional Header
|
|
772
|
-
</CardHeading>
|
|
773
|
-
<CardHeading level="three" id="main-heading2">
|
|
774
|
-
Sollicitudin Lorem Tortor Purus Ornare
|
|
775
|
-
</CardHeading>
|
|
776
|
-
<CardContent>
|
|
777
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
778
|
-
libero, a pharetra augue. Nullam quis risus eget urna mollis ornare vel
|
|
779
|
-
eu leo. Nulla vitae elit libero, a pharetra augue.
|
|
780
|
-
</CardContent>
|
|
781
|
-
<CardActions topBorder bottomBorder>
|
|
782
|
-
<Button onClick={action("clicked")} id="main-button1" type="submit">
|
|
783
|
-
Primary
|
|
784
|
-
</Button>
|
|
785
|
-
<Button
|
|
786
|
-
onClick={action("clicked")}
|
|
787
|
-
id="main-button2"
|
|
788
|
-
buttonType="secondary"
|
|
789
|
-
type="submit"
|
|
790
|
-
>
|
|
791
|
-
Secondary
|
|
792
|
-
</Button>
|
|
793
|
-
</CardActions>
|
|
794
|
-
<CardActions>
|
|
795
|
-
<Link href="#">#hash1</Link>,<Link href="#">#hash2</Link>,
|
|
796
|
-
<Link href="#">#hash3</Link>
|
|
797
|
-
</CardActions>
|
|
798
|
-
</Card>
|
|
799
|
-
</Story>
|
|
800
|
-
</Canvas>
|
|
801
|
-
|
|
802
|
-
## Cards in a Grid
|
|
803
|
-
|
|
804
|
-
<Canvas>
|
|
805
|
-
<Story name="Cards in a Grid">
|
|
806
|
-
<SimpleGrid columns={3}>
|
|
807
|
-
<Card
|
|
808
|
-
imageProps={{
|
|
809
|
-
alt: "Alt text",
|
|
810
|
-
aspectRatio: "twoByOne",
|
|
811
|
-
src: "https://placeimg.com/400/200/animals",
|
|
812
|
-
}}
|
|
813
|
-
>
|
|
814
|
-
<CardHeading level="three" id="grid1-heading1">
|
|
815
|
-
Card Heading
|
|
816
|
-
</CardHeading>
|
|
817
|
-
<CardContent>
|
|
818
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
819
|
-
libero, a pharetra augue.
|
|
820
|
-
</CardContent>
|
|
821
|
-
</Card>
|
|
822
|
-
<Card
|
|
823
|
-
imageProps={{
|
|
824
|
-
alt: "Alt text",
|
|
825
|
-
aspectRatio: "twoByOne",
|
|
826
|
-
src: "https://placeimg.com/410/210/animals",
|
|
827
|
-
}}
|
|
828
|
-
>
|
|
829
|
-
<CardHeading level="three" id="grid2-heading1">
|
|
830
|
-
Card Heading
|
|
831
|
-
</CardHeading>
|
|
832
|
-
<CardContent>
|
|
833
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
834
|
-
libero, a pharetra augue.
|
|
835
|
-
</CardContent>
|
|
836
|
-
</Card>
|
|
837
|
-
<Card
|
|
838
|
-
imageProps={{
|
|
839
|
-
alt: "Alt text",
|
|
840
|
-
aspectRatio: "twoByOne",
|
|
841
|
-
src: "https://placeimg.com/420/220/animals",
|
|
842
|
-
}}
|
|
843
|
-
>
|
|
844
|
-
<CardHeading level="three" id="grid3-heading1">
|
|
845
|
-
Card Heading
|
|
846
|
-
</CardHeading>
|
|
847
|
-
<CardContent>
|
|
848
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
849
|
-
libero, a pharetra augue.
|
|
850
|
-
</CardContent>
|
|
851
|
-
</Card>
|
|
852
|
-
<Card
|
|
853
|
-
imageProps={{
|
|
854
|
-
alt: "Alt text",
|
|
855
|
-
aspectRatio: "twoByOne",
|
|
856
|
-
src: "https://placeimg.com/430/230/animals",
|
|
857
|
-
}}
|
|
858
|
-
>
|
|
859
|
-
<CardHeading level="three" id="grid4-heading1">
|
|
860
|
-
Card Heading
|
|
861
|
-
</CardHeading>
|
|
862
|
-
<CardContent>
|
|
863
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
864
|
-
libero, a pharetra augue.
|
|
865
|
-
</CardContent>
|
|
866
|
-
</Card>
|
|
867
|
-
<Card
|
|
868
|
-
imageProps={{
|
|
869
|
-
alt: "Alt text",
|
|
870
|
-
aspectRatio: "twoByOne",
|
|
871
|
-
src: "https://placeimg.com/440/200/animals",
|
|
872
|
-
}}
|
|
873
|
-
>
|
|
874
|
-
<CardHeading level="three" id="grid5-heading1">
|
|
875
|
-
Card Heading
|
|
876
|
-
</CardHeading>
|
|
877
|
-
<CardContent>
|
|
878
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
879
|
-
libero, a pharetra augue.
|
|
880
|
-
</CardContent>
|
|
881
|
-
</Card>
|
|
882
|
-
<Card
|
|
883
|
-
imageProps={{
|
|
884
|
-
alt: "Alt text",
|
|
885
|
-
aspectRatio: "twoByOne",
|
|
886
|
-
src: "https://placeimg.com/450/200/animals",
|
|
887
|
-
}}
|
|
888
|
-
>
|
|
889
|
-
<CardHeading level="three" id="grid6-heading1">
|
|
890
|
-
Card Heading
|
|
891
|
-
</CardHeading>
|
|
892
|
-
<CardContent>
|
|
893
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
894
|
-
libero, a pharetra augue.
|
|
895
|
-
</CardContent>
|
|
896
|
-
</Card>
|
|
897
|
-
</SimpleGrid>
|
|
898
|
-
</Story>
|
|
899
|
-
</Canvas>
|
|
900
|
-
|
|
901
|
-
## Cards in a Stack
|
|
902
|
-
|
|
903
|
-
<Canvas>
|
|
904
|
-
<Story name="Cards in a Stack">
|
|
905
|
-
<SimpleGrid columns={1}>
|
|
906
|
-
<Card
|
|
907
|
-
imageProps={{
|
|
908
|
-
alt: "Alt text",
|
|
909
|
-
aspectRatio: "twoByOne",
|
|
910
|
-
src: "https://placeimg.com/400/200/animals",
|
|
911
|
-
}}
|
|
912
|
-
isCentered
|
|
913
|
-
layout="row"
|
|
914
|
-
>
|
|
915
|
-
<CardHeading level="four" id="stack1-heading1">
|
|
916
|
-
Card Heading
|
|
917
|
-
</CardHeading>
|
|
918
|
-
<CardContent>
|
|
919
|
-
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
920
|
-
Sed posuere consectetur est at lobortis. Cras justo odio, dapibus ac
|
|
921
|
-
facilisis in, egestas eget quam.
|
|
922
|
-
</CardContent>
|
|
923
|
-
</Card>
|
|
924
|
-
<Card
|
|
925
|
-
imageProps={{
|
|
926
|
-
alt: "Alt text",
|
|
927
|
-
aspectRatio: "twoByOne",
|
|
928
|
-
src: "https://placeimg.com/410/210/animals",
|
|
929
|
-
}}
|
|
930
|
-
isCentered
|
|
931
|
-
layout="row"
|
|
932
|
-
>
|
|
933
|
-
<CardHeading level="four" id="stack2-heading2">
|
|
934
|
-
Card Heading
|
|
935
|
-
</CardHeading>
|
|
936
|
-
<CardContent>
|
|
937
|
-
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
938
|
-
Sed posuere consectetur est at lobortis. Cras justo odio, dapibus ac
|
|
939
|
-
facilisis in, egestas eget quam.
|
|
940
|
-
</CardContent>
|
|
941
|
-
</Card>
|
|
942
|
-
<Card
|
|
943
|
-
imageProps={{
|
|
944
|
-
alt: "Alt text",
|
|
945
|
-
aspectRatio: "twoByOne",
|
|
946
|
-
src: "https://placeimg.com/420/220/animals",
|
|
947
|
-
}}
|
|
948
|
-
isCentered
|
|
949
|
-
layout="row"
|
|
950
|
-
>
|
|
951
|
-
<CardHeading level="four" id="stack3-heading3">
|
|
952
|
-
Card Heading
|
|
953
|
-
</CardHeading>
|
|
954
|
-
<CardContent>
|
|
955
|
-
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
|
956
|
-
Sed posuere consectetur est at lobortis. Cras justo odio, dapibus ac
|
|
957
|
-
facilisis in, egestas eget quam.
|
|
958
|
-
</CardContent>
|
|
959
|
-
</Card>
|
|
960
|
-
</SimpleGrid>
|
|
961
|
-
</Story>
|
|
962
|
-
</Canvas>
|
|
963
|
-
|
|
964
|
-
## Cards Without Images
|
|
965
|
-
|
|
966
|
-
<Canvas>
|
|
967
|
-
<Story name="Cards Without Images">
|
|
968
|
-
<SimpleGrid columns={3}>
|
|
969
|
-
<Card isBordered>
|
|
970
|
-
<CardHeading level="three" id="no-img1-heading1">
|
|
971
|
-
Card Heading
|
|
972
|
-
</CardHeading>
|
|
973
|
-
<CardContent>
|
|
974
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
975
|
-
libero, a pharetra augue. Nulla vitae elit libero, a pharetra augue.
|
|
976
|
-
Praesent commodo cursus magna, vel scelerisque nisl.
|
|
977
|
-
</CardContent>
|
|
978
|
-
</Card>
|
|
979
|
-
<Card isBordered>
|
|
980
|
-
<CardHeading level="three" id="no-img2-heading1">
|
|
981
|
-
Card Heading
|
|
982
|
-
</CardHeading>
|
|
983
|
-
<CardContent>
|
|
984
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
985
|
-
libero, a pharetra augue. Nulla vitae elit libero, a pharetra augue.
|
|
986
|
-
Praesent commodo cursus magna, vel scelerisque nisl.
|
|
987
|
-
</CardContent>
|
|
988
|
-
</Card>
|
|
989
|
-
<Card isBordered>
|
|
990
|
-
<CardHeading level="three" id="no-img3-heading1">
|
|
991
|
-
Card Heading
|
|
992
|
-
</CardHeading>
|
|
993
|
-
<CardContent>
|
|
994
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
995
|
-
libero, a pharetra augue. Nulla vitae elit libero, a pharetra augue.
|
|
996
|
-
Praesent commodo cursus magna, vel scelerisque nisl.
|
|
997
|
-
</CardContent>
|
|
998
|
-
</Card>
|
|
999
|
-
</SimpleGrid>
|
|
1000
|
-
<br />
|
|
1001
|
-
<SimpleGrid columns={1}>
|
|
1002
|
-
<Card layout="row" isBordered>
|
|
1003
|
-
<CardHeading level="three" id="no-img4-heading1">
|
|
1004
|
-
Card Heading
|
|
1005
|
-
</CardHeading>
|
|
1006
|
-
<CardContent>
|
|
1007
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
1008
|
-
libero, a pharetra augue. Vestibulum id ligula porta felis euismod
|
|
1009
|
-
semper. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit
|
|
1010
|
-
libero, a pharetra augue. Praesent commodo cursus magna, vel
|
|
1011
|
-
scelerisque nisl consectetur et. Donec id elit non mi porta gravida at
|
|
1012
|
-
eget metus.
|
|
1013
|
-
</CardContent>
|
|
1014
|
-
</Card>
|
|
1015
|
-
<Card layout="row" isBordered>
|
|
1016
|
-
<CardHeading level="three" id="no-img5-heading1">
|
|
1017
|
-
Card Heading
|
|
1018
|
-
</CardHeading>
|
|
1019
|
-
<CardContent>
|
|
1020
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
1021
|
-
libero, a pharetra augue. Vestibulum id ligula porta felis euismod
|
|
1022
|
-
semper. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit
|
|
1023
|
-
libero, a pharetra augue. Praesent commodo cursus magna, vel
|
|
1024
|
-
scelerisque nisl consectetur et. Donec id elit non mi porta gravida at
|
|
1025
|
-
eget metus.
|
|
1026
|
-
</CardContent>
|
|
1027
|
-
</Card>
|
|
1028
|
-
<Card layout="row" isBordered>
|
|
1029
|
-
<CardHeading level="three" id="no-img6-heading1">
|
|
1030
|
-
Card Heading
|
|
1031
|
-
</CardHeading>
|
|
1032
|
-
<CardContent>
|
|
1033
|
-
Vestibulum id ligula porta felis euismod semper. Nulla vitae elit
|
|
1034
|
-
libero, a pharetra augue. Vestibulum id ligula porta felis euismod
|
|
1035
|
-
semper. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit
|
|
1036
|
-
libero, a pharetra augue. Praesent commodo cursus magna, vel
|
|
1037
|
-
scelerisque nisl consectetur et. Donec id elit non mi porta gravida at
|
|
1038
|
-
eget metus.
|
|
1039
|
-
</CardContent>
|
|
1040
|
-
</Card>
|
|
1041
|
-
</SimpleGrid>
|
|
1042
|
-
</Story>
|
|
1043
|
-
</Canvas>
|