@nypl/design-system-react-components 0.23.4 → 0.25.1
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 +98 -1
- package/README.md +46 -11
- package/dist/components/Accordion/Accordion.d.ts +14 -14
- package/dist/components/Autosuggest/Autosuggest.stories.d.ts +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +11 -14
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +6 -0
- package/dist/components/Button/Button.d.ts +6 -13
- package/dist/components/Button/ButtonTypes.d.ts +5 -3
- package/dist/components/Card/Card.d.ts +59 -10
- package/dist/components/Card/CardTypes.d.ts +19 -0
- package/dist/components/CardEdition/CardEdition.d.ts +21 -0
- package/dist/components/{StyleGuide/Colors.stories.d.ts → CardEdition/CardEdition.stories.d.ts} +5 -2
- package/dist/components/Checkbox/Checkbox.d.ts +21 -16
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +43 -0
- package/dist/components/CheckboxGroup/CheckboxGroupLayoutTypes.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.d.ts +79 -0
- package/dist/components/DatePicker/DatePickerTypes.d.ts +5 -0
- package/dist/components/Form/Form.d.ts +16 -8
- package/dist/components/Form/FormTypes.d.ts +2 -0
- package/dist/components/Grid/GridTypes.d.ts +9 -0
- package/dist/components/Grid/SimpleGrid.d.ts +14 -0
- package/dist/components/Heading/Heading.d.ts +9 -11
- package/dist/components/Heading/{HeadingDisplaySizes.d.ts → HeadingTypes.d.ts} +8 -0
- package/dist/components/HelperErrorText/HelperErrorText.stories.d.ts +2 -1
- package/dist/components/Hero/Hero.d.ts +19 -14
- package/dist/components/Hero/HeroTypes.d.ts +10 -5
- package/dist/components/Icons/Icon.d.ts +13 -16
- package/dist/components/Icons/IconSvgs.d.ts +4 -0
- package/dist/components/Icons/IconTypes.d.ts +78 -60
- package/dist/components/Image/Image.stories.d.ts +2 -1
- package/dist/components/Label/Label.d.ts +10 -26
- package/dist/components/Link/Link.d.ts +8 -12
- package/dist/components/List/List.stories.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +30 -24
- package/dist/components/RadioGroup/RadioGroup.d.ts +40 -0
- package/dist/components/RadioGroup/RadioGroupLayoutTypes.d.ts +4 -0
- package/dist/components/SearchBar/SearchBar.d.ts +45 -27
- package/dist/components/Select/Select.d.ts +34 -35
- package/dist/components/Select/SelectTypes.d.ts +4 -0
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +1 -1
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +2 -2
- package/dist/components/StatusBadge/StatusBadge.d.ts +8 -6
- package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +5 -0
- package/dist/components/Tabs/Tabs.d.ts +25 -0
- package/dist/components/Template/Template.d.ts +91 -0
- package/dist/components/Text/Text.d.ts +16 -0
- package/dist/components/Text/TextTypes.d.ts +6 -0
- package/dist/components/TextInput/TextInput.d.ts +37 -30
- package/dist/components/TextInput/TextInputTypes.d.ts +5 -0
- package/dist/design-system-react-components.cjs.development.js +4102 -917
- 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 +4023 -920
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +23 -5
- package/dist/resources.scss +133 -24
- package/dist/styles.css +1 -1
- package/dist/theme/components/accordion.d.ts +25 -0
- package/dist/theme/components/breadcrumb.d.ts +90 -0
- package/dist/theme/components/button.d.ts +109 -0
- package/dist/theme/components/checkbox.d.ts +91 -0
- package/dist/theme/components/customCheckboxGroup.d.ts +18 -0
- package/dist/theme/components/customRadioGroup.d.ts +18 -0
- package/dist/theme/components/global.d.ts +55 -0
- package/dist/theme/components/globalMixins.d.ts +15 -0
- package/dist/theme/components/heading.d.ts +110 -0
- package/dist/theme/components/hero.d.ts +492 -0
- package/dist/theme/components/icon.d.ts +13 -0
- package/dist/theme/components/label.d.ts +16 -0
- package/dist/theme/components/link.d.ts +45 -0
- package/dist/theme/components/radio.d.ts +95 -0
- package/dist/theme/components/searchBar.d.ts +20 -0
- package/dist/theme/components/select.d.ts +58 -0
- package/dist/theme/components/statusBadge.d.ts +25 -0
- package/dist/theme/components/tabs.d.ts +85 -0
- package/dist/theme/components/template.d.ts +105 -0
- package/dist/theme/components/text.d.ts +20 -0
- package/dist/theme/components/textInput.d.ts +105 -0
- package/dist/theme/foundations/breakpoints.d.ts +23 -0
- package/dist/theme/foundations/colors.d.ts +3 -0
- package/dist/theme/foundations/global.d.ts +23 -0
- package/dist/theme/foundations/shadows.d.ts +4 -0
- package/dist/theme/foundations/spacing.d.ts +77 -0
- package/dist/theme/foundations/typography.d.ts +8 -0
- package/dist/theme/index.d.ts +20 -0
- package/dist/theme/provider.d.ts +5 -0
- package/dist/theme/types.d.ts +1 -0
- package/dist/utils/utils.d.ts +6 -0
- package/package.json +9 -2
- package/src/components/Accordion/Accordion.stories.mdx +233 -33
- package/src/components/Accordion/Accordion.test.tsx +135 -19
- package/src/components/Accordion/Accordion.tsx +81 -56
- package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
- package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -1
- package/src/components/Autosuggest/_Autosuggest.scss +2 -2
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +57 -56
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +31 -25
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +71 -73
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +6 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +100 -0
- package/src/components/Button/Button.stories.mdx +125 -138
- package/src/components/Button/Button.test.tsx +65 -11
- package/src/components/Button/Button.tsx +72 -68
- package/src/components/Button/ButtonTypes.tsx +4 -2
- package/src/components/Button/_Button.scss +7 -92
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +58 -3
- package/src/components/Card/Card.stories.mdx +694 -0
- package/src/components/Card/Card.test.tsx +97 -102
- package/src/components/Card/Card.tsx +182 -31
- package/src/components/Card/CardTypes.tsx +21 -0
- package/src/components/Card/_Card.scss +234 -49
- package/src/components/{Card/Card.stories.tsx → CardEdition/CardEdition.stories.tsx} +32 -22
- package/src/components/CardEdition/CardEdition.test.tsx +395 -0
- package/src/components/CardEdition/CardEdition.tsx +60 -0
- package/src/components/CardEdition/_CardEdition.scss +138 -0
- package/src/components/Chakra/Box.stories.mdx +57 -0
- package/src/components/Chakra/Center.stories.mdx +99 -0
- package/src/components/Chakra/Grid.stories.mdx +79 -0
- package/src/components/Chakra/Stack.stories.mdx +93 -0
- package/src/components/Checkbox/Checkbox.stories.mdx +57 -35
- package/src/components/Checkbox/Checkbox.test.tsx +117 -147
- package/src/components/Checkbox/Checkbox.tsx +76 -50
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +325 -0
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +249 -0
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +345 -0
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +148 -0
- package/src/components/CheckboxGroup/CheckboxGroupLayoutTypes.tsx +4 -0
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +1360 -0
- package/src/components/DatePicker/DatePicker.stories.mdx +284 -0
- package/src/components/DatePicker/DatePicker.test.tsx +657 -0
- package/src/components/DatePicker/DatePicker.tsx +396 -0
- package/src/components/DatePicker/DatePickerTypes.tsx +5 -0
- package/src/components/DatePicker/_DatePicker.scss +76 -0
- package/src/components/Form/Form.stories.mdx +130 -27
- package/src/components/Form/Form.test.tsx +78 -36
- package/src/components/Form/Form.tsx +53 -19
- package/src/components/Form/FormTypes.tsx +3 -0
- package/src/components/Form/__snapshots__/Form.test.tsx.snap +38 -0
- package/src/components/Grid/GridTypes.tsx +9 -0
- package/src/components/Grid/SimpleGrid.stories.mdx +275 -0
- package/src/components/Grid/SimpleGrid.test.tsx +66 -0
- package/src/components/Grid/SimpleGrid.tsx +37 -0
- package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +8 -0
- package/src/components/Heading/Heading.stories.mdx +63 -33
- package/src/components/Heading/Heading.test.tsx +24 -16
- package/src/components/Heading/Heading.tsx +54 -38
- package/src/components/Heading/{HeadingDisplaySizes.tsx → HeadingTypes.tsx} +9 -0
- package/src/components/HelperErrorText/HelperErrorText.stories.tsx +2 -1
- package/src/components/HelperErrorText/_HelperErrorText.scss +1 -1
- package/src/components/Hero/Hero.stories.mdx +195 -85
- package/src/components/Hero/Hero.test.tsx +544 -113
- package/src/components/Hero/Hero.tsx +80 -93
- package/src/components/Hero/HeroTypes.tsx +17 -5
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +307 -0
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +6 -1
- package/src/components/HorizontalRule/_HorizontalRule.scss +1 -1
- package/src/components/Icons/Icon.stories.mdx +89 -74
- package/src/components/Icons/Icon.test.tsx +30 -22
- package/src/components/Icons/Icon.tsx +63 -61
- package/src/components/Icons/IconSvgs.tsx +8 -0
- package/src/components/Icons/IconTypes.tsx +80 -60
- package/src/components/Image/Image.stories.tsx +2 -1
- package/src/components/Input/_Input.scss +2 -2
- package/src/components/Label/Label.stories.mdx +77 -0
- package/src/components/Label/Label.test.tsx +43 -12
- package/src/components/Label/Label.tsx +28 -45
- package/src/components/Label/__snapshots__/Label.test.tsx.snap +41 -0
- package/src/components/Link/Link.stories.mdx +47 -41
- package/src/components/Link/Link.test.tsx +33 -44
- package/src/components/Link/Link.tsx +114 -100
- package/src/components/List/List.stories.mdx +7 -3
- package/src/components/List/List.stories.tsx +14 -9
- package/src/components/List/List.test.tsx +12 -8
- package/src/components/List/List.tsx +9 -7
- package/src/components/List/_List.scss +3 -3
- package/src/components/Modal/Modal.stories.mdx +7 -3
- package/src/components/Modal/_Modal.scss +1 -1
- package/src/components/Notification/Notification.stories.mdx +99 -65
- package/src/components/Notification/Notification.test.tsx +3 -16
- package/src/components/Notification/Notification.tsx +12 -12
- package/src/components/Notification/_Notification.scss +5 -4
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +1 -1
- package/src/components/Pagination/Pagination.stories.mdx +7 -1
- package/src/components/Pagination/Pagination.test.tsx +16 -10
- package/src/components/Radio/Radio.stories.mdx +57 -46
- package/src/components/Radio/Radio.test.tsx +92 -138
- package/src/components/Radio/Radio.tsx +70 -69
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +250 -0
- package/src/components/RadioGroup/RadioGroup.stories.mdx +247 -0
- package/src/components/RadioGroup/RadioGroup.test.tsx +327 -0
- package/src/components/RadioGroup/RadioGroup.tsx +154 -0
- package/src/components/RadioGroup/RadioGroupLayoutTypes.tsx +4 -0
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1101 -0
- package/src/components/SearchBar/SearchBar.Test.tsx +151 -16
- package/src/components/SearchBar/SearchBar.stories.mdx +196 -224
- package/src/components/SearchBar/SearchBar.tsx +151 -46
- package/src/components/Select/Select.stories.mdx +193 -168
- package/src/components/Select/Select.test.tsx +129 -324
- package/src/components/Select/Select.tsx +120 -160
- package/src/components/Select/SelectTypes.tsx +4 -0
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +18 -29
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -7
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +4 -2
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +2 -2
- package/src/components/SkeletonLoader/_SkeletonLoader.scss +3 -3
- package/src/components/StatusBadge/StatusBadge.stories.mdx +91 -0
- package/src/components/StatusBadge/StatusBadge.test.tsx +35 -7
- package/src/components/StatusBadge/StatusBadge.tsx +24 -25
- package/src/components/StatusBadge/StatusBadgeTypes.tsx +5 -0
- package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +28 -0
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +112 -90
- package/src/components/StyleGuide/Buttons.stories.mdx +98 -100
- package/src/components/StyleGuide/Colors.stories.mdx +336 -0
- package/src/components/StyleGuide/Forms.stories.mdx +85 -0
- package/src/components/StyleGuide/Iconography.stories.mdx +86 -93
- package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
- package/src/components/StyleGuide/Typography.stories.mdx +164 -166
- package/src/components/StyleGuide/UIDocCard.tsx +4 -4
- package/src/components/Tabs/Tabs.stories.mdx +221 -0
- package/src/components/Tabs/Tabs.test.tsx +264 -0
- package/src/components/Tabs/Tabs.tsx +220 -0
- package/src/components/Template/Template.stories.mdx +574 -0
- package/src/components/Template/Template.test.tsx +124 -0
- package/src/components/Template/Template.tsx +226 -0
- package/src/components/Text/Text.stories.mdx +70 -0
- package/src/components/Text/Text.test.tsx +63 -0
- package/src/components/Text/Text.tsx +55 -0
- package/src/components/Text/TextTypes.tsx +6 -0
- package/src/components/Text/__snapshots__/Text.test.tsx.snap +33 -0
- package/src/components/TextInput/TextInput.stories.mdx +90 -90
- package/src/components/TextInput/TextInput.test.tsx +103 -83
- package/src/components/TextInput/TextInput.tsx +108 -91
- package/src/components/TextInput/TextInputTypes.tsx +6 -0
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +2 -1
- package/src/components/VideoPlayer/VideoPlayer.tsx +4 -2
- package/src/components/VideoPlayer/_VideoPlayer.scss +1 -1
- package/src/docs/Chakra.stories.mdx +341 -0
- package/src/docs/Intro.stories.mdx +31 -24
- package/src/index.ts +70 -5
- package/src/styles/01-colors/_colors-brand.scss +6 -4
- package/src/styles/01-colors/_colors-utility.scss +14 -15
- package/src/styles/03-space/_space-inline.scss +47 -7
- package/src/styles/03-space/_space-inset.scss +33 -5
- package/src/styles/03-space/_space-stack.scss +48 -8
- package/src/styles/base/_02-breakpoints.scss +5 -4
- package/src/styles/base/_04-base.scss +2 -1
- package/src/styles/base/_place-holder.scss +1 -1
- package/src/styles/base/_typography.scss +1 -29
- package/src/styles.scss +22 -25
- package/src/theme/components/accordion.ts +30 -0
- package/src/theme/components/breadcrumb.ts +77 -0
- package/src/theme/components/button.ts +125 -0
- package/src/theme/components/checkbox.ts +107 -0
- package/src/theme/components/customCheckboxGroup.ts +12 -0
- package/src/theme/components/customRadioGroup.ts +12 -0
- package/src/theme/components/global.ts +71 -0
- package/src/theme/components/globalMixins.ts +16 -0
- package/src/theme/components/heading.ts +72 -0
- package/src/theme/components/hero.ts +239 -0
- package/src/theme/components/icon.ts +79 -0
- package/src/theme/components/label.ts +17 -0
- package/src/theme/components/link.ts +47 -0
- package/src/theme/components/radio.ts +106 -0
- package/src/theme/components/searchBar.ts +21 -0
- package/src/theme/components/select.ts +50 -0
- package/src/theme/components/statusBadge.ts +27 -0
- package/src/theme/components/tabs.ts +79 -0
- package/src/theme/components/template.ts +114 -0
- package/src/theme/components/text.ts +31 -0
- package/src/theme/components/textInput.ts +61 -0
- package/src/theme/foundations/breakpoints.ts +24 -0
- package/src/theme/foundations/colors.ts +208 -0
- package/src/theme/foundations/global.ts +26 -0
- package/src/theme/foundations/shadows.ts +5 -0
- package/src/theme/foundations/spacing.ts +85 -0
- package/src/theme/foundations/typography.ts +35 -0
- package/src/theme/index.ts +88 -0
- package/src/theme/provider.tsx +9 -0
- package/src/theme/types.ts +1 -0
- package/src/utils/componentCategories.ts +56 -21
- package/src/utils/utils.ts +13 -0
- package/dist/components/Accordion/Accordion.stories.d.ts +0 -5
- package/dist/components/Card/Card.stories.d.ts +0 -27
- package/dist/components/Label/Label.stories.d.ts +0 -12
- package/dist/components/StatusBadge/StatusBadge.stories.d.ts +0 -8
- package/dist/components/Template/Template.stories.d.ts +0 -29
- package/src/components/Accordion/Accordion.stories.tsx +0 -65
- package/src/components/Accordion/_Accordion.scss +0 -81
- package/src/components/Breadcrumbs/_Breadcrumbs.scss +0 -97
- package/src/components/Checkbox/_Checkbox.scss +0 -97
- package/src/components/Form/_Form.scss +0 -28
- package/src/components/Heading/_Heading.scss +0 -163
- package/src/components/Hero/_Hero.scss +0 -256
- package/src/components/Icons/_Icons.scss +0 -116
- package/src/components/Label/Label.stories.tsx +0 -30
- package/src/components/Label/_Label.scss +0 -22
- package/src/components/Link/_Link.scss +0 -73
- package/src/components/Radio/_Radio.scss +0 -84
- package/src/components/SearchBar/_SearchBar.scss +0 -16
- package/src/components/Select/_Select.scss +0 -82
- package/src/components/StatusBadge/StatusBadge.stories.tsx +0 -33
- package/src/components/StatusBadge/_StatusBadge.scss +0 -23
- package/src/components/StyleGuide/Colors.stories.tsx +0 -288
- package/src/components/Template/Template.stories.tsx +0 -85
- package/src/components/Template/_Template.scss +0 -63
- package/src/components/TextInput/_TextInput.scss +0 -59
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import { axe } from "jest-axe";
|
|
4
|
+
|
|
5
|
+
import CardEdition from "./CardEdition";
|
|
6
|
+
import Link from "../Link/Link";
|
|
7
|
+
import { LinkTypes } from "../Link/LinkTypes";
|
|
8
|
+
import Heading from "../Heading/Heading";
|
|
9
|
+
import { HeadingLevels } from "../Heading/HeadingTypes";
|
|
10
|
+
import Image from "../Image/Image";
|
|
11
|
+
import Button from "../Button/Button";
|
|
12
|
+
import { ButtonTypes } from "../Button/ButtonTypes";
|
|
13
|
+
import Icon from "../Icons/Icon";
|
|
14
|
+
import { IconRotationTypes, IconNames, IconAlign } from "../Icons/IconTypes";
|
|
15
|
+
|
|
16
|
+
describe("CardEdition Accessibility", () => {
|
|
17
|
+
const regularCard = (
|
|
18
|
+
<CardEdition
|
|
19
|
+
id="cardID"
|
|
20
|
+
heading={
|
|
21
|
+
<Heading
|
|
22
|
+
level={HeadingLevels.Three}
|
|
23
|
+
id="heading1"
|
|
24
|
+
text={"Optional Header"}
|
|
25
|
+
/>
|
|
26
|
+
}
|
|
27
|
+
image={<Image src="https://placeimg.com/400/200/arch" alt={""} />}
|
|
28
|
+
ctas={
|
|
29
|
+
<Button
|
|
30
|
+
onClick={function () {
|
|
31
|
+
console.log(this);
|
|
32
|
+
}}
|
|
33
|
+
id="button1"
|
|
34
|
+
buttonType={ButtonTypes.Primary}
|
|
35
|
+
type="submit"
|
|
36
|
+
>
|
|
37
|
+
Example CTA
|
|
38
|
+
</Button>
|
|
39
|
+
}
|
|
40
|
+
footer={<>Optional footer</>}
|
|
41
|
+
>
|
|
42
|
+
middle column content
|
|
43
|
+
</CardEdition>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
it("passes axe accessibility test", async () => {
|
|
47
|
+
const { container } = render(regularCard);
|
|
48
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe("CardEdition", () => {
|
|
53
|
+
const regularCard = (
|
|
54
|
+
<CardEdition
|
|
55
|
+
id="cardID"
|
|
56
|
+
heading={
|
|
57
|
+
<Heading
|
|
58
|
+
level={HeadingLevels.Three}
|
|
59
|
+
id="heading1"
|
|
60
|
+
text={"Optional Header"}
|
|
61
|
+
/>
|
|
62
|
+
}
|
|
63
|
+
image={<Image src="https://placeimg.com/400/200/arch" alt={""} />}
|
|
64
|
+
ctas={
|
|
65
|
+
<Button
|
|
66
|
+
onClick={function () {
|
|
67
|
+
console.log(this);
|
|
68
|
+
}}
|
|
69
|
+
id="button1"
|
|
70
|
+
buttonType={ButtonTypes.Primary}
|
|
71
|
+
type="submit"
|
|
72
|
+
>
|
|
73
|
+
Example CTA
|
|
74
|
+
</Button>
|
|
75
|
+
}
|
|
76
|
+
footer={<>Optional footer</>}
|
|
77
|
+
>
|
|
78
|
+
middle column content
|
|
79
|
+
</CardEdition>
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const cardWithExtendedStyles = (
|
|
83
|
+
<CardEdition
|
|
84
|
+
id="card#1"
|
|
85
|
+
className="edition-card"
|
|
86
|
+
heading={
|
|
87
|
+
<Heading
|
|
88
|
+
level={HeadingLevels.Two}
|
|
89
|
+
id="editioncardheading1"
|
|
90
|
+
text={"2004 Edition"}
|
|
91
|
+
/>
|
|
92
|
+
}
|
|
93
|
+
image={<Image src="https://placeimg.com/300/400/arch" alt={""} />}
|
|
94
|
+
ctas={
|
|
95
|
+
<div className="edition-card__ctas">
|
|
96
|
+
<Link type={LinkTypes.Button} href="blah">
|
|
97
|
+
Read Online
|
|
98
|
+
</Link>
|
|
99
|
+
<div className="edition-card__download">
|
|
100
|
+
<Link href="#url" type={LinkTypes.Action}>
|
|
101
|
+
<Icon
|
|
102
|
+
name={IconNames.Download}
|
|
103
|
+
// blockName="more-link"
|
|
104
|
+
align={IconAlign.Left}
|
|
105
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
106
|
+
/>
|
|
107
|
+
Download
|
|
108
|
+
</Link>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
}
|
|
112
|
+
>
|
|
113
|
+
<>
|
|
114
|
+
<div>Published in New York by Random House</div>
|
|
115
|
+
<div>Written in English</div>
|
|
116
|
+
<div>
|
|
117
|
+
License: Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
|
|
118
|
+
International
|
|
119
|
+
</div>
|
|
120
|
+
</>
|
|
121
|
+
</CardEdition>
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const cardWithNoCTAs = (
|
|
125
|
+
<CardEdition
|
|
126
|
+
id="card#1"
|
|
127
|
+
image={<Image src="https://placeimg.com/300/400/arch" alt={""} />}
|
|
128
|
+
className="edition-card"
|
|
129
|
+
heading={
|
|
130
|
+
<Heading
|
|
131
|
+
level={HeadingLevels.Two}
|
|
132
|
+
id="editioncardheading1"
|
|
133
|
+
text={"2004 Edition"}
|
|
134
|
+
/>
|
|
135
|
+
}
|
|
136
|
+
>
|
|
137
|
+
<>
|
|
138
|
+
<div>Published in New York by Random House</div>
|
|
139
|
+
<div>Written in English</div>
|
|
140
|
+
<div>Under Creative Commons License</div>
|
|
141
|
+
</>
|
|
142
|
+
</CardEdition>
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
const cardWithNoContent = (
|
|
146
|
+
<CardEdition
|
|
147
|
+
id="card#1"
|
|
148
|
+
className="edition-card"
|
|
149
|
+
image={<Image src="https://placeimg.com/300/400/arch" alt={""} />}
|
|
150
|
+
heading={
|
|
151
|
+
<Heading
|
|
152
|
+
level={HeadingLevels.Two}
|
|
153
|
+
id="editioncardheading1"
|
|
154
|
+
url="#edition-link"
|
|
155
|
+
text={"2004 Edition"}
|
|
156
|
+
/>
|
|
157
|
+
}
|
|
158
|
+
ctas={
|
|
159
|
+
<div className="edition-card__ctas">
|
|
160
|
+
<Link type={LinkTypes.Button} href="blah">
|
|
161
|
+
Read Online
|
|
162
|
+
</Link>
|
|
163
|
+
<div className="edition-card__download">
|
|
164
|
+
<Link href="#url" type={LinkTypes.Action}>
|
|
165
|
+
<Icon
|
|
166
|
+
name={IconNames.Download}
|
|
167
|
+
// blockName="more-link"
|
|
168
|
+
align={IconAlign.Left}
|
|
169
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
170
|
+
/>
|
|
171
|
+
Download
|
|
172
|
+
</Link>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
}
|
|
176
|
+
></CardEdition>
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
const cardWithNoImage = (
|
|
180
|
+
<CardEdition
|
|
181
|
+
id="card#1"
|
|
182
|
+
className="edition-card"
|
|
183
|
+
heading={
|
|
184
|
+
<Heading
|
|
185
|
+
level={HeadingLevels.Two}
|
|
186
|
+
id="editioncardheading1"
|
|
187
|
+
url="#edition-link"
|
|
188
|
+
text={"2004 Edition"}
|
|
189
|
+
/>
|
|
190
|
+
}
|
|
191
|
+
ctas={
|
|
192
|
+
<div className="edition-card__ctas">
|
|
193
|
+
<Link type={LinkTypes.Button} href="blah">
|
|
194
|
+
Read Online
|
|
195
|
+
</Link>
|
|
196
|
+
<div className="edition-card__download">
|
|
197
|
+
<Link href="#url" type={LinkTypes.Action}>
|
|
198
|
+
<Icon
|
|
199
|
+
name={IconNames.Download}
|
|
200
|
+
align={IconAlign.Left}
|
|
201
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
202
|
+
/>
|
|
203
|
+
Download
|
|
204
|
+
</Link>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
}
|
|
208
|
+
>
|
|
209
|
+
middle column content
|
|
210
|
+
</CardEdition>
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
const cardWithNoHeader = (
|
|
214
|
+
<CardEdition
|
|
215
|
+
id="card#1"
|
|
216
|
+
className="edition-card"
|
|
217
|
+
image={<Image src="https://placeimg.com/300/400/arch" alt={""} />}
|
|
218
|
+
ctas={
|
|
219
|
+
<div className="edition-card__ctas">
|
|
220
|
+
<Link type={LinkTypes.Button} href="blah">
|
|
221
|
+
Read Online
|
|
222
|
+
</Link>
|
|
223
|
+
<div className="edition-card__download">
|
|
224
|
+
<Link href="#url" type={LinkTypes.Action}>
|
|
225
|
+
<Icon
|
|
226
|
+
name={IconNames.Download}
|
|
227
|
+
align={IconAlign.Left}
|
|
228
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
229
|
+
/>
|
|
230
|
+
Download
|
|
231
|
+
</Link>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
}
|
|
235
|
+
footer={<>Optional footer</>}
|
|
236
|
+
>
|
|
237
|
+
middle column content
|
|
238
|
+
</CardEdition>
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
const cardWithNoFooter = (
|
|
242
|
+
<CardEdition
|
|
243
|
+
id="card#1"
|
|
244
|
+
className="edition-card"
|
|
245
|
+
heading={
|
|
246
|
+
<Heading
|
|
247
|
+
level={HeadingLevels.Two}
|
|
248
|
+
id="editioncardheading1"
|
|
249
|
+
url="#edition-link"
|
|
250
|
+
text={"2004 Edition"}
|
|
251
|
+
/>
|
|
252
|
+
}
|
|
253
|
+
image={<Image src="https://placeimg.com/300/400/arch" alt={""} />}
|
|
254
|
+
ctas={
|
|
255
|
+
<div className="edition-card__ctas">
|
|
256
|
+
<Link type={LinkTypes.Button} href="blah">
|
|
257
|
+
Read Online
|
|
258
|
+
</Link>
|
|
259
|
+
<div className="edition-card__download">
|
|
260
|
+
<Link href="#url" type={LinkTypes.Action}>
|
|
261
|
+
<Icon
|
|
262
|
+
name={IconNames.Download}
|
|
263
|
+
align={IconAlign.Left}
|
|
264
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
265
|
+
/>
|
|
266
|
+
Download
|
|
267
|
+
</Link>
|
|
268
|
+
</div>
|
|
269
|
+
</div>
|
|
270
|
+
}
|
|
271
|
+
>
|
|
272
|
+
middle column content
|
|
273
|
+
</CardEdition>
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
it("Generates a Card with a header, footer, image, middle content, and CTAs", () => {
|
|
277
|
+
const card = render(regularCard);
|
|
278
|
+
expect(
|
|
279
|
+
card.container.querySelector(".card-edition__heading")
|
|
280
|
+
).toBeInTheDocument();
|
|
281
|
+
expect(
|
|
282
|
+
card.container.querySelector(".card-edition__image")
|
|
283
|
+
).toBeInTheDocument();
|
|
284
|
+
expect(
|
|
285
|
+
card.container.querySelector(".card-edition__content")
|
|
286
|
+
).toBeInTheDocument();
|
|
287
|
+
expect(
|
|
288
|
+
card.container.querySelector(".card-edition__ctas")
|
|
289
|
+
).toBeInTheDocument();
|
|
290
|
+
expect(
|
|
291
|
+
card.container.querySelector(".card-edition__footer")
|
|
292
|
+
).toBeInTheDocument();
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
it("Generates a Card with variable data", () => {
|
|
296
|
+
const card = render(cardWithExtendedStyles);
|
|
297
|
+
expect(card.container.querySelector("h2")).toBeInTheDocument();
|
|
298
|
+
expect(
|
|
299
|
+
screen.getByText("Published in New York by Random House")
|
|
300
|
+
).toBeInTheDocument();
|
|
301
|
+
expect(screen.getByText("Written in English")).toBeInTheDocument();
|
|
302
|
+
expect(
|
|
303
|
+
screen.getByText(
|
|
304
|
+
"License: Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International"
|
|
305
|
+
)
|
|
306
|
+
).toBeInTheDocument();
|
|
307
|
+
// expect(screen.findAllByRole("link")).toHaveLength(2);
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
it("Generates a card without a CTA block if one isn't provided", () => {
|
|
311
|
+
const card = render(cardWithNoCTAs);
|
|
312
|
+
expect(
|
|
313
|
+
card.container.querySelector(".card-edition__heading")
|
|
314
|
+
).toBeInTheDocument();
|
|
315
|
+
expect(
|
|
316
|
+
card.container.querySelector(".card-edition__image")
|
|
317
|
+
).toBeInTheDocument();
|
|
318
|
+
expect(
|
|
319
|
+
card.container.querySelector(".card-edition__content")
|
|
320
|
+
).toBeInTheDocument();
|
|
321
|
+
expect(
|
|
322
|
+
card.container.querySelector(".card-edition__ctas")
|
|
323
|
+
).not.toBeInTheDocument();
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
it("Generates a card without a content block if one isn't provided", () => {
|
|
327
|
+
const card = render(cardWithNoContent);
|
|
328
|
+
expect(
|
|
329
|
+
card.container.querySelector(".card-edition__heading")
|
|
330
|
+
).toBeInTheDocument();
|
|
331
|
+
expect(
|
|
332
|
+
card.container.querySelector(".card-edition__image")
|
|
333
|
+
).toBeInTheDocument();
|
|
334
|
+
expect(
|
|
335
|
+
card.container.querySelector(".card-edition__content")
|
|
336
|
+
).not.toBeInTheDocument();
|
|
337
|
+
expect(
|
|
338
|
+
card.container.querySelector(".card-edition__ctas")
|
|
339
|
+
).toBeInTheDocument();
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
it("Generates a card without an image block if no image is provided", () => {
|
|
343
|
+
const card = render(cardWithNoImage);
|
|
344
|
+
expect(
|
|
345
|
+
card.container.querySelector(".card-edition__heading")
|
|
346
|
+
).toBeInTheDocument();
|
|
347
|
+
expect(
|
|
348
|
+
card.container.querySelector(".card-edition__image")
|
|
349
|
+
).not.toBeInTheDocument();
|
|
350
|
+
expect(
|
|
351
|
+
card.container.querySelector(".card-edition__content")
|
|
352
|
+
).toBeInTheDocument();
|
|
353
|
+
expect(
|
|
354
|
+
card.container.querySelector(".card-edition__ctas")
|
|
355
|
+
).toBeInTheDocument();
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
it("Generates a card without a header block if one isn't provided", () => {
|
|
359
|
+
const card = render(cardWithNoHeader);
|
|
360
|
+
expect(
|
|
361
|
+
card.container.querySelector(".card-edition__heading")
|
|
362
|
+
).not.toBeInTheDocument();
|
|
363
|
+
expect(
|
|
364
|
+
card.container.querySelector(".card-edition__image")
|
|
365
|
+
).toBeInTheDocument();
|
|
366
|
+
expect(
|
|
367
|
+
card.container.querySelector(".card-edition__content")
|
|
368
|
+
).toBeInTheDocument();
|
|
369
|
+
expect(
|
|
370
|
+
card.container.querySelector(".card-edition__ctas")
|
|
371
|
+
).toBeInTheDocument();
|
|
372
|
+
expect(
|
|
373
|
+
card.container.querySelector(".card-edition__footer")
|
|
374
|
+
).toBeInTheDocument();
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
it("Generates a card without a footer block if one isn't provided", () => {
|
|
378
|
+
const card = render(cardWithNoFooter);
|
|
379
|
+
expect(
|
|
380
|
+
card.container.querySelector(".card-edition__heading")
|
|
381
|
+
).toBeInTheDocument();
|
|
382
|
+
expect(
|
|
383
|
+
card.container.querySelector(".card-edition__image")
|
|
384
|
+
).toBeInTheDocument();
|
|
385
|
+
expect(
|
|
386
|
+
card.container.querySelector(".card-edition__content")
|
|
387
|
+
).toBeInTheDocument();
|
|
388
|
+
expect(
|
|
389
|
+
card.container.querySelector(".card-edition__ctas")
|
|
390
|
+
).toBeInTheDocument();
|
|
391
|
+
expect(
|
|
392
|
+
card.container.querySelector(".card-edition__footer")
|
|
393
|
+
).not.toBeInTheDocument();
|
|
394
|
+
});
|
|
395
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import bem from "../../utils/bem";
|
|
3
|
+
|
|
4
|
+
interface CardEditionProps {
|
|
5
|
+
/** ClassName that appears in addition to "card" */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** BlockName for use with BEM. See how to work with blockNames and BEM here: http://getbem.com/introduction/ */
|
|
8
|
+
blockName?: string;
|
|
9
|
+
/** Calls to Action for the card, such as "download" on a card for a book */
|
|
10
|
+
ctas?: React.ReactNode;
|
|
11
|
+
/** Footer that appears within the card but below the three columns within it */
|
|
12
|
+
footer?: React.ReactNode;
|
|
13
|
+
/** Heading that appears within the card but above the three columns within it */
|
|
14
|
+
heading?: React.ReactNode;
|
|
15
|
+
/** ID that other components can cross reference for accessibility purposes */
|
|
16
|
+
id?: string;
|
|
17
|
+
/** First column within the card */
|
|
18
|
+
image?: React.ReactNode;
|
|
19
|
+
/** Modifiers array for use with BEM. See how to work with modifiers and BEM here: http://getbem.com/introduction/ */
|
|
20
|
+
modifiers?: string[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function CardEdition(
|
|
24
|
+
props: React.PropsWithChildren<CardEditionProps>
|
|
25
|
+
) {
|
|
26
|
+
const {
|
|
27
|
+
blockName,
|
|
28
|
+
children,
|
|
29
|
+
className,
|
|
30
|
+
ctas,
|
|
31
|
+
footer,
|
|
32
|
+
heading,
|
|
33
|
+
id,
|
|
34
|
+
image,
|
|
35
|
+
modifiers = [],
|
|
36
|
+
} = props;
|
|
37
|
+
const baseClass = "card-edition";
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div className={bem(baseClass, modifiers, blockName, [className])} id={id}>
|
|
41
|
+
{heading && (
|
|
42
|
+
<div className={bem("heading", modifiers, baseClass)}>{heading}</div>
|
|
43
|
+
)}
|
|
44
|
+
<div className={bem("columns", modifiers, baseClass)}>
|
|
45
|
+
{image && (
|
|
46
|
+
<div className={bem("image", modifiers, baseClass)}>{image}</div>
|
|
47
|
+
)}
|
|
48
|
+
{children && (
|
|
49
|
+
<div className={bem("content", modifiers, baseClass)}>{children}</div>
|
|
50
|
+
)}
|
|
51
|
+
{ctas && (
|
|
52
|
+
<div className={bem("ctas", modifiers, baseClass)}>{ctas}</div>
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
{footer && (
|
|
56
|
+
<div className={bem("footer", modifiers, baseClass)}>{footer}</div>
|
|
57
|
+
)}
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
.card-edition {
|
|
2
|
+
@include space-stack-s;
|
|
3
|
+
|
|
4
|
+
align-items: flex-start;
|
|
5
|
+
border: 1px solid var(--ui-gray-light-cool);
|
|
6
|
+
border-radius: 5px;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-flow: column wrap;
|
|
9
|
+
padding: var(--space) var(--space-l);
|
|
10
|
+
|
|
11
|
+
&__heading,
|
|
12
|
+
&__footer {
|
|
13
|
+
flex: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__columns {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-flow: column wrap;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
width: 100%;
|
|
21
|
+
|
|
22
|
+
@include breakpoint($breakpoint-medium) {
|
|
23
|
+
flex-flow: row wrap;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&__columns + &__footer {
|
|
28
|
+
margin-top: var(--space-xs);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&__image {
|
|
32
|
+
@include space-stack-s;
|
|
33
|
+
|
|
34
|
+
align-items: center;
|
|
35
|
+
background-color: var(--ui-gray-x-light-cool);
|
|
36
|
+
display: flex;
|
|
37
|
+
flex: 0 0 150px;
|
|
38
|
+
height: 150px;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
|
|
41
|
+
.image {
|
|
42
|
+
max-height: 100%;
|
|
43
|
+
max-width: 100%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@include breakpoint($breakpoint-medium) {
|
|
47
|
+
@include space-stack-none;
|
|
48
|
+
@include space-inline-s;
|
|
49
|
+
|
|
50
|
+
align-self: center;
|
|
51
|
+
width: 150px;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&__content {
|
|
56
|
+
@include space-stack-s;
|
|
57
|
+
|
|
58
|
+
flex: 1 1;
|
|
59
|
+
|
|
60
|
+
@include breakpoint($breakpoint-medium) {
|
|
61
|
+
@include space-inline-s;
|
|
62
|
+
@include space-stack-none;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&__ctas {
|
|
67
|
+
flex: 0 1 20%;
|
|
68
|
+
|
|
69
|
+
@include breakpoint($breakpoint-medium) {
|
|
70
|
+
@include space-inline-s;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&__content + &__ctas {
|
|
75
|
+
@include space-inline-s;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Stories-only styles
|
|
80
|
+
.sb-show-main {
|
|
81
|
+
.var-docs {
|
|
82
|
+
padding: 0 0 var(--space) 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.example-card-edition {
|
|
86
|
+
.card__content {
|
|
87
|
+
> * {
|
|
88
|
+
@include space-stack-xxs;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.book__callout {
|
|
93
|
+
// formerly imported with @include heading-xs;
|
|
94
|
+
font-size: var(--font-size-1);
|
|
95
|
+
font-weight: 400;
|
|
96
|
+
line-height: 1.15;
|
|
97
|
+
margin: 0 0 0.5em;
|
|
98
|
+
width: auto;
|
|
99
|
+
|
|
100
|
+
&__link {
|
|
101
|
+
color: inherit;
|
|
102
|
+
|
|
103
|
+
&:hover {
|
|
104
|
+
color: inherit;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* stylelint-disable */
|
|
109
|
+
font-style: italic;
|
|
110
|
+
font-weight: 300;
|
|
111
|
+
/* stylelint-enable */
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.card__ctas {
|
|
115
|
+
align-items: flex-end;
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-flow: row wrap;
|
|
118
|
+
justify-content: center;
|
|
119
|
+
text-align: center;
|
|
120
|
+
|
|
121
|
+
.button {
|
|
122
|
+
width: 100%;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
> * {
|
|
126
|
+
@include space-stack-xxs;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.book__filetype {
|
|
131
|
+
@include space-stack-s;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.book__description {
|
|
135
|
+
font-style: italic;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Meta, Story, Canvas } from "@storybook/addon-docs/blocks";
|
|
2
|
+
import { Box } from "@chakra-ui/react";
|
|
3
|
+
|
|
4
|
+
import { getCategory } from "../../utils/componentCategories";
|
|
5
|
+
import VideoPlayer from "../VideoPlayer/VideoPlayer";
|
|
6
|
+
import {
|
|
7
|
+
VideoPlayerTypes,
|
|
8
|
+
VideoPlayerAspectRatios,
|
|
9
|
+
} from "../VideoPlayer/VideoPlayerTypes";
|
|
10
|
+
|
|
11
|
+
<Meta title={getCategory("Box")} component={Box} />
|
|
12
|
+
|
|
13
|
+
# Box
|
|
14
|
+
|
|
15
|
+
| Component Version | DS Version |
|
|
16
|
+
| ----------------- | ---------- |
|
|
17
|
+
| Added | `0.24.0` |
|
|
18
|
+
|
|
19
|
+
Note: This needs the use of the `DSProvider` component. See the [README](https://github.com/NYPL/nypl-design-system#using-the-design-system-in-your-product)
|
|
20
|
+
for more information.
|
|
21
|
+
|
|
22
|
+
This component is directly exported from Chakra UI. The `Box` is a simple and
|
|
23
|
+
composable component that can be used for many situations. By default it renders
|
|
24
|
+
a `div` but can render another element using the `as` prop.
|
|
25
|
+
|
|
26
|
+
All available props can be found on the [Style Props](https://chakra-ui.com/docs/features/style-props)
|
|
27
|
+
guide on the Chakra UI site.
|
|
28
|
+
|
|
29
|
+
<Canvas>
|
|
30
|
+
<Story
|
|
31
|
+
name="Box"
|
|
32
|
+
args={{
|
|
33
|
+
p: "5",
|
|
34
|
+
bg: "var(--brand-primary)",
|
|
35
|
+
color: "white",
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
{(args) => (
|
|
39
|
+
<Box {...args}>
|
|
40
|
+
So when I look up at the stars, I just wonder...what will they all
|
|
41
|
+
become someday?
|
|
42
|
+
</Box>
|
|
43
|
+
)}
|
|
44
|
+
</Story>
|
|
45
|
+
</Canvas>
|
|
46
|
+
|
|
47
|
+
## With VideoPlayer Component Example
|
|
48
|
+
|
|
49
|
+
<Canvas>
|
|
50
|
+
<Box borderWidth="3px" padding="6" borderRadius="lg" overflow="hidden">
|
|
51
|
+
<VideoPlayer
|
|
52
|
+
videoId="nm-dD2tx6bk"
|
|
53
|
+
videoType={VideoPlayerTypes.YouTube}
|
|
54
|
+
aspectRatio={VideoPlayerAspectRatios.SixteenByNine}
|
|
55
|
+
/>
|
|
56
|
+
</Box>
|
|
57
|
+
</Canvas>
|