@nypl/design-system-react-components 0.26.1 → 1.0.0
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 +54 -0
- package/README.md +7 -7
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -5
- package/dist/components/Button/Button.d.ts +2 -10
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
- package/dist/components/Card/Card.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.d.ts +10 -8
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/Form/Form.d.ts +2 -2
- package/dist/components/Grid/SimpleGrid.d.ts +6 -3
- package/dist/components/Heading/Heading.d.ts +2 -5
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +1 -5
- package/dist/components/Hero/Hero.d.ts +13 -9
- package/dist/components/Icons/Icon.d.ts +6 -5
- package/dist/components/Icons/IconSvgs.d.ts +21 -21
- package/dist/components/Image/Image.d.ts +8 -5
- package/dist/components/Link/Link.d.ts +1 -9
- package/dist/components/List/List.d.ts +7 -11
- package/dist/components/Logo/Logo.d.ts +2 -5
- package/dist/components/Logo/LogoSvgs.d.ts +39 -39
- package/dist/components/Modal/Modal.d.ts +28 -8
- package/dist/components/Notification/Notification.d.ts +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.d.ts +3 -2
- package/dist/components/Select/Select.d.ts +2 -5
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
- package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
- package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
- package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Template/Template.d.ts +2 -0
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +21 -9
- package/dist/components/Toggle/Toggle.d.ts +1 -5
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
- package/dist/design-system-react-components.cjs.development.js +983 -1222
- 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 +982 -1285
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/helpers/types.d.ts +1 -0
- package/dist/index.d.ts +27 -48
- package/dist/styles.css +1 -1
- package/dist/theme/components/buttonGroup.d.ts +11 -0
- package/dist/theme/components/card.d.ts +104 -8
- package/dist/theme/components/componentWrapper.d.ts +4 -3
- package/dist/theme/components/customTable.d.ts +11 -14
- package/dist/theme/components/fieldset.d.ts +4 -3
- package/dist/theme/components/helperErrorText.d.ts +4 -3
- package/dist/theme/components/hero.d.ts +1 -1
- package/dist/theme/components/horizontalRule.d.ts +4 -3
- package/dist/theme/components/icon.d.ts +47743 -1
- package/dist/theme/components/image.d.ts +563 -10
- package/dist/theme/components/label.d.ts +4 -3
- package/dist/theme/components/list.d.ts +6 -7
- package/dist/theme/components/logo.d.ts +474 -1
- package/dist/theme/components/notification.d.ts +20 -16
- package/dist/theme/components/progressIndicator.d.ts +6 -4
- package/dist/theme/components/select.d.ts +4 -10
- package/dist/theme/components/skeletonLoader.d.ts +14 -10
- package/dist/theme/components/skipNavigation.d.ts +22 -0
- package/dist/theme/components/slider.d.ts +7 -6
- package/dist/theme/components/structuredContent.d.ts +10 -9
- package/dist/theme/components/text.d.ts +7 -1
- package/dist/theme/components/toggle.d.ts +6 -4
- package/dist/theme/provider.d.ts +2 -4
- package/dist/utils/componentCategories.d.ts +1 -1
- package/dist/utils/interfaces.d.ts +5 -0
- package/dist/utils/utils.d.ts +2 -18
- package/package.json +15 -16
- package/src/__tests__/setup.ts +3 -3
- package/src/__tests__/utils/utils.test.ts +1 -23
- package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
- package/src/components/Accordion/Accordion.stories.mdx +43 -44
- package/src/components/Accordion/Accordion.test.tsx +5 -13
- package/src/components/Accordion/Accordion.tsx +14 -18
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
- package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
- package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
- package/src/components/Button/Button.stories.mdx +89 -126
- package/src/components/Button/Button.test.tsx +16 -30
- package/src/components/Button/Button.tsx +14 -20
- package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
- package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
- package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
- package/src/components/Card/Card.stories.mdx +144 -178
- package/src/components/Card/Card.test.tsx +36 -97
- package/src/components/Card/Card.tsx +78 -74
- package/src/components/Chakra/Box.stories.mdx +3 -7
- package/src/components/Chakra/Center.stories.mdx +6 -24
- package/src/components/Chakra/Flex.stories.mdx +5 -7
- package/src/components/Chakra/Grid.stories.mdx +1 -1
- package/src/components/Chakra/Stack.stories.mdx +10 -11
- package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
- package/src/components/Checkbox/Checkbox.test.tsx +2 -2
- package/src/components/Checkbox/Checkbox.tsx +20 -13
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +6 -17
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -7
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +33 -29
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -11
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +3 -10
- package/src/components/DatePicker/DatePicker.stories.mdx +23 -37
- package/src/components/DatePicker/DatePicker.test.tsx +21 -19
- package/src/components/DatePicker/DatePicker.tsx +57 -49
- package/src/components/Form/Form.stories.mdx +46 -31
- package/src/components/Form/Form.test.tsx +1 -18
- package/src/components/Form/Form.tsx +7 -7
- package/src/components/Grid/SimpleGrid.stories.mdx +73 -49
- package/src/components/Grid/SimpleGrid.test.tsx +7 -9
- package/src/components/Grid/SimpleGrid.tsx +14 -11
- package/src/components/Heading/Heading.stories.mdx +27 -72
- package/src/components/Heading/Heading.test.tsx +18 -44
- package/src/components/Heading/Heading.tsx +7 -10
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -3
- package/src/components/HelperErrorText/HelperErrorText.tsx +1 -5
- package/src/components/Hero/Hero.stories.mdx +219 -216
- package/src/components/Hero/Hero.test.tsx +107 -223
- package/src/components/Hero/Hero.tsx +63 -61
- package/src/components/Icons/Icon.stories.mdx +172 -118
- package/src/components/Icons/Icon.test.tsx +8 -16
- package/src/components/Icons/Icon.tsx +75 -29
- package/src/components/Icons/IconSvgs.tsx +42 -42
- package/src/components/Image/Image.stories.mdx +45 -132
- package/src/components/Image/Image.test.tsx +16 -31
- package/src/components/Image/Image.tsx +28 -12
- package/src/components/Link/Link.stories.mdx +30 -94
- package/src/components/Link/Link.test.tsx +25 -75
- package/src/components/Link/Link.tsx +43 -56
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +1 -2
- package/src/components/List/List.stories.mdx +20 -31
- package/src/components/List/List.test.tsx +24 -43
- package/src/components/List/List.tsx +25 -36
- package/src/components/Logo/Logo.stories.mdx +94 -50
- package/src/components/Logo/Logo.test.tsx +10 -19
- package/src/components/Logo/Logo.tsx +50 -17
- package/src/components/Logo/LogoSvgs.tsx +78 -78
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +4 -4
- package/src/components/Modal/Modal.stories.mdx +245 -139
- package/src/components/Modal/Modal.test.tsx +147 -10
- package/src/components/Modal/Modal.tsx +140 -20
- package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +25 -0
- package/src/components/Notification/Notification.stories.mdx +10 -28
- package/src/components/Notification/Notification.test.tsx +9 -12
- package/src/components/Notification/Notification.tsx +34 -37
- package/src/components/Pagination/Pagination.stories.mdx +3 -4
- package/src/components/Pagination/Pagination.tsx +15 -10
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +27 -53
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +9 -10
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -21
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -10
- package/src/components/Radio/Radio.stories.mdx +1 -1
- package/src/components/Radio/Radio.tsx +9 -6
- package/src/components/RadioGroup/RadioGroup.stories.mdx +15 -16
- package/src/components/RadioGroup/RadioGroup.test.tsx +2 -8
- package/src/components/RadioGroup/RadioGroup.tsx +28 -24
- package/src/components/SearchBar/SearchBar.stories.mdx +4 -4
- package/src/components/SearchBar/SearchBar.test.tsx +1 -1
- package/src/components/SearchBar/SearchBar.tsx +14 -22
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +1 -13
- package/src/components/Select/Select.stories.mdx +10 -25
- package/src/components/Select/Select.test.tsx +6 -7
- package/src/components/Select/Select.tsx +28 -35
- package/src/components/Select/__snapshots__/Select.test.tsx.snap +24 -24
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +17 -56
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -21
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +9 -8
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +33 -33
- package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
- package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
- package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
- package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
- package/src/components/Slider/Slider.stories.mdx +19 -53
- package/src/components/Slider/Slider.test.tsx +2 -2
- package/src/components/Slider/Slider.tsx +10 -12
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2 -9
- package/src/components/StatusBadge/StatusBadge.stories.mdx +6 -21
- package/src/components/StatusBadge/StatusBadge.test.tsx +2 -3
- package/src/components/StatusBadge/StatusBadge.tsx +3 -10
- package/src/components/StructuredContent/StructuredContent.stories.mdx +30 -58
- package/src/components/StructuredContent/StructuredContent.test.tsx +42 -44
- package/src/components/StructuredContent/StructuredContent.tsx +9 -18
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -23
- package/src/components/StyleGuide/Buttons.stories.mdx +63 -63
- package/src/components/StyleGuide/ColorCard.tsx +2 -4
- package/src/components/StyleGuide/Colors.stories.mdx +9 -10
- package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
- package/src/components/StyleGuide/Forms.stories.mdx +2 -2
- package/src/components/StyleGuide/Iconography.stories.mdx +60 -78
- package/src/components/StyleGuide/Spacing.stories.mdx +1 -2
- package/src/components/StyleGuide/Typography.stories.mdx +16 -19
- package/src/components/Table/Table.stories.mdx +85 -1
- package/src/components/Table/Table.test.tsx +57 -1
- package/src/components/Table/Table.tsx +7 -4
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +121 -0
- package/src/components/Tabs/Tabs.stories.mdx +1 -1
- package/src/components/Tabs/Tabs.test.tsx +2 -2
- package/src/components/Tabs/Tabs.tsx +26 -27
- package/src/components/Template/Template.stories.mdx +49 -54
- package/src/components/Template/Template.tsx +9 -3
- package/src/components/Text/Text.stories.mdx +5 -11
- package/src/components/Text/Text.test.tsx +3 -6
- package/src/components/Text/Text.tsx +3 -5
- package/src/components/TextInput/TextInput.stories.mdx +10 -22
- package/src/components/TextInput/TextInput.test.tsx +32 -62
- package/src/components/TextInput/TextInput.tsx +61 -30
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +1 -0
- package/src/components/Toggle/Toggle.stories.mdx +5 -16
- package/src/components/Toggle/Toggle.test.tsx +2 -3
- package/src/components/Toggle/Toggle.tsx +9 -10
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +13 -29
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -23
- package/src/components/VideoPlayer/VideoPlayer.tsx +13 -10
- package/src/docs/Chakra.stories.mdx +14 -11
- package/src/docs/Welcome.stories.mdx +23 -43
- package/src/helpers/types.ts +1 -0
- package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
- package/src/hooks/useNYPLTheme.stories.mdx +3 -6
- package/src/index.ts +52 -46
- package/src/styles.scss +0 -1
- package/src/theme/components/buttonGroup.ts +10 -0
- package/src/theme/components/card.ts +50 -15
- package/src/theme/components/componentWrapper.ts +5 -1
- package/src/theme/components/customTable.ts +8 -2
- package/src/theme/components/fieldset.ts +5 -1
- package/src/theme/components/helperErrorText.ts +5 -1
- package/src/theme/components/hero.ts +2 -2
- package/src/theme/components/horizontalRule.ts +5 -1
- package/src/theme/components/icon.ts +7 -1
- package/src/theme/components/image.ts +14 -3
- package/src/theme/components/label.ts +5 -1
- package/src/theme/components/list.ts +8 -2
- package/src/theme/components/logo.ts +5 -1
- package/src/theme/components/notification.ts +38 -14
- package/src/theme/components/progressIndicator.ts +10 -5
- package/src/theme/components/select.ts +5 -6
- package/src/theme/components/skeletonLoader.ts +8 -2
- package/src/theme/components/skipNavigation.ts +26 -0
- package/src/theme/components/slider.ts +13 -1
- package/src/theme/components/structuredContent.ts +11 -1
- package/src/theme/components/text.ts +12 -5
- package/src/theme/components/toggle.ts +9 -3
- package/src/theme/foundations/colors.ts +6 -9
- package/src/theme/index.ts +4 -0
- package/src/theme/provider.tsx +1 -1
- package/src/utils/componentCategories.ts +13 -5
- package/src/utils/interfaces.ts +5 -0
- package/src/utils/utils.ts +2 -32
- package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
- package/dist/components/Button/ButtonTypes.d.ts +0 -8
- package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
- package/dist/components/Form/FormTypes.d.ts +0 -2
- package/dist/components/Grid/GridTypes.d.ts +0 -9
- package/dist/components/Heading/HeadingTypes.d.ts +0 -14
- package/dist/components/Hero/HeroTypes.d.ts +0 -12
- package/dist/components/Icons/IconTypes.d.ts +0 -77
- package/dist/components/Image/ImageTypes.d.ts +0 -22
- package/dist/components/Link/LinkTypes.d.ts +0 -8
- package/dist/components/List/ListTypes.d.ts +0 -5
- package/dist/components/Logo/LogoTypes.d.ts +0 -54
- package/dist/components/Notification/NotificationTypes.d.ts +0 -5
- package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
- package/dist/components/Select/SelectTypes.d.ts +0 -8
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
- package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
- package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
- package/dist/components/Text/TextTypes.d.ts +0 -6
- package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
- package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
- package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
- package/dist/helpers/enums.d.ts +0 -4
- package/dist/utils/siteSections.d.ts +0 -2
- package/src/components/Accordion/AccordionTypes.tsx +0 -5
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
- package/src/components/Button/ButtonTypes.tsx +0 -8
- package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
- package/src/components/Form/FormTypes.tsx +0 -3
- package/src/components/Grid/GridTypes.tsx +0 -9
- package/src/components/Heading/HeadingTypes.tsx +0 -15
- package/src/components/Hero/HeroTypes.tsx +0 -20
- package/src/components/Icons/IconTypes.tsx +0 -83
- package/src/components/Image/ImageTypes.ts +0 -24
- package/src/components/Link/LinkTypes.tsx +0 -8
- package/src/components/List/ListTypes.tsx +0 -5
- package/src/components/Logo/LogoTypes.tsx +0 -56
- package/src/components/Modal/_Modal.scss +0 -18
- package/src/components/Notification/NotificationTypes.tsx +0 -5
- package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
- package/src/components/Select/SelectTypes.tsx +0 -10
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
- package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
- package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
- package/src/components/Text/TextTypes.tsx +0 -6
- package/src/components/TextInput/TextInputTypes.tsx +0 -48
- package/src/components/Toggle/ToggleTypes.tsx +0 -4
- package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
- package/src/helpers/enums.ts +0 -4
- package/src/utils/siteSections.ts +0 -10
|
@@ -4,11 +4,10 @@ import { axe } from "jest-axe";
|
|
|
4
4
|
import renderer from "react-test-renderer";
|
|
5
5
|
|
|
6
6
|
import Icon from "./Icon";
|
|
7
|
-
import { IconNames } from "./IconTypes";
|
|
8
7
|
|
|
9
8
|
describe("Icon Accessibility", () => {
|
|
10
9
|
it("passes axe accessibility test", async () => {
|
|
11
|
-
const { container } = render(<Icon name=
|
|
10
|
+
const { container } = render(<Icon name="download" />);
|
|
12
11
|
expect(await axe(container)).toHaveNoViolations();
|
|
13
12
|
});
|
|
14
13
|
});
|
|
@@ -17,7 +16,7 @@ describe("Icon", () => {
|
|
|
17
16
|
it("consoles a warning if both name and children are passed to Icon", () => {
|
|
18
17
|
const warn = jest.spyOn(console, "warn");
|
|
19
18
|
render(
|
|
20
|
-
<Icon name=
|
|
19
|
+
<Icon name="download" decorative={true}>
|
|
21
20
|
<svg viewBox="0 0 24 14" xmlns="http://www.w3.org/2000/svg">
|
|
22
21
|
<path
|
|
23
22
|
fillRule="evenodd"
|
|
@@ -52,7 +51,7 @@ describe("Icon", () => {
|
|
|
52
51
|
});
|
|
53
52
|
|
|
54
53
|
it("renders an icon based on the icon `name` prop", () => {
|
|
55
|
-
const { container } = render(<Icon name=
|
|
54
|
+
const { container } = render(<Icon name="download" />);
|
|
56
55
|
expect(container.querySelector("svg")).toBeInTheDocument();
|
|
57
56
|
});
|
|
58
57
|
|
|
@@ -61,13 +60,13 @@ describe("Icon", () => {
|
|
|
61
60
|
// In order to test this, we can check the `title` attribute in the svg
|
|
62
61
|
// element itself. Inspect the `Icon` in Storybook to see the `title` element.
|
|
63
62
|
it("renders a title element", () => {
|
|
64
|
-
const { container, rerender } = render(<Icon name=
|
|
63
|
+
const { container, rerender } = render(<Icon name="download" />);
|
|
65
64
|
expect(container.querySelector("svg")).toHaveAttribute(
|
|
66
65
|
"title",
|
|
67
66
|
"download icon"
|
|
68
67
|
);
|
|
69
68
|
|
|
70
|
-
rerender(<Icon name=
|
|
69
|
+
rerender(<Icon name="download" title="title content" />);
|
|
71
70
|
expect(container.querySelector("svg")).toHaveAttribute(
|
|
72
71
|
"title",
|
|
73
72
|
"title content"
|
|
@@ -90,9 +89,7 @@ describe("Icon", () => {
|
|
|
90
89
|
});
|
|
91
90
|
|
|
92
91
|
it("renders the UI snapshot correctly", () => {
|
|
93
|
-
const basic = renderer
|
|
94
|
-
.create(<Icon id="basic" name={IconNames.Download} />)
|
|
95
|
-
.toJSON();
|
|
92
|
+
const basic = renderer.create(<Icon id="basic" name="download" />).toJSON();
|
|
96
93
|
const customIcon = renderer
|
|
97
94
|
.create(
|
|
98
95
|
<Icon id="customIcon">
|
|
@@ -108,16 +105,11 @@ describe("Icon", () => {
|
|
|
108
105
|
.toJSON();
|
|
109
106
|
const withChakraProps = renderer
|
|
110
107
|
.create(
|
|
111
|
-
<Icon
|
|
112
|
-
id="chakra"
|
|
113
|
-
name={IconNames.Download}
|
|
114
|
-
p="20px"
|
|
115
|
-
color="ui.error.primary"
|
|
116
|
-
/>
|
|
108
|
+
<Icon id="chakra" name="download" p="20px" color="ui.error.primary" />
|
|
117
109
|
)
|
|
118
110
|
.toJSON();
|
|
119
111
|
const withOtherProps = renderer
|
|
120
|
-
.create(<Icon id="props" name=
|
|
112
|
+
.create(<Icon id="props" name="download" data-testid="props" />)
|
|
121
113
|
.toJSON();
|
|
122
114
|
|
|
123
115
|
expect(basic).toMatchSnapshot();
|
|
@@ -6,19 +6,76 @@ import {
|
|
|
6
6
|
} from "@chakra-ui/react";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
IconAlign,
|
|
11
|
-
IconColors,
|
|
12
|
-
IconNames,
|
|
13
|
-
IconRotationTypes,
|
|
14
|
-
IconSizes,
|
|
15
|
-
IconTypes,
|
|
16
|
-
} from "./IconTypes";
|
|
17
9
|
import iconSvgs from "./IconSvgs";
|
|
18
10
|
|
|
11
|
+
export type IconAlign = "left" | "right" | "none";
|
|
12
|
+
export type IconColors =
|
|
13
|
+
| "ui.black"
|
|
14
|
+
| "ui.white"
|
|
15
|
+
| "brand.primary"
|
|
16
|
+
| "brand.secondary"
|
|
17
|
+
| "section.blogs.primary"
|
|
18
|
+
| "section.blogs.secondary"
|
|
19
|
+
| "section.books-and-more.primary"
|
|
20
|
+
| "section.books-and-more.secondary"
|
|
21
|
+
| "section.education.primary"
|
|
22
|
+
| "section.education.secondary"
|
|
23
|
+
| "section.locations.primary"
|
|
24
|
+
| "section.locations.secondary"
|
|
25
|
+
| "section.research.primary"
|
|
26
|
+
| "section.research.secondary"
|
|
27
|
+
| "section.research-library.lpa"
|
|
28
|
+
| "section.research-library.schomburg"
|
|
29
|
+
| "section.research-library.schwartzman"
|
|
30
|
+
| "section.whats-on.primary"
|
|
31
|
+
| "section.whats-on.secondary";
|
|
32
|
+
export type IconNames =
|
|
33
|
+
| "accessibilityFull"
|
|
34
|
+
| "accessibilityPartial"
|
|
35
|
+
| "actionCheckCircle"
|
|
36
|
+
| "actionHelpDefault"
|
|
37
|
+
| "actionHelpOutline"
|
|
38
|
+
| "actionLaunch"
|
|
39
|
+
| "alertNotificationImportant"
|
|
40
|
+
| "arrow"
|
|
41
|
+
| "check"
|
|
42
|
+
| "clock"
|
|
43
|
+
| "close"
|
|
44
|
+
| "download"
|
|
45
|
+
| "errorFilled"
|
|
46
|
+
| "errorOutline"
|
|
47
|
+
| "fileTypeAudio"
|
|
48
|
+
| "fileTypeDoc"
|
|
49
|
+
| "fileTypeGenericDoc"
|
|
50
|
+
| "fileTypeImage"
|
|
51
|
+
| "fileTypePdf"
|
|
52
|
+
| "fileTypeSpreadsheet"
|
|
53
|
+
| "fileTypeVideo"
|
|
54
|
+
| "headset"
|
|
55
|
+
| "minus"
|
|
56
|
+
| "plus"
|
|
57
|
+
| "search"
|
|
58
|
+
| "speakerNotes"
|
|
59
|
+
| "utilityAccountFilled"
|
|
60
|
+
| "utilityAccountUnfilled"
|
|
61
|
+
| "utilityHamburger"
|
|
62
|
+
| "utilitySearch";
|
|
63
|
+
export type IconRotationTypes =
|
|
64
|
+
| "rotate0"
|
|
65
|
+
| "rotate90"
|
|
66
|
+
| "rotate180"
|
|
67
|
+
| "rotate270";
|
|
68
|
+
export type IconSizes =
|
|
69
|
+
| "default"
|
|
70
|
+
| "small"
|
|
71
|
+
| "medium"
|
|
72
|
+
| "large"
|
|
73
|
+
| "xlarge"
|
|
74
|
+
| "xxlarge"
|
|
75
|
+
| "xxxlarge";
|
|
76
|
+
export type IconTypes = "default" | "breadcrumbs";
|
|
77
|
+
|
|
19
78
|
export interface IconProps {
|
|
20
|
-
/** Optionally pass in additional Chakra-based styles. */
|
|
21
|
-
additionalStyles?: { [key: string]: any };
|
|
22
79
|
/** Aligns the icon. */
|
|
23
80
|
align?: IconAlign;
|
|
24
81
|
/** Optional className that will be added to the parent element */
|
|
@@ -50,18 +107,17 @@ export interface IconProps {
|
|
|
50
107
|
export const Icon = chakra(
|
|
51
108
|
(props: React.PropsWithChildren<IconProps>) => {
|
|
52
109
|
const {
|
|
53
|
-
|
|
54
|
-
align = IconAlign.None,
|
|
110
|
+
align = "none",
|
|
55
111
|
children,
|
|
56
112
|
className,
|
|
57
|
-
color =
|
|
113
|
+
color = "ui.black",
|
|
58
114
|
decorative = true,
|
|
59
|
-
iconRotation =
|
|
115
|
+
iconRotation = "rotate0",
|
|
60
116
|
id,
|
|
61
117
|
name,
|
|
62
|
-
size =
|
|
118
|
+
size = "default",
|
|
63
119
|
title = `${name} icon`,
|
|
64
|
-
type =
|
|
120
|
+
type = "default",
|
|
65
121
|
...rest
|
|
66
122
|
} = props;
|
|
67
123
|
const styles = useStyleConfig("Icon", {
|
|
@@ -101,13 +157,7 @@ export const Icon = chakra(
|
|
|
101
157
|
// render the SVG child with NYPL-theme styling.
|
|
102
158
|
if (name) {
|
|
103
159
|
const SvgComponent: any = iconSvgs[name];
|
|
104
|
-
return
|
|
105
|
-
<ChakraIcon
|
|
106
|
-
as={SvgComponent}
|
|
107
|
-
{...iconProps}
|
|
108
|
-
__css={{ ...styles, ...additionalStyles }}
|
|
109
|
-
/>
|
|
110
|
-
);
|
|
160
|
+
return <ChakraIcon as={SvgComponent} {...iconProps} __css={styles} />;
|
|
111
161
|
}
|
|
112
162
|
|
|
113
163
|
// If no `name` prop was passed, we expect a child SVG element to be passed.
|
|
@@ -127,14 +177,10 @@ export const Icon = chakra(
|
|
|
127
177
|
);
|
|
128
178
|
}
|
|
129
179
|
|
|
130
|
-
return
|
|
131
|
-
<Box __css={styles} {...rest}>
|
|
132
|
-
{childSVG}
|
|
133
|
-
</Box>
|
|
134
|
-
);
|
|
180
|
+
return <Box __css={styles}>{childSVG}</Box>;
|
|
135
181
|
},
|
|
136
182
|
// Pass all custom props to Chakra and override, e.g. we want the
|
|
137
|
-
// DS color
|
|
183
|
+
// DS color value set and not color strings.
|
|
138
184
|
{ shouldForwardProp: () => true }
|
|
139
185
|
);
|
|
140
186
|
|
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
2
|
+
import accessibilityFull from "../../../icons/svg/accessibility-full.svg";
|
|
3
|
+
import accessibilityPartial from "../../../icons/svg/accessibility-partial.svg";
|
|
4
|
+
import actionCheckCircle from "../../../icons/svg/action-check-circle.svg";
|
|
5
|
+
import actionHelpDefault from "../../../icons/svg/action-help-default.svg";
|
|
6
|
+
import actionHelpOutline from "../../../icons/svg/action-help-outline.svg";
|
|
7
|
+
import actionLaunch from "../../../icons/svg/action-launch.svg";
|
|
8
|
+
import alertNotificationImportant from "../../../icons/svg/alert-notification-important.svg";
|
|
9
9
|
import arrow from "../../../icons/svg/arrow.svg";
|
|
10
10
|
import check from "../../../icons/svg/check.svg";
|
|
11
11
|
import clock from "../../../icons/svg/clock.svg";
|
|
12
12
|
import close from "../../../icons/svg/close.svg";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
13
|
+
import fileTypeAudio from "../../../icons/svg/file-type-audio.svg";
|
|
14
|
+
import fileTypeDoc from "../../../icons/svg/file-type-doc.svg";
|
|
15
|
+
import fileTypeGenericDoc from "../../../icons/svg/file-type-generic-doc.svg";
|
|
16
|
+
import fileTypeImage from "../../../icons/svg/file-type-image.svg";
|
|
17
|
+
import fileTypePdf from "../../../icons/svg/file-type-pdf.svg";
|
|
18
|
+
import fileTypeSpreadsheet from "../../../icons/svg/file-type-spreadsheet.svg";
|
|
19
|
+
import fileTypeVideo from "../../../icons/svg/file-type-video.svg";
|
|
20
20
|
import download from "../../../icons/svg/download.svg";
|
|
21
|
-
import
|
|
22
|
-
import
|
|
21
|
+
import errorFilled from "../../../icons/svg/error-filled.svg";
|
|
22
|
+
import errorOutline from "../../../icons/svg/error-outline.svg";
|
|
23
23
|
import headset from "../../../icons/svg/headset.svg";
|
|
24
24
|
import minus from "../../../icons/svg/minus.svg";
|
|
25
25
|
import plus from "../../../icons/svg/plus.svg";
|
|
26
26
|
import search from "../../../icons/svg/search.svg";
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
27
|
+
import speakerNotes from "../../../icons/svg/speaker-notes.svg";
|
|
28
|
+
import utilityAccountFilled from "../../../icons/svg/utility-account-filled.svg";
|
|
29
|
+
import utilityAccountUnfilled from "../../../icons/svg/utility-account-unfilled.svg";
|
|
30
|
+
import utilityHamburger from "../../../icons/svg/utility-hamburger.svg";
|
|
31
|
+
import utilitySearch from "../../../icons/svg/search.svg";
|
|
32
32
|
|
|
33
33
|
export default {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
accessibilityFull,
|
|
35
|
+
accessibilityPartial,
|
|
36
|
+
actionCheckCircle,
|
|
37
|
+
actionHelpDefault,
|
|
38
|
+
actionHelpOutline,
|
|
39
|
+
actionLaunch,
|
|
40
|
+
alertNotificationImportant,
|
|
41
41
|
arrow,
|
|
42
42
|
check,
|
|
43
43
|
clock,
|
|
44
44
|
close,
|
|
45
45
|
download,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
errorFilled,
|
|
47
|
+
errorOutline,
|
|
48
|
+
fileTypeAudio,
|
|
49
|
+
fileTypeDoc,
|
|
50
|
+
fileTypeGenericDoc,
|
|
51
|
+
fileTypeImage,
|
|
52
|
+
fileTypePdf,
|
|
53
|
+
fileTypeSpreadsheet,
|
|
54
|
+
fileTypeVideo,
|
|
55
55
|
headset,
|
|
56
56
|
minus,
|
|
57
57
|
plus,
|
|
58
58
|
search,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
speakerNotes,
|
|
60
|
+
utilityAccountFilled,
|
|
61
|
+
utilityAccountUnfilled,
|
|
62
|
+
utilityHamburger,
|
|
63
|
+
utilitySearch,
|
|
64
64
|
};
|
|
@@ -9,19 +9,9 @@ import {
|
|
|
9
9
|
import { withDesign } from "storybook-addon-designs";
|
|
10
10
|
|
|
11
11
|
import Heading from "../Heading/Heading";
|
|
12
|
-
import { HeadingLevels } from "../Heading/HeadingTypes";
|
|
13
12
|
import Image from "./Image";
|
|
14
|
-
import { ImageRatios, ImageSizes, ImageTypes } from "./ImageTypes";
|
|
15
13
|
import SimpleGrid from "../Grid/SimpleGrid";
|
|
16
14
|
import { getCategory } from "../../utils/componentCategories";
|
|
17
|
-
import { getStorybookEnumValues } from "../../utils/utils";
|
|
18
|
-
|
|
19
|
-
export const ratiosEnumValues = getStorybookEnumValues(
|
|
20
|
-
ImageRatios,
|
|
21
|
-
"ImageRatios"
|
|
22
|
-
);
|
|
23
|
-
export const sizesEnumValues = getStorybookEnumValues(ImageSizes, "ImageSizes");
|
|
24
|
-
export const typesEnumValues = getStorybookEnumValues(ImageTypes, "ImageTypes");
|
|
25
15
|
|
|
26
16
|
export const imageBlockStyles = {
|
|
27
17
|
margin: "auto",
|
|
@@ -51,9 +41,7 @@ export const imageBlockStyles = {
|
|
|
51
41
|
"Alternate text description of the image. Needed for accessibility purposes.",
|
|
52
42
|
},
|
|
53
43
|
aspectRatio: {
|
|
54
|
-
|
|
55
|
-
table: { defaultValue: { summary: "ImageRatios.Original" } },
|
|
56
|
-
options: ratiosEnumValues.options,
|
|
44
|
+
table: { defaultValue: { summary: "original" } },
|
|
57
45
|
},
|
|
58
46
|
className: {
|
|
59
47
|
control: false,
|
|
@@ -61,14 +49,10 @@ export const imageBlockStyles = {
|
|
|
61
49
|
},
|
|
62
50
|
component: { control: false },
|
|
63
51
|
imageType: {
|
|
64
|
-
|
|
65
|
-
table: { defaultValue: { summary: "ImageTypes.Default" } },
|
|
66
|
-
options: typesEnumValues.options,
|
|
52
|
+
table: { defaultValue: { summary: "default" } },
|
|
67
53
|
},
|
|
68
54
|
size: {
|
|
69
|
-
|
|
70
|
-
table: { defaultValue: { summary: "ImageSizes.Default" } },
|
|
71
|
-
options: sizesEnumValues.options,
|
|
55
|
+
table: { defaultValue: { summary: "default" } },
|
|
72
56
|
},
|
|
73
57
|
src: {
|
|
74
58
|
description:
|
|
@@ -82,7 +66,7 @@ export const imageBlockStyles = {
|
|
|
82
66
|
| Component Version | DS Version |
|
|
83
67
|
| ----------------- | ---------- |
|
|
84
68
|
| Added | `0.0.6` |
|
|
85
|
-
| Latest | `0.
|
|
69
|
+
| Latest | `0.28.0` |
|
|
86
70
|
|
|
87
71
|
## Table of Contents
|
|
88
72
|
|
|
@@ -111,24 +95,17 @@ If you want a simple HTML `img` element then don't pass in values for the
|
|
|
111
95
|
additionalImageStyles: undefined,
|
|
112
96
|
additionalWrapperStyles: undefined,
|
|
113
97
|
alt: "Alt text",
|
|
114
|
-
aspectRatio: "
|
|
98
|
+
aspectRatio: "twoByOne",
|
|
115
99
|
caption: "Image caption",
|
|
116
100
|
className: undefined,
|
|
117
101
|
component: undefined,
|
|
118
102
|
credit: "Image credit",
|
|
119
|
-
imageType: "
|
|
120
|
-
size: "
|
|
103
|
+
imageType: "default",
|
|
104
|
+
size: "medium",
|
|
121
105
|
src: "https://placeimg.com/400/300/animals",
|
|
122
106
|
}}
|
|
123
107
|
>
|
|
124
|
-
{(args) =>
|
|
125
|
-
<Image
|
|
126
|
-
{...args}
|
|
127
|
-
aspectRatio={ratiosEnumValues.getValue(args.aspectRatio)}
|
|
128
|
-
imageType={typesEnumValues.getValue(args.imageType)}
|
|
129
|
-
size={sizesEnumValues.getValue(args.size)}
|
|
130
|
-
/>
|
|
131
|
-
)}
|
|
108
|
+
{(args) => <Image {...args} />}
|
|
132
109
|
</Story>
|
|
133
110
|
</Canvas>
|
|
134
111
|
|
|
@@ -158,11 +135,11 @@ then an `img` element will be rendered with or without wrapper style divs.
|
|
|
158
135
|
name="Figure and figcaption"
|
|
159
136
|
args={{
|
|
160
137
|
alt: "Alt text",
|
|
161
|
-
aspectRatio:
|
|
138
|
+
aspectRatio: "threeByTwo",
|
|
162
139
|
caption: "Image caption",
|
|
163
140
|
credit: "Image credit",
|
|
164
|
-
imageType:
|
|
165
|
-
size:
|
|
141
|
+
imageType: "default",
|
|
142
|
+
size: "medium",
|
|
166
143
|
src: "https://placeimg.com/400/300/animals",
|
|
167
144
|
}}
|
|
168
145
|
argTypes={{
|
|
@@ -186,76 +163,52 @@ Use the `size` prop to set the desired size with the `ImageSizes` enum.
|
|
|
186
163
|
<Story name="Image Sizes">
|
|
187
164
|
<SimpleGrid columns={1}>
|
|
188
165
|
<div style={{ textAlign: "center" }}>
|
|
189
|
-
<Heading
|
|
190
|
-
id="ExtraExtraSmall"
|
|
191
|
-
level={HeadingLevels.Four}
|
|
192
|
-
text="ImageSizes.ExtraExtraSmall"
|
|
193
|
-
/>
|
|
166
|
+
<Heading id="ExtraExtraSmall" level="four" text="xxsmall" />
|
|
194
167
|
<Image
|
|
195
168
|
alt="Alt text"
|
|
196
169
|
caption="64px"
|
|
197
|
-
size=
|
|
170
|
+
size="xxsmall"
|
|
198
171
|
src="https://placeimg.com/400/300/animals"
|
|
199
172
|
/>
|
|
200
173
|
</div>
|
|
201
174
|
<div style={{ textAlign: "center" }}>
|
|
202
|
-
<Heading
|
|
203
|
-
id="ExtraSmall"
|
|
204
|
-
level={HeadingLevels.Four}
|
|
205
|
-
text="ImageSizes.ExtraSmall"
|
|
206
|
-
/>
|
|
175
|
+
<Heading id="ExtraSmall" level="four" text="xsmall" />
|
|
207
176
|
<Image
|
|
208
177
|
alt="Alt text"
|
|
209
178
|
caption="96px"
|
|
210
|
-
size=
|
|
179
|
+
size="xsmall"
|
|
211
180
|
src="https://placeimg.com/400/300/animals"
|
|
212
181
|
/>
|
|
213
182
|
</div>
|
|
214
183
|
<div style={{ textAlign: "center" }}>
|
|
215
|
-
<Heading
|
|
216
|
-
id="Small"
|
|
217
|
-
level={HeadingLevels.Four}
|
|
218
|
-
text="ImageSizes.Small"
|
|
219
|
-
/>
|
|
184
|
+
<Heading id="Small" level="four" text="small" />
|
|
220
185
|
<Image
|
|
221
186
|
alt="Alt text"
|
|
222
187
|
caption="165px"
|
|
223
|
-
size=
|
|
188
|
+
size="small"
|
|
224
189
|
src="https://placeimg.com/400/300/animals"
|
|
225
190
|
/>
|
|
226
191
|
</div>
|
|
227
192
|
<div style={{ textAlign: "center" }}>
|
|
228
|
-
<Heading
|
|
229
|
-
id="Medium"
|
|
230
|
-
level={HeadingLevels.Four}
|
|
231
|
-
text="ImageSizes.Medium"
|
|
232
|
-
/>
|
|
193
|
+
<Heading id="Medium" level="four" text="medium" />
|
|
233
194
|
<Image
|
|
234
195
|
alt="Alt text"
|
|
235
196
|
caption="225px"
|
|
236
|
-
size=
|
|
197
|
+
size="medium"
|
|
237
198
|
src="https://placeimg.com/400/300/animals"
|
|
238
199
|
/>
|
|
239
200
|
</div>
|
|
240
201
|
<div style={{ textAlign: "center" }}>
|
|
241
|
-
<Heading
|
|
242
|
-
id="Large"
|
|
243
|
-
level={HeadingLevels.Four}
|
|
244
|
-
text="ImageSizes.Large"
|
|
245
|
-
/>
|
|
202
|
+
<Heading id="Large" level="four" text="large" />
|
|
246
203
|
<Image
|
|
247
204
|
alt="Alt text"
|
|
248
205
|
caption="360px"
|
|
249
|
-
size=
|
|
206
|
+
size="large"
|
|
250
207
|
src="https://placeimg.com/400/300/animals"
|
|
251
208
|
/>
|
|
252
209
|
</div>
|
|
253
210
|
<div style={{ textAlign: "center" }}>
|
|
254
|
-
<Heading
|
|
255
|
-
id="Default"
|
|
256
|
-
level={HeadingLevels.Four}
|
|
257
|
-
text="ImageSizes.Default"
|
|
258
|
-
/>
|
|
211
|
+
<Heading id="Default" level="four" text="default" />
|
|
259
212
|
<Image
|
|
260
213
|
alt="Alt text"
|
|
261
214
|
caption="100%"
|
|
@@ -278,98 +231,66 @@ in an element with a fixed width value.
|
|
|
278
231
|
<Story name="Image Aspect Ratios">
|
|
279
232
|
<SimpleGrid columns={1}>
|
|
280
233
|
<div style={imageBlockStyles}>
|
|
281
|
-
<Heading
|
|
282
|
-
id="fourbythree"
|
|
283
|
-
level={HeadingLevels.Four}
|
|
284
|
-
text="ImageRatios.FourByThree"
|
|
285
|
-
/>
|
|
234
|
+
<Heading id="fourbythree" level="four" text="fourByThree" />
|
|
286
235
|
<Image
|
|
287
236
|
alt="Alt text"
|
|
288
|
-
aspectRatio=
|
|
237
|
+
aspectRatio="fourByThree"
|
|
289
238
|
src="https://placeimg.com/400/300/animals"
|
|
290
239
|
/>
|
|
291
240
|
</div>
|
|
292
241
|
<div style={imageBlockStyles}>
|
|
293
|
-
<Heading
|
|
294
|
-
id="onebytwo"
|
|
295
|
-
level={HeadingLevels.Four}
|
|
296
|
-
text="ImageRatios.OneByTwo"
|
|
297
|
-
/>
|
|
242
|
+
<Heading id="onebytwo" level="four" text="oneByTwo" />
|
|
298
243
|
<Image
|
|
299
244
|
alt="Alt text"
|
|
300
|
-
aspectRatio=
|
|
245
|
+
aspectRatio="oneByTwo"
|
|
301
246
|
src="https://placeimg.com/400/300/animals"
|
|
302
247
|
/>
|
|
303
248
|
</div>
|
|
304
249
|
<div style={imageBlockStyles}>
|
|
305
|
-
<Heading
|
|
306
|
-
id="original"
|
|
307
|
-
level={HeadingLevels.Four}
|
|
308
|
-
text="ImageRatios.Original"
|
|
309
|
-
/>
|
|
250
|
+
<Heading id="original" level="four" text="original" />
|
|
310
251
|
<Image
|
|
311
252
|
alt="Alt text"
|
|
312
|
-
aspectRatio=
|
|
253
|
+
aspectRatio="original"
|
|
313
254
|
src="https://placeimg.com/400/300/animals"
|
|
314
255
|
/>
|
|
315
256
|
</div>
|
|
316
257
|
<div style={imageBlockStyles}>
|
|
317
|
-
<Heading
|
|
318
|
-
id="sixteenbynine"
|
|
319
|
-
level={HeadingLevels.Four}
|
|
320
|
-
text="ImageRatios.SixteenByNine"
|
|
321
|
-
/>
|
|
258
|
+
<Heading id="sixteenbynine" level="four" text="sixteenByNine" />
|
|
322
259
|
<Image
|
|
323
260
|
alt="Alt text"
|
|
324
|
-
aspectRatio=
|
|
261
|
+
aspectRatio="sixteenByNine"
|
|
325
262
|
src="https://placeimg.com/400/300/animals"
|
|
326
263
|
/>
|
|
327
264
|
</div>
|
|
328
265
|
<div style={imageBlockStyles}>
|
|
329
|
-
<Heading
|
|
330
|
-
id="square"
|
|
331
|
-
level={HeadingLevels.Four}
|
|
332
|
-
text="ImageRatios.Square"
|
|
333
|
-
/>
|
|
266
|
+
<Heading id="square" level="four" text="square" />
|
|
334
267
|
<Image
|
|
335
268
|
alt="Alt text"
|
|
336
|
-
aspectRatio=
|
|
269
|
+
aspectRatio="square"
|
|
337
270
|
src="https://placeimg.com/400/300/animals"
|
|
338
271
|
/>
|
|
339
272
|
</div>
|
|
340
273
|
<div style={imageBlockStyles}>
|
|
341
|
-
<Heading
|
|
342
|
-
id="threebyfour"
|
|
343
|
-
level={HeadingLevels.Four}
|
|
344
|
-
text="ImageRatios.ThreeByFour"
|
|
345
|
-
/>
|
|
274
|
+
<Heading id="threebyfour" level="four" text="threeByFour" />
|
|
346
275
|
<Image
|
|
347
276
|
alt="Alt text"
|
|
348
|
-
aspectRatio=
|
|
277
|
+
aspectRatio="threeByFour"
|
|
349
278
|
src="https://placeimg.com/400/300/animals"
|
|
350
279
|
/>
|
|
351
280
|
</div>
|
|
352
281
|
<div style={imageBlockStyles}>
|
|
353
|
-
<Heading
|
|
354
|
-
id="threebytwo"
|
|
355
|
-
level={HeadingLevels.Four}
|
|
356
|
-
text="ImageRatios.ThreeByTwo"
|
|
357
|
-
/>
|
|
282
|
+
<Heading id="threebytwo" level="four" text="threeByTwo" />
|
|
358
283
|
<Image
|
|
359
284
|
alt="Alt text"
|
|
360
|
-
aspectRatio=
|
|
285
|
+
aspectRatio="threeByTwo"
|
|
361
286
|
src="https://placeimg.com/400/300/animals"
|
|
362
287
|
/>
|
|
363
288
|
</div>
|
|
364
289
|
<div style={imageBlockStyles}>
|
|
365
|
-
<Heading
|
|
366
|
-
id="twobyone"
|
|
367
|
-
level={HeadingLevels.Four}
|
|
368
|
-
text="ImageRatios.TwoByOne"
|
|
369
|
-
/>
|
|
290
|
+
<Heading id="twobyone" level="four" text="twoByOne" />
|
|
370
291
|
<Image
|
|
371
292
|
alt="Alt text"
|
|
372
|
-
aspectRatio=
|
|
293
|
+
aspectRatio="twoByOne"
|
|
373
294
|
src="https://placeimg.com/400/300/animals"
|
|
374
295
|
/>
|
|
375
296
|
</div>
|
|
@@ -380,7 +301,7 @@ in an element with a fixed width value.
|
|
|
380
301
|
## Image Types
|
|
381
302
|
|
|
382
303
|
Use the `imageType` prop to get an image variant. Note that to get a perfect
|
|
383
|
-
circle, the `aspectRatio` prop _must_ be set to `
|
|
304
|
+
circle, the `aspectRatio` prop _must_ be set to `"square"`.
|
|
384
305
|
|
|
385
306
|
For a better viewing experience, the `Image` components below have been wrapped
|
|
386
307
|
in an element with a fixed width value.
|
|
@@ -389,28 +310,20 @@ in an element with a fixed width value.
|
|
|
389
310
|
<Story name="Image Types">
|
|
390
311
|
<SimpleGrid columns={1}>
|
|
391
312
|
<div style={imageBlockStyles}>
|
|
392
|
-
<Heading
|
|
393
|
-
id="default"
|
|
394
|
-
level={HeadingLevels.Four}
|
|
395
|
-
text="ImageTypes.Default"
|
|
396
|
-
/>
|
|
313
|
+
<Heading id="default" level="four" text="default" />
|
|
397
314
|
<Image
|
|
398
315
|
alt="Alt text"
|
|
399
|
-
aspectRatio=
|
|
400
|
-
imageType=
|
|
316
|
+
aspectRatio="square"
|
|
317
|
+
imageType="default"
|
|
401
318
|
src="https://placeimg.com/400/400/animals"
|
|
402
319
|
/>
|
|
403
320
|
</div>
|
|
404
321
|
<div style={imageBlockStyles}>
|
|
405
|
-
<Heading
|
|
406
|
-
id="circle"
|
|
407
|
-
level={HeadingLevels.Four}
|
|
408
|
-
text="ImageTypes.Circle"
|
|
409
|
-
/>
|
|
322
|
+
<Heading id="circle" level="four" text="circle" />
|
|
410
323
|
<Image
|
|
411
324
|
alt="Alt text"
|
|
412
|
-
aspectRatio=
|
|
413
|
-
imageType=
|
|
325
|
+
aspectRatio="square"
|
|
326
|
+
imageType="circle"
|
|
414
327
|
src="https://placeimg.com/400/400/animals"
|
|
415
328
|
/>
|
|
416
329
|
</div>
|