@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.
Files changed (296) hide show
  1. package/README.md +3 -5
  2. package/dist/components/Checkbox/Checkbox.d.ts +0 -1
  3. package/dist/components/ComponentWrapper/ComponentWrapper.d.ts +8 -0
  4. package/dist/components/Heading/Heading.d.ts +2 -0
  5. package/dist/components/Logo/Logo.d.ts +1 -1
  6. package/dist/components/Logo/LogoSvgs.d.ts +4 -0
  7. package/dist/components/Slider/Slider.d.ts +1 -2
  8. package/dist/components/TextInput/TextInput.d.ts +2 -1
  9. package/dist/design-system-react-components.cjs.development.js +1038 -674
  10. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  11. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  12. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  13. package/dist/design-system-react-components.esm.js +1039 -675
  14. package/dist/design-system-react-components.esm.js.map +1 -1
  15. package/dist/hooks/{tests → __tests__}/useCarouselStyles.test.d.ts +0 -0
  16. package/dist/theme/components/button.d.ts +1 -0
  17. package/dist/theme/components/card.d.ts +98 -13
  18. package/dist/theme/components/checkboxGroup.d.ts +1 -1
  19. package/dist/theme/components/global.d.ts +2 -2
  20. package/dist/theme/components/heading.d.ts +4 -16
  21. package/dist/theme/components/image.d.ts +6 -0
  22. package/dist/theme/components/radio.d.ts +8 -0
  23. package/dist/theme/components/radioGroup.d.ts +1 -1
  24. package/dist/theme/components/skipNavigation.d.ts +3 -0
  25. package/dist/theme/components/structuredContent.d.ts +0 -5
  26. package/dist/theme/components/template.d.ts +4 -1
  27. package/dist/utils/utils.d.ts +15 -0
  28. package/package.json +6 -7
  29. package/CHANGELOG.md +0 -1399
  30. package/src/__tests__/fileMock.ts +0 -6
  31. package/src/__tests__/setup.ts +0 -27
  32. package/src/__tests__/utils/utils.test.ts +0 -18
  33. package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +0 -42
  34. package/src/components/Accordion/Accordion.stories.mdx +0 -361
  35. package/src/components/Accordion/Accordion.test.tsx +0 -237
  36. package/src/components/Accordion/Accordion.tsx +0 -136
  37. package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +0 -734
  38. package/src/components/Autosuggest/Autosuggest.stories.mdx +0 -75
  39. package/src/components/Autosuggest/Autosuggest.stories.tsx +0 -211
  40. package/src/components/Autosuggest/_Autosuggest.scss +0 -51
  41. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +0 -231
  42. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +0 -144
  43. package/src/components/Breadcrumbs/Breadcrumbs.tsx +0 -98
  44. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +0 -695
  45. package/src/components/Button/Button.stories.mdx +0 -320
  46. package/src/components/Button/Button.test.tsx +0 -184
  47. package/src/components/Button/Button.tsx +0 -95
  48. package/src/components/Button/__snapshots__/Button.test.tsx.snap +0 -106
  49. package/src/components/ButtonGroup/ButtonGroup.stories.mdx +0 -147
  50. package/src/components/ButtonGroup/ButtonGroup.test.tsx +0 -141
  51. package/src/components/ButtonGroup/ButtonGroup.tsx +0 -99
  52. package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +0 -117
  53. package/src/components/Card/Card.stories.mdx +0 -1043
  54. package/src/components/Card/Card.test.tsx +0 -388
  55. package/src/components/Card/Card.tsx +0 -345
  56. package/src/components/Card/__snapshots__/Card.test.tsx.snap +0 -568
  57. package/src/components/Chakra/Box.stories.mdx +0 -52
  58. package/src/components/Chakra/Center.stories.mdx +0 -96
  59. package/src/components/Chakra/Flex.stories.mdx +0 -111
  60. package/src/components/Chakra/Grid.stories.mdx +0 -89
  61. package/src/components/Chakra/Stack.stories.mdx +0 -109
  62. package/src/components/Checkbox/Checkbox.stories.mdx +0 -243
  63. package/src/components/Checkbox/Checkbox.test.tsx +0 -319
  64. package/src/components/Checkbox/Checkbox.tsx +0 -166
  65. package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +0 -616
  66. package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +0 -462
  67. package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +0 -492
  68. package/src/components/CheckboxGroup/CheckboxGroup.tsx +0 -173
  69. package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -1722
  70. package/src/components/ComponentWrapper/ComponentWrapper.test.tsx +0 -163
  71. package/src/components/ComponentWrapper/ComponentWrapper.tsx +0 -67
  72. package/src/components/ComponentWrapper/__snapshots__/ComponentWrapper.test.tsx.snap +0 -98
  73. package/src/components/DatePicker/DatePicker.stories.mdx +0 -452
  74. package/src/components/DatePicker/DatePicker.test.tsx +0 -940
  75. package/src/components/DatePicker/DatePicker.tsx +0 -450
  76. package/src/components/DatePicker/_DatePicker.scss +0 -100
  77. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +0 -889
  78. package/src/components/Fieldset/Fieldset.stories.mdx +0 -96
  79. package/src/components/Fieldset/Fieldset.test.tsx +0 -155
  80. package/src/components/Fieldset/Fieldset.tsx +0 -55
  81. package/src/components/Fieldset/__snapshots__/Fieldset.test.tsx.snap +0 -89
  82. package/src/components/Form/Form.stories.mdx +0 -426
  83. package/src/components/Form/Form.test.tsx +0 -234
  84. package/src/components/Form/Form.tsx +0 -124
  85. package/src/components/Form/__snapshots__/Form.test.tsx.snap +0 -115
  86. package/src/components/Grid/SimpleGrid.stories.mdx +0 -338
  87. package/src/components/Grid/SimpleGrid.test.tsx +0 -79
  88. package/src/components/Grid/SimpleGrid.tsx +0 -49
  89. package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +0 -23
  90. package/src/components/Heading/Heading.stories.mdx +0 -184
  91. package/src/components/Heading/Heading.test.tsx +0 -171
  92. package/src/components/Heading/Heading.tsx +0 -101
  93. package/src/components/Heading/__snapshots__/Heading.test.tsx.snap +0 -90
  94. package/src/components/HelperErrorText/HelperErrorText.stories.mdx +0 -172
  95. package/src/components/HelperErrorText/HelperErrorText.test.tsx +0 -114
  96. package/src/components/HelperErrorText/HelperErrorText.tsx +0 -62
  97. package/src/components/HelperErrorText/__snapshots__/HelperErrorText.test.tsx.snap +0 -93
  98. package/src/components/Hero/Hero.stories.mdx +0 -378
  99. package/src/components/Hero/Hero.test.tsx +0 -611
  100. package/src/components/Hero/Hero.tsx +0 -203
  101. package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +0 -379
  102. package/src/components/HorizontalRule/HorizontalRule.stories.mdx +0 -73
  103. package/src/components/HorizontalRule/HorizontalRule.test.tsx +0 -54
  104. package/src/components/HorizontalRule/HorizontalRule.tsx +0 -27
  105. package/src/components/HorizontalRule/__snapshots__/HorizontalRule.test.tsx.snap +0 -44
  106. package/src/components/Icons/Icon.stories.mdx +0 -413
  107. package/src/components/Icons/Icon.test.tsx +0 -120
  108. package/src/components/Icons/Icon.tsx +0 -187
  109. package/src/components/Icons/IconSvgs.tsx +0 -64
  110. package/src/components/Icons/__snapshots__/Icon.test.tsx.snap +0 -129
  111. package/src/components/Image/Image.stories.mdx +0 -332
  112. package/src/components/Image/Image.test.tsx +0 -155
  113. package/src/components/Image/Image.tsx +0 -171
  114. package/src/components/Image/__snapshots__/Image.test.tsx.snap +0 -269
  115. package/src/components/Label/Label.stories.mdx +0 -100
  116. package/src/components/Label/Label.test.tsx +0 -116
  117. package/src/components/Label/Label.tsx +0 -55
  118. package/src/components/Label/__snapshots__/Label.test.tsx.snap +0 -45
  119. package/src/components/Link/Link.stories.mdx +0 -249
  120. package/src/components/Link/Link.test.tsx +0 -224
  121. package/src/components/Link/Link.tsx +0 -178
  122. package/src/components/Link/__snapshots__/Link.test.tsx.snap +0 -286
  123. package/src/components/List/List.stories.mdx +0 -393
  124. package/src/components/List/List.test.tsx +0 -265
  125. package/src/components/List/List.tsx +0 -156
  126. package/src/components/List/__snapshots__/List.test.tsx.snap +0 -213
  127. package/src/components/Logo/Logo.stories.mdx +0 -290
  128. package/src/components/Logo/Logo.test.tsx +0 -116
  129. package/src/components/Logo/Logo.tsx +0 -147
  130. package/src/components/Logo/LogoSvgs.tsx +0 -82
  131. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +0 -142
  132. package/src/components/Modal/Modal.stories.mdx +0 -301
  133. package/src/components/Modal/Modal.test.tsx +0 -157
  134. package/src/components/Modal/Modal.tsx +0 -154
  135. package/src/components/Modal/__snapshots__/Modal.test.tsx.snap +0 -25
  136. package/src/components/Notification/Notification.stories.mdx +0 -358
  137. package/src/components/Notification/Notification.test.tsx +0 -279
  138. package/src/components/Notification/Notification.tsx +0 -224
  139. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +0 -525
  140. package/src/components/Pagination/Pagination.stories.mdx +0 -184
  141. package/src/components/Pagination/Pagination.test.tsx +0 -419
  142. package/src/components/Pagination/Pagination.tsx +0 -269
  143. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +0 -544
  144. package/src/components/Placeholder/Placeholder.tsx +0 -19
  145. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +0 -360
  146. package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +0 -298
  147. package/src/components/ProgressIndicator/ProgressIndicator.tsx +0 -132
  148. package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -434
  149. package/src/components/Radio/Radio.stories.mdx +0 -216
  150. package/src/components/Radio/Radio.test.tsx +0 -247
  151. package/src/components/Radio/Radio.tsx +0 -128
  152. package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +0 -411
  153. package/src/components/RadioGroup/RadioGroup.stories.mdx +0 -478
  154. package/src/components/RadioGroup/RadioGroup.test.tsx +0 -471
  155. package/src/components/RadioGroup/RadioGroup.tsx +0 -170
  156. package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +0 -1430
  157. package/src/components/SearchBar/SearchBar.stories.mdx +0 -518
  158. package/src/components/SearchBar/SearchBar.test.tsx +0 -435
  159. package/src/components/SearchBar/SearchBar.tsx +0 -210
  160. package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +0 -1027
  161. package/src/components/Select/Select.stories.mdx +0 -439
  162. package/src/components/Select/Select.test.tsx +0 -358
  163. package/src/components/Select/Select.tsx +0 -181
  164. package/src/components/Select/__snapshots__/Select.test.tsx.snap +0 -885
  165. package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +0 -142
  166. package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +0 -116
  167. package/src/components/SkeletonLoader/SkeletonLoader.tsx +0 -123
  168. package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +0 -898
  169. package/src/components/SkipNavigation/SkipNavigation.stories.mdx +0 -90
  170. package/src/components/SkipNavigation/SkipNavigation.test.tsx +0 -63
  171. package/src/components/SkipNavigation/SkipNavigation.tsx +0 -51
  172. package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +0 -130
  173. package/src/components/Slider/Slider.stories.mdx +0 -628
  174. package/src/components/Slider/Slider.test.tsx +0 -736
  175. package/src/components/Slider/Slider.tsx +0 -322
  176. package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +0 -2153
  177. package/src/components/StatusBadge/StatusBadge.stories.mdx +0 -109
  178. package/src/components/StatusBadge/StatusBadge.test.tsx +0 -70
  179. package/src/components/StatusBadge/StatusBadge.tsx +0 -35
  180. package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +0 -47
  181. package/src/components/StructuredContent/StructuredContent.stories.mdx +0 -567
  182. package/src/components/StructuredContent/StructuredContent.test.tsx +0 -435
  183. package/src/components/StructuredContent/StructuredContent.tsx +0 -139
  184. package/src/components/StructuredContent/__snapshots__/StructuredContent.test.tsx.snap +0 -368
  185. package/src/components/StyleGuide/Bidirectionality.stories.mdx +0 -206
  186. package/src/components/StyleGuide/Breakpoints.stories.mdx +0 -55
  187. package/src/components/StyleGuide/Buttons.stories.mdx +0 -194
  188. package/src/components/StyleGuide/ColorCard.tsx +0 -43
  189. package/src/components/StyleGuide/Colors.stories.mdx +0 -201
  190. package/src/components/StyleGuide/DesignTokens.stories.mdx +0 -193
  191. package/src/components/StyleGuide/Forms.stories.mdx +0 -94
  192. package/src/components/StyleGuide/Iconography.stories.mdx +0 -142
  193. package/src/components/StyleGuide/Spacing.stories.mdx +0 -116
  194. package/src/components/StyleGuide/Typography.stories.mdx +0 -419
  195. package/src/components/Table/Table.stories.mdx +0 -276
  196. package/src/components/Table/Table.test.tsx +0 -208
  197. package/src/components/Table/Table.tsx +0 -131
  198. package/src/components/Table/__snapshots__/Table.test.tsx.snap +0 -1703
  199. package/src/components/Tabs/Tabs.stories.mdx +0 -338
  200. package/src/components/Tabs/Tabs.test.tsx +0 -298
  201. package/src/components/Tabs/Tabs.tsx +0 -264
  202. package/src/components/Tabs/__snapshots__/Tabs.test.tsx.snap +0 -584
  203. package/src/components/Template/Template.stories.mdx +0 -691
  204. package/src/components/Template/Template.test.tsx +0 -309
  205. package/src/components/Template/Template.tsx +0 -326
  206. package/src/components/Template/__snapshots__/Template.test.tsx.snap +0 -342
  207. package/src/components/Text/Text.stories.mdx +0 -103
  208. package/src/components/Text/Text.test.tsx +0 -63
  209. package/src/components/Text/Text.tsx +0 -50
  210. package/src/components/Text/__snapshots__/Text.test.tsx.snap +0 -50
  211. package/src/components/TextInput/TextInput.stories.mdx +0 -268
  212. package/src/components/TextInput/TextInput.test.tsx +0 -451
  213. package/src/components/TextInput/TextInput.tsx +0 -240
  214. package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +0 -264
  215. package/src/components/Toggle/Toggle.stories.mdx +0 -237
  216. package/src/components/Toggle/Toggle.test.tsx +0 -170
  217. package/src/components/Toggle/Toggle.tsx +0 -126
  218. package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +0 -442
  219. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +0 -211
  220. package/src/components/VideoPlayer/VideoPlayer.test.tsx +0 -308
  221. package/src/components/VideoPlayer/VideoPlayer.tsx +0 -188
  222. package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +0 -187
  223. package/src/docs/Chakra.stories.mdx +0 -563
  224. package/src/docs/Welcome.stories.mdx +0 -148
  225. package/src/helpers/types.ts +0 -1
  226. package/src/hooks/tests/useCarouselStyles.test.ts +0 -140
  227. package/src/hooks/tests/useNYPLTheme.test.tsx +0 -36
  228. package/src/hooks/useCarouselStyles.stories.mdx +0 -30
  229. package/src/hooks/useCarouselStyles.ts +0 -35
  230. package/src/hooks/useNYPLTheme.stories.mdx +0 -98
  231. package/src/hooks/useNYPLTheme.ts +0 -91
  232. package/src/hooks/useWindowSize.stories.mdx +0 -23
  233. package/src/hooks/useWindowSize.ts +0 -40
  234. package/src/index.ts +0 -136
  235. package/src/resources.scss +0 -6
  236. package/src/styles/base/_01-breakpoints.scss +0 -27
  237. package/src/styles/base/_02-mixins.scss +0 -103
  238. package/src/styles/base/_place-holder.scss +0 -33
  239. package/src/styles/space/_space-inline.scss +0 -79
  240. package/src/styles/space/_space-inset.scss +0 -57
  241. package/src/styles/space/_space-stack.scss +0 -116
  242. package/src/styles.scss +0 -23
  243. package/src/theme/components/accordion.ts +0 -25
  244. package/src/theme/components/breadcrumb.ts +0 -94
  245. package/src/theme/components/button.ts +0 -132
  246. package/src/theme/components/buttonGroup.ts +0 -10
  247. package/src/theme/components/card.ts +0 -231
  248. package/src/theme/components/checkbox.ts +0 -110
  249. package/src/theme/components/checkboxGroup.ts +0 -10
  250. package/src/theme/components/componentWrapper.ts +0 -14
  251. package/src/theme/components/customTable.ts +0 -77
  252. package/src/theme/components/datePicker.ts +0 -17
  253. package/src/theme/components/fieldset.ts +0 -23
  254. package/src/theme/components/global.ts +0 -91
  255. package/src/theme/components/globalMixins.ts +0 -24
  256. package/src/theme/components/heading.ts +0 -79
  257. package/src/theme/components/helperErrorText.ts +0 -14
  258. package/src/theme/components/hero.ts +0 -238
  259. package/src/theme/components/horizontalRule.ts +0 -17
  260. package/src/theme/components/icon.ts +0 -88
  261. package/src/theme/components/image.ts +0 -135
  262. package/src/theme/components/label.ts +0 -15
  263. package/src/theme/components/link.ts +0 -63
  264. package/src/theme/components/list.ts +0 -88
  265. package/src/theme/components/logo.ts +0 -58
  266. package/src/theme/components/notification.ts +0 -132
  267. package/src/theme/components/pagination.ts +0 -17
  268. package/src/theme/components/progressIndicator.ts +0 -67
  269. package/src/theme/components/radio.ts +0 -103
  270. package/src/theme/components/radioGroup.ts +0 -10
  271. package/src/theme/components/searchBar.ts +0 -19
  272. package/src/theme/components/select.ts +0 -72
  273. package/src/theme/components/skeletonLoader.ts +0 -113
  274. package/src/theme/components/skipNavigation.ts +0 -26
  275. package/src/theme/components/slider.ts +0 -95
  276. package/src/theme/components/statusBadge.ts +0 -26
  277. package/src/theme/components/structuredContent.ts +0 -149
  278. package/src/theme/components/tabs.ts +0 -109
  279. package/src/theme/components/template.ts +0 -114
  280. package/src/theme/components/text.ts +0 -38
  281. package/src/theme/components/textInput.ts +0 -65
  282. package/src/theme/components/toggle.ts +0 -109
  283. package/src/theme/components/videoPlayer.ts +0 -47
  284. package/src/theme/foundations/breakpoints.ts +0 -24
  285. package/src/theme/foundations/colors.ts +0 -212
  286. package/src/theme/foundations/global.ts +0 -43
  287. package/src/theme/foundations/radii.ts +0 -7
  288. package/src/theme/foundations/shadows.ts +0 -5
  289. package/src/theme/foundations/spacing.ts +0 -136
  290. package/src/theme/foundations/typography.ts +0 -107
  291. package/src/theme/index.ts +0 -131
  292. package/src/theme/provider.tsx +0 -9
  293. package/src/theme/types.ts +0 -1
  294. package/src/utils/componentCategories.ts +0 -152
  295. package/src/utils/interfaces.ts +0 -5
  296. package/src/utils/utils.ts +0 -44
@@ -1,290 +0,0 @@
1
- import {
2
- ArgsTable,
3
- Canvas,
4
- Description,
5
- Meta,
6
- Story,
7
- } from "@storybook/addon-docs";
8
- import { withDesign } from "storybook-addon-designs";
9
-
10
- import Logo from "./Logo";
11
- import logoSvgs from "./LogoSvgs";
12
- import Heading from "../Heading/Heading";
13
- import List from "../List/List";
14
- import SimpleGrid from "../Grid/SimpleGrid";
15
- import { getCategory } from "../../utils/componentCategories";
16
-
17
- <Meta
18
- title={getCategory("Logo")}
19
- component={Logo}
20
- decorators={[withDesign]}
21
- parameters={{
22
- design: {
23
- type: "figma",
24
- url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=10734%3A3945",
25
- },
26
- jest: ["Logo.test.tsx"],
27
- }}
28
- argTypes={{
29
- children: { table: { disable: true } },
30
- className: { control: false },
31
- id: { control: false },
32
- size: {
33
- table: { defaultValue: { summary: "medium" } },
34
- },
35
- title: {
36
- control: false,
37
- table: { defaultValue: { summary: "`${name} logo`" } },
38
- },
39
- }}
40
- />
41
-
42
- # Logo
43
-
44
- | Component Version | DS Version |
45
- | ----------------- | ---------- |
46
- | Added | `0.25.9` |
47
- | Latest | `0.28.0` |
48
-
49
- ## Table of Contents
50
-
51
- - [Overview](#overview)
52
- - [Component Props](#component-props)
53
- - [Accessibility](#accessibility)
54
- - [Logo Sizes](#logo-sizes)
55
- - [All Logos](#all-logos)
56
- - [Custom Logos](#custom-logos)
57
-
58
- ## Overview
59
-
60
- <Description of={Logo} />
61
-
62
- ## Component Props
63
-
64
- <Canvas withToolbar>
65
- <Story
66
- name="Logo with Controls"
67
- args={{
68
- className: undefined,
69
- decorative: true,
70
- id: "logo-id",
71
- name: "nyplFullBlack",
72
- size: "large",
73
- title: undefined,
74
- }}
75
- >
76
- {(args) => (
77
- <div
78
- style={
79
- args.name.indexOf("white") !== -1 ||
80
- args.name.indexOf("negative") !== -1
81
- ? {
82
- backgroundColor: "var(--nypl-colors-ui-gray-xdark)",
83
- display: "inline-block",
84
- padding: "var(--nypl-space-l)",
85
- width: "100%",
86
- }
87
- : undefined
88
- }
89
- >
90
- <Logo {...args} />
91
- </div>
92
- )}
93
- </Story>
94
- </Canvas>
95
-
96
- <ArgsTable story="Logo with Controls" />
97
-
98
- export const logoRow = (logo, opts = {}) => {
99
- // We'll use this setup function to render all the logos in a list item.
100
- // Some logos display better with a dark background.
101
- const styles = { textAlign: "center" };
102
- const { size = "large", displayValue } = opts;
103
- let key = logo;
104
- if (logo.indexOf("White") !== -1 || logo.indexOf("Negative") !== -1) {
105
- styles.backgroundColor = "var(--nypl-colors-ui-gray-xdark)";
106
- styles.color = "var(--nypl-colors-ui-white)";
107
- styles.paddingBottom = "var(--nypl-space-l)";
108
- styles.paddingTop = "var(--nypl-space-l)";
109
- }
110
- if (size !== "large") {
111
- key += `-${size}`;
112
- }
113
- return (
114
- <div style={styles} key={key}>
115
- <Heading level="four">{displayValue}</Heading>
116
- <Logo name={logo} size={size} />
117
- </div>
118
- );
119
- };
120
- export const logos = [];
121
- export const sizes = [];
122
- export const logoNameValues = [
123
- "bplBlack",
124
- "bplWhite",
125
- "cleverColor",
126
- "cleverWhite",
127
- "firstbookColor",
128
- "firstbookColorNegative",
129
- "lpaColor",
130
- "lpaBlack",
131
- "lpaWhite",
132
- "mlnBlack",
133
- "mlnWhite",
134
- "nyplFullBlack",
135
- "nyplFullWhite",
136
- "nyplLionBlack",
137
- "nyplLionWhite",
138
- "openebooksColor",
139
- "openebooksNegative",
140
- "openebooksWithTextColor",
141
- "openebooksWithTextNegative",
142
- "qplColor",
143
- "qplBlack",
144
- "qplWhite",
145
- "qplAltBlack",
146
- "qplAltWhite",
147
- "reservoirIconColor",
148
- "reservoirVerticalColor",
149
- "schomburgColor",
150
- "schomburgBlack",
151
- "schomburgWhite",
152
- "schomburgCircleColor",
153
- "schomburgCircleBlack",
154
- "schomburgCircleWhite",
155
- "simplyeColor",
156
- "simplyeBlack",
157
- "simplyeWhite",
158
- "snflBlack",
159
- "snflWhite",
160
- "treasuresColor",
161
- "treasuresColorNegative",
162
- ];
163
- export const logoSizeValues = [
164
- "default",
165
- "xxsmall",
166
- "xsmall",
167
- "small",
168
- "medium",
169
- "large",
170
- ];
171
- for (const logo in logoNameValues) {
172
- logos.push(
173
- logoRow(logoNameValues[logo], { displayValue: logoNameValues[logo] })
174
- );
175
- }
176
- for (const logoSize in logoSizeValues) {
177
- sizes.push(
178
- logoRow("nyplFullBlack", {
179
- displayValue: logoSizeValues[logoSize],
180
- size: logoSizeValues[logoSize],
181
- })
182
- );
183
- }
184
-
185
- export const allLogosGrid = (list) => (
186
- <SimpleGrid columns={1}>{list}</SimpleGrid>
187
- );
188
-
189
- ## Accessibility
190
-
191
- For accessibility purposes, every Reservoir Design System (DS) `Logo` will
192
- render the `svg` element with its `svg` file name in the `title` element. The
193
- default text in the `title` element is the logo's code name. Pass in better
194
- descriptive text in the `title` prop when using the `Logo` component in your
195
- application. This will give screenreaders a better descriptive title for the
196
- `svg` graphic.
197
-
198
- `Logos`s are decorative by default. This means that they are presentational and
199
- screenreaders will not read them because the `aria-hidden` attribute is set to
200
- `true`.
201
-
202
- Resources:
203
-
204
- - [W3C Design System SVG Icons](https://design-system.w3.org/styles/svg-icons.html)
205
- - [CSS-Tricks Accessible SVG Icons](https://css-tricks.com/accessible-svg-icons/)
206
- - [Chakra UI Icon](https://chakra-ui.com/docs/components/media-and-icons/icon)
207
-
208
- ## Logo Sizes
209
-
210
- Update the size of the `Logo` component by passing the `size` prop with a value
211
- from the `LogoSizes` type. The values are `"default"`, `"xxsmall"`, `"xsmall"`,
212
- `"small"`, `"medium"`, and `"large"`.
213
-
214
- Note: `"default"` sets the width to `100%` and the rendered logo will expand to
215
- fill the full width of the parent element.
216
-
217
- ```jsx
218
- // Example
219
- <Logo name="nyplFullBlack" size="large" />
220
- ```
221
-
222
- <Canvas>
223
- <Story name="Logo Sizes">{allLogosGrid(sizes)}</Story>
224
- </Canvas>
225
-
226
- ## All Logos
227
-
228
- Update the icon of the `Logo` component by passing the `name` prop with a value
229
- from the `LogoNames` type. The values are `"bplBlack"`, `"bplWhite"`,
230
- `"cleverColor"`, `"cleverWhite"`, `"firstbookColor"`, `"firstbookColorNegative"`,
231
- `"lpaBlack"`, `"lpaColor"`, `"lpaWhite"`, `"mlnBlack"`, `"mlnWhite"`,
232
- `"nyplFullBlack"`, `"nyplFullWhite"`, `"nyplLionBlack"`, `"nyplLionWhite"`,
233
- `"openebooksColor"`, `"openebooksNegative"`, `"openebooksWithTextColor"`,
234
- `"openebooksWithTextNegative"`, `"qplAltBlack"`, `"qplAltWhite"`, `"qplBlack"`,
235
- `"qplColor"`, `"qplWhite"`, `"reservoirIconColor"`, `"reservoirVerticalColor"`,
236
- `"schomburgBlack"`, `"schomburgCircleBlack"`, `"schomburgCircleColor"`,
237
- `"schomburgCircleWhite"`, `"schomburgColor"`, `"schomburgWhite"`, `"simplyeBlack"`,
238
- `"simplyeWhite"`, `"simplyeColor"`, `"snflBlack"`, `"snflWhite"`, `"treasuresColor"`,
239
- `"treasuresColorNegative"`.
240
-
241
- If you feel a necessary logo should be added to the `Logo` component, please
242
- reach out to the DS team.
243
-
244
- <Canvas withToolbar>
245
- <Story name="All Logos">{allLogosGrid(logos)}</Story>
246
- </Canvas>
247
-
248
- ## Custom Logos
249
-
250
- If you'd like to pass a custom `svg` to your application, you can pass it a
251
- child to the `Logo` component.
252
-
253
- ```jsx
254
- <Logo {...props}>
255
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192.756 192.756">
256
- <g fill-rule="evenodd" clip-rule="evenodd">
257
- <path fill="#fff" d="M0 0h192.756v192.756H0V0z" />
258
- <path
259
- d="M59.73 117.578c-9.859-4.912-23.261-15.887-23.413-27.06C36.149 78.129 44.451 75.087 50 75.087c5.701 0 8.286 3.345 10.637 5.777 2.352-2.433 4.936-5.777 10.637-5.777 5.549 0 13.851 3.042 13.682 15.431-.151 11.173-13.553 22.148-23.412 27.06-.35.174-.629.262-.907.262s-.557-.088-.907-.262z"
260
- fill="#c23c40"
261
- />
262
- <path d="M184.252 78.225c-.027 1.111-.355 1.921-.799 2.399-.871.945-3.1 1.067-4.283.854-.668-.12-1.309-.167-1.66-.137-1.551.136-2.398 1.115-3.242 2.45l-10.377 16.423-.154 6.727c-.033 1.535.287 2.881 2.066 2.799l2.865-.135c1.725-.08 3.35 1.029 3.4 2.867.064 2.359-1.807 3.393-3.943 3.275-1.338-.072-2.559-.275-3.666-.477-2.355-.428-3.977-.279-6.332 0-2.189.262-3.879.43-5.055.4-1.895-.045-3.725-.988-3.91-2.957-.178-1.898 1.297-3.191 3.186-3.041l2.5.199c.963.076 2.232-.406 2.256-1.533l.152-7.555-10.803-17.373c-.588-.948-1.52-1.538-2.42-1.877-1.156-.435-2.35-.464-3.568-.309-.988.125-1.16.01-1.414-.001-2.166-.093-3.1-1.048-2.988-3.064.139-2.505 1.543-2.885 3.936-2.885.412 0 1.391.005 3.344.285 1.43.206 2.609.099 3.531.067 2.436-.083 4.973-.545 7.377-.479 1.334.037 2.285.338 2.943.667.92.459 1.506 1.161 1.473 2.348-.031 1.144-.484 2.161-1.139 2.645-.496.367-1.848.417-2.902.417-1.92-.046-1.844 1.094-1.24 1.651l7.008 11.204 7.336-11.487c.148-.59.916-1.602-1.146-1.365-.637.073-.715.087-1.48.064-1.1-.033-1.854-.247-2.266-.544-1.348-.974-1.18-1.916-.943-3.322.17-1.019.986-1.48 1.877-1.744.928-.275 1.896-.259 2.871-.267 1.105-.009 2.221.111 3.295.272 1.99.297 3.414.306 5.398.066 1.379-.167 3.006-.5 4.559-.488 1.062.008 2.092.056 2.984.551.867.484 1.4 1.278 1.373 2.41zM31.561 112.531c-.116 2.684-2.242 2.799-4.345 2.799-2.14 0-4.302-.387-6.455-.387-2.396 0-4.788.17-7.178.396-2.739.262-4.681-.342-4.576-2.869.07-1.703 1.047-2.818 3.117-2.814l2.783.004c1.497.002 2.085-1.572 2.082-2.721l-.098-23.305c-.004-1.258-.422-2.46-1.917-2.431l-3.169.064c-2.091.042-3.322-1.33-3.301-3.214.026-2.372 1.934-2.958 3.873-2.897.678.021 2.127.043 3.023.136 1.53.157 3.13.141 4.67.141 2.369 0 4.682-.372 7.012-.372 2.197 0 4.145.564 4.274 3.233.078 1.624-1.636 2.807-3.479 2.776l-2.155-.035c-1.634-.027-2.604 1.158-2.587 2.501l.294 23.462c.028 2.24 1.216 2.869 3.008 2.85l2.109-.025c1.58-.02 3.098.777 3.015 2.708zM135.311 78.065c-.084 2.73-1.73 3.344-4.244 3.344 0-.041-4.09-.461-4.09 1.686v26.908c0 3.244-1.57 6.314-5.01 6.314-2.217 0-4.641-1.143-5.557-3.271l-12.846-29.84-.061 23.363c-.004 1.895.496 2.963 2.393 2.908l2.344-.066c2.098-.061 3.543 1.082 3.482 3.266-.066 2.418-1.879 2.932-3.93 2.932-2.467 0-4.818-.783-7.248-.666-2.58.123-5.081.484-7.668.484-2.227 0-3.915-.693-3.915-3.283 0-2.166 1.352-2.596 3.254-2.637l2.58-.055c1.54-.031 2.489-.662 2.489-1.975V82.78c0-1.262-.493-1.895-2.204-1.835l-2.213.079c-2.608.092-3.612-.421-3.543-3.023.061-2.28 1.595-3.273 4.478-3.052 1.569.12 3.148.301 4.722.301 1.721 0 3.434-.042 5.148-.042 2.891 0 4.029 1.753 5.182 4.37l11.777 26.751V83.664c0-1.012-.412-1.794-.732-2.11-.322-.316-.822-.481-1.475-.478l-2.693.019c-1.971.012-3.658-.844-3.623-2.685.055-3.006 2.82-3.496 5.285-3.399 2.385.094 4.965.742 7.32.667 2.227-.071 4.461-.646 6.697-.533 2.885.147 3.951 1.244 3.901 2.92zM179.455 107.746c1.111 0 2.096.396 2.951 1.186.896.832 1.346 1.836 1.346 3.012 0 1.426-.506 2.523-1.518 3.297a4.258 4.258 0 0 1-2.643.902h-.211c-1.004 0-1.926-.42-2.766-1.26-.838-.84-1.258-1.791-1.258-2.852v-.174c0-1.16.398-2.135 1.197-2.926.801-.788 1.767-1.185 2.902-1.185zm.408 3.951c.346 0 .615-.082.809-.246.193-.166.291-.363.291-.594a.77.77 0 0 0-.266-.58c-.178-.164-.422-.246-.736-.246h-1.543v1.666h1.445zm-.308-3.345c-.814 0-1.576.279-2.283.84-.891.699-1.334 1.646-1.334 2.84 0 .914.359 1.742 1.08 2.486.721.746 1.533 1.117 2.438 1.117h.148c.906 0 1.723-.367 2.451-1.104s1.092-1.6 1.092-2.588c0-.971-.359-1.812-1.08-2.523-.719-.713-1.557-1.068-2.512-1.068zm-1.741 1.171h2.221c.504 0 .902.141 1.199.42.264.256.395.561.395.914 0 .338-.125.633-.377.883-.25.252-.6.377-1.043.377l-.174-.012 1.408 2.172h-.703l-1.359-2.074h-.963v2.074h-.604v-4.754z" />
263
- </g>
264
- </svg>
265
- </Logo>
266
- ```
267
-
268
- <Canvas>
269
- <Story
270
- name="Custom Logos"
271
- args={{
272
- size: "large",
273
- }}
274
- >
275
- {(args) => (
276
- <Logo {...args}>
277
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192.756 192.756">
278
- <g fill-rule="evenodd" clip-rule="evenodd">
279
- <path fill="#fff" d="M0 0h192.756v192.756H0V0z" />
280
- <path
281
- d="M59.73 117.578c-9.859-4.912-23.261-15.887-23.413-27.06C36.149 78.129 44.451 75.087 50 75.087c5.701 0 8.286 3.345 10.637 5.777 2.352-2.433 4.936-5.777 10.637-5.777 5.549 0 13.851 3.042 13.682 15.431-.151 11.173-13.553 22.148-23.412 27.06-.35.174-.629.262-.907.262s-.557-.088-.907-.262z"
282
- fill="#c23c40"
283
- />
284
- <path d="M184.252 78.225c-.027 1.111-.355 1.921-.799 2.399-.871.945-3.1 1.067-4.283.854-.668-.12-1.309-.167-1.66-.137-1.551.136-2.398 1.115-3.242 2.45l-10.377 16.423-.154 6.727c-.033 1.535.287 2.881 2.066 2.799l2.865-.135c1.725-.08 3.35 1.029 3.4 2.867.064 2.359-1.807 3.393-3.943 3.275-1.338-.072-2.559-.275-3.666-.477-2.355-.428-3.977-.279-6.332 0-2.189.262-3.879.43-5.055.4-1.895-.045-3.725-.988-3.91-2.957-.178-1.898 1.297-3.191 3.186-3.041l2.5.199c.963.076 2.232-.406 2.256-1.533l.152-7.555-10.803-17.373c-.588-.948-1.52-1.538-2.42-1.877-1.156-.435-2.35-.464-3.568-.309-.988.125-1.16.01-1.414-.001-2.166-.093-3.1-1.048-2.988-3.064.139-2.505 1.543-2.885 3.936-2.885.412 0 1.391.005 3.344.285 1.43.206 2.609.099 3.531.067 2.436-.083 4.973-.545 7.377-.479 1.334.037 2.285.338 2.943.667.92.459 1.506 1.161 1.473 2.348-.031 1.144-.484 2.161-1.139 2.645-.496.367-1.848.417-2.902.417-1.92-.046-1.844 1.094-1.24 1.651l7.008 11.204 7.336-11.487c.148-.59.916-1.602-1.146-1.365-.637.073-.715.087-1.48.064-1.1-.033-1.854-.247-2.266-.544-1.348-.974-1.18-1.916-.943-3.322.17-1.019.986-1.48 1.877-1.744.928-.275 1.896-.259 2.871-.267 1.105-.009 2.221.111 3.295.272 1.99.297 3.414.306 5.398.066 1.379-.167 3.006-.5 4.559-.488 1.062.008 2.092.056 2.984.551.867.484 1.4 1.278 1.373 2.41zM31.561 112.531c-.116 2.684-2.242 2.799-4.345 2.799-2.14 0-4.302-.387-6.455-.387-2.396 0-4.788.17-7.178.396-2.739.262-4.681-.342-4.576-2.869.07-1.703 1.047-2.818 3.117-2.814l2.783.004c1.497.002 2.085-1.572 2.082-2.721l-.098-23.305c-.004-1.258-.422-2.46-1.917-2.431l-3.169.064c-2.091.042-3.322-1.33-3.301-3.214.026-2.372 1.934-2.958 3.873-2.897.678.021 2.127.043 3.023.136 1.53.157 3.13.141 4.67.141 2.369 0 4.682-.372 7.012-.372 2.197 0 4.145.564 4.274 3.233.078 1.624-1.636 2.807-3.479 2.776l-2.155-.035c-1.634-.027-2.604 1.158-2.587 2.501l.294 23.462c.028 2.24 1.216 2.869 3.008 2.85l2.109-.025c1.58-.02 3.098.777 3.015 2.708zM135.311 78.065c-.084 2.73-1.73 3.344-4.244 3.344 0-.041-4.09-.461-4.09 1.686v26.908c0 3.244-1.57 6.314-5.01 6.314-2.217 0-4.641-1.143-5.557-3.271l-12.846-29.84-.061 23.363c-.004 1.895.496 2.963 2.393 2.908l2.344-.066c2.098-.061 3.543 1.082 3.482 3.266-.066 2.418-1.879 2.932-3.93 2.932-2.467 0-4.818-.783-7.248-.666-2.58.123-5.081.484-7.668.484-2.227 0-3.915-.693-3.915-3.283 0-2.166 1.352-2.596 3.254-2.637l2.58-.055c1.54-.031 2.489-.662 2.489-1.975V82.78c0-1.262-.493-1.895-2.204-1.835l-2.213.079c-2.608.092-3.612-.421-3.543-3.023.061-2.28 1.595-3.273 4.478-3.052 1.569.12 3.148.301 4.722.301 1.721 0 3.434-.042 5.148-.042 2.891 0 4.029 1.753 5.182 4.37l11.777 26.751V83.664c0-1.012-.412-1.794-.732-2.11-.322-.316-.822-.481-1.475-.478l-2.693.019c-1.971.012-3.658-.844-3.623-2.685.055-3.006 2.82-3.496 5.285-3.399 2.385.094 4.965.742 7.32.667 2.227-.071 4.461-.646 6.697-.533 2.885.147 3.951 1.244 3.901 2.92zM179.455 107.746c1.111 0 2.096.396 2.951 1.186.896.832 1.346 1.836 1.346 3.012 0 1.426-.506 2.523-1.518 3.297a4.258 4.258 0 0 1-2.643.902h-.211c-1.004 0-1.926-.42-2.766-1.26-.838-.84-1.258-1.791-1.258-2.852v-.174c0-1.16.398-2.135 1.197-2.926.801-.788 1.767-1.185 2.902-1.185zm.408 3.951c.346 0 .615-.082.809-.246.193-.166.291-.363.291-.594a.77.77 0 0 0-.266-.58c-.178-.164-.422-.246-.736-.246h-1.543v1.666h1.445zm-.308-3.345c-.814 0-1.576.279-2.283.84-.891.699-1.334 1.646-1.334 2.84 0 .914.359 1.742 1.08 2.486.721.746 1.533 1.117 2.438 1.117h.148c.906 0 1.723-.367 2.451-1.104s1.092-1.6 1.092-2.588c0-.971-.359-1.812-1.08-2.523-.719-.713-1.557-1.068-2.512-1.068zm-1.741 1.171h2.221c.504 0 .902.141 1.199.42.264.256.395.561.395.914 0 .338-.125.633-.377.883-.25.252-.6.377-1.043.377l-.174-.012 1.408 2.172h-.703l-1.359-2.074h-.963v2.074h-.604v-4.754z" />
285
- </g>
286
- </svg>
287
- </Logo>
288
- )}
289
- </Story>
290
- </Canvas>
@@ -1,116 +0,0 @@
1
- import * as React from "react";
2
- import { render } from "@testing-library/react";
3
- import { axe } from "jest-axe";
4
- import renderer from "react-test-renderer";
5
-
6
- import Logo from "./Logo";
7
-
8
- describe("Logo Accessibility", () => {
9
- it("passes axe accessibility test", async () => {
10
- const { container } = render(<Logo name="nyplFullBlack" />);
11
- expect(await axe(container)).toHaveNoViolations();
12
- });
13
- });
14
-
15
- describe("Logo", () => {
16
- it("consoles a warning if both name and children are passed to Logo", () => {
17
- const warn = jest.spyOn(console, "warn");
18
- render(
19
- <Logo name="nyplFullBlack">
20
- <svg viewBox="0 0 24 14" xmlns="http://www.w3.org/2000/svg">
21
- <path
22
- fillRule="evenodd"
23
- clipRule="evenodd"
24
- d="M10.526 12.871L.263 1.676 1.737.324 12 11.52 22.263.324l1.474 1.352L13.474 12.87a2 2 0 01-2.948 0z"
25
- />
26
- </svg>
27
- </Logo>
28
- );
29
- expect(warn).toHaveBeenCalledWith(
30
- "NYPL Reservoir Logo: Pass either a `name` prop or an `svg` element child. Do not pass both."
31
- );
32
- });
33
-
34
- it("consoles a warning if both name and children are not passed", () => {
35
- const warn = jest.spyOn(console, "warn");
36
- render(<Logo />);
37
- expect(warn).toHaveBeenCalledWith(
38
- "NYPL Reservoir Logo: Pass a logo `name` prop or an SVG child to " +
39
- "`Logo` to ensure a logo appears."
40
- );
41
- });
42
-
43
- it("consoles a warning if name is not passed and a child is but it's not an SVG element", () => {
44
- const warn = jest.spyOn(console, "warn");
45
- render(<Logo>Not an SVG</Logo>);
46
- expect(warn).toHaveBeenCalledWith(
47
- "NYPL Reservoir Logo: An `svg` element must be passed to the `Logo` " +
48
- "component as its child."
49
- );
50
- });
51
-
52
- it("renders a logo based on the logo `name` prop", () => {
53
- const { container } = render(<Logo name="nyplFullBlack" />);
54
- expect(container.querySelector("svg")).toBeInTheDocument();
55
- });
56
-
57
- // NOTE: the svg logo is dynamically generated by the "svgr" package. At build
58
- // time, it generate the `title` element but it doesn't generate it for tests.
59
- // In order to test this, we can check the `title` attribute in the svg
60
- // element itself. Inspect the `Logo` in Storybook to see the `title` element.
61
- it("renders a title element", () => {
62
- const { container, rerender } = render(<Logo name="nyplFullBlack" />);
63
- expect(container.querySelector("svg")).toHaveAttribute(
64
- "title",
65
- "nyplFullBlack logo"
66
- );
67
-
68
- rerender(<Logo name="nyplFullBlack" title="title content" />);
69
- expect(container.querySelector("svg")).toHaveAttribute(
70
- "title",
71
- "title content"
72
- );
73
- });
74
-
75
- it("renders a logo based on the child", () => {
76
- const { container } = render(
77
- <Logo>
78
- <svg viewBox="0 0 24 14" xmlns="http://www.w3.org/2000/svg">
79
- <path
80
- fillRule="evenodd"
81
- clipRule="evenodd"
82
- d="M10.526 12.871L.263 1.676 1.737.324 12 11.52 22.263.324l1.474 1.352L13.474 12.87a2 2 0 01-2.948 0z"
83
- />
84
- </svg>
85
- </Logo>
86
- );
87
- expect(container.querySelector("svg")).toBeInTheDocument();
88
- });
89
-
90
- it("renders the UI snapshot correctly", () => {
91
- const standard = renderer
92
- .create(<Logo id="test-logo" name="nyplFullBlack" />)
93
- .toJSON();
94
- const withCustomSize = renderer
95
- .create(<Logo id="test-logo-size" name="nyplFullBlack" size="large" />)
96
- .toJSON();
97
- const withChakraProps = renderer
98
- .create(
99
- <Logo
100
- id="chakra"
101
- name="nyplFullBlack"
102
- p="20px"
103
- color="ui.error.primary"
104
- />
105
- )
106
- .toJSON();
107
- const withOtherProps = renderer
108
- .create(<Logo id="props" name="nyplFullBlack" data-testid="props" />)
109
- .toJSON();
110
-
111
- expect(standard).toMatchSnapshot();
112
- expect(withCustomSize).toMatchSnapshot();
113
- expect(withChakraProps).toMatchSnapshot();
114
- expect(withOtherProps).toMatchSnapshot();
115
- });
116
- });
@@ -1,147 +0,0 @@
1
- import {
2
- Box,
3
- chakra,
4
- Icon as ChakraIcon,
5
- useStyleConfig,
6
- } from "@chakra-ui/react";
7
- import * as React from "react";
8
-
9
- import logoSvgs from "./LogoSvgs";
10
-
11
- export type LogoNames =
12
- | "bplBlack"
13
- | "bplWhite"
14
- | "cleverColor"
15
- | "cleverWhite"
16
- | "firstbookColor"
17
- | "firstbookColorNegative"
18
- | "lpaBlack"
19
- | "lpaColor"
20
- | "lpaWhite"
21
- | "mlnBlack"
22
- | "mlnWhite"
23
- | "nyplFullBlack"
24
- | "nyplFullWhite"
25
- | "nyplLionBlack"
26
- | "nyplLionWhite"
27
- | "openebooksColor"
28
- | "openebooksNegative"
29
- | "openebooksWithTextColor"
30
- | "openebooksWithTextNegative"
31
- | "qplAltBlack"
32
- | "qplAltWhite"
33
- | "qplBlack"
34
- | "qplColor"
35
- | "qplWhite"
36
- | "reservoirIconColor"
37
- | "reservoirVerticalColor"
38
- | "schomburgBlack"
39
- | "schomburgCircleBlack"
40
- | "schomburgCircleColor"
41
- | "schomburgCircleWhite"
42
- | "schomburgColor"
43
- | "schomburgWhite"
44
- | "simplyeBlack"
45
- | "simplyeWhite"
46
- | "simplyeColor"
47
- | "snflBlack"
48
- | "snflWhite"
49
- | "treasuresColor"
50
- | "treasuresColorNegative";
51
- export type LogoSizes =
52
- | "default"
53
- | "xxsmall"
54
- | "xsmall"
55
- | "small"
56
- | "medium"
57
- | "large";
58
- export interface LogoProps {
59
- /** Optional className that will be added to the parent element */
60
- className?: string;
61
- /** Logos designated as decorative will be ignored by screenreaders. False
62
- * by default. */
63
- decorative?: boolean;
64
- /** ID that other components can cross reference for accessibility purposes */
65
- id?: string;
66
- /** The name of the logo you want to use. */
67
- name?: LogoNames;
68
- /** Sets the logo size. */
69
- size?: LogoSizes;
70
- /** For accessibility purposes, the text passed in the `title` prop gets
71
- * rendered in a `title` element in the SVG. This descriptive text is not
72
- * visible but is needed for screenreaders to describe the graphic. */
73
- title?: string;
74
- }
75
-
76
- /**
77
- * The `Logo` component renders SVG-based logos and color variants that are
78
- * commonly used by the New York Public Library.
79
- */
80
- export const Logo = chakra((props: React.PropsWithChildren<LogoProps>) => {
81
- const {
82
- children,
83
- className,
84
- decorative = false,
85
- id,
86
- name,
87
- size = "medium",
88
- title = `${name} logo`,
89
- ...rest
90
- } = props;
91
- const styles = useStyleConfig("Logo", {
92
- size,
93
- });
94
- const logoProps = {
95
- "aria-hidden": decorative,
96
- className,
97
- id,
98
- role: "img",
99
- title,
100
- ...rest,
101
- };
102
- let childSVG = null;
103
-
104
- // Component prop validation
105
- if (name && children) {
106
- console.warn(
107
- "NYPL Reservoir Logo: Pass either a `name` prop or an `svg` element " +
108
- "child. Do not pass both."
109
- );
110
- return null;
111
- } else if (!name && !children) {
112
- console.warn(
113
- "NYPL Reservoir Logo: Pass a logo `name` prop or an SVG child to " +
114
- "`Logo` to ensure a logo appears."
115
- );
116
- return null;
117
- }
118
-
119
- // The user wants to render an existing logo. Load the logo and render it
120
- // as a component through Chakra's Icon component. Otherwise, we're going to
121
- // render the SVG child with NYPL-theme styling.
122
- if (name) {
123
- const SvgComponent: any = logoSvgs[name];
124
- return <ChakraIcon as={SvgComponent} {...logoProps} __css={styles} />;
125
- }
126
-
127
- // If no `name` prop was passed, we expect a child SVG element to be passed.
128
- // Apply logo props to the SVG child.
129
- if (
130
- (children as JSX.Element).type === "svg" ||
131
- (children as JSX.Element).props?.type === "svg" ||
132
- (children as JSX.Element).props?.mdxType === "svg"
133
- ) {
134
- childSVG = React.cloneElement(children as JSX.Element, {
135
- ...logoProps,
136
- });
137
- } else {
138
- console.warn(
139
- "NYPL Reservoir Logo: An `svg` element must be passed to the `Logo` " +
140
- "component as its child."
141
- );
142
- }
143
-
144
- return <Box __css={styles}>{childSVG}</Box>;
145
- });
146
-
147
- export default Logo;
@@ -1,82 +0,0 @@
1
- /* eslint-disable camelcase */
2
- import bplBlack from "../../../icons/svg/logo-bpl-black.svg";
3
- import bplWhite from "../../../icons/svg/logo-bpl-white.svg";
4
- import cleverColor from "../../../icons/svg/logo-clever-color.svg";
5
- import cleverWhite from "../../../icons/svg/logo-clever-white.svg";
6
- import firstbookColor from "../../../icons/svg/logo-firstbook-color.svg";
7
- import firstbookColorNegative from "../../../icons/svg/logo-firstbook-color-negative.svg";
8
- import lpaColor from "../../../icons/svg/logo-lpa-color.svg";
9
- import lpaBlack from "../../../icons/svg/logo-lpa-black.svg";
10
- import lpaWhite from "../../../icons/svg/logo-lpa-white.svg";
11
- import mlnBlack from "../../../icons/svg/logo-mln-black.svg";
12
- import mlnWhite from "../../../icons/svg/logo-mln-white.svg";
13
- import nyplFullBlack from "../../../icons/svg/logo-nypl-full-black.svg";
14
- import nyplFullWhite from "../../../icons/svg/logo-nypl-full-white.svg";
15
- import nyplLionBlack from "../../../icons/svg/logo-nypl-lion-black.svg";
16
- import nyplLionWhite from "../../../icons/svg/logo-nypl-lion-white.svg";
17
- import openebooksColor from "../../../icons/svg/logo-openebooks-color.svg";
18
- import openebooksNegative from "../../../icons/svg/logo-openebooks-negative.svg";
19
- import openebooksWithTextColor from "../../../icons/svg/logo-openebooks-with-text-color.svg";
20
- import openebooksWithTextNegative from "../../../icons/svg/logo-openebooks-with-text-negative.svg";
21
- import qplAltBlack from "../../../icons/svg/logo-qpl-alt-black.svg";
22
- import qplAltWhite from "../../../icons/svg/logo-qpl-alt-white.svg";
23
- import qplBlack from "../../../icons/svg/logo-qpl-black.svg";
24
- import qplColor from "../../../icons/svg/logo-qpl-color.svg";
25
- import qplWhite from "../../../icons/svg/logo-qpl-white.svg";
26
- import reservoirIconColor from "../../../icons/svg/logo-reservoir-icon-color.svg";
27
- import reservoirVerticalColor from "../../../icons/svg/logo-reservoir-vertical-color.svg";
28
- import schomburgBlack from "../../../icons/svg/logo-schomburg-black.svg";
29
- import schomburgCircleBlack from "../../../icons/svg/logo-schomburg-circle-black.svg";
30
- import schomburgCircleColor from "../../../icons/svg/logo-schomburg-circle-color.svg";
31
- import schomburgCircleWhite from "../../../icons/svg/logo-schomburg-circle-white.svg";
32
- import schomburgColor from "../../../icons/svg/logo-schomburg-color.svg";
33
- import schomburgWhite from "../../../icons/svg/logo-schomburg-white.svg";
34
- import simplyeBlack from "../../../icons/svg/logo-simplye-black.svg";
35
- import simplyeWhite from "../../../icons/svg/logo-simplye-white.svg";
36
- import simplyeColor from "../../../icons/svg/logo-simplye-color.svg";
37
- import snflBlack from "../../../icons/svg/logo-snfl-black.svg";
38
- import snflWhite from "../../../icons/svg/logo-snfl-white.svg";
39
- import treasuresColor from "../../../icons/svg/logo-treasures-color.svg";
40
- import treasuresColorNegative from "../../../icons/svg/logo-treasures-color-negative.svg";
41
-
42
- export default {
43
- bplBlack,
44
- bplWhite,
45
- cleverColor,
46
- cleverWhite,
47
- firstbookColor,
48
- firstbookColorNegative,
49
- lpaBlack,
50
- lpaColor,
51
- lpaWhite,
52
- mlnBlack,
53
- mlnWhite,
54
- nyplFullBlack,
55
- nyplFullWhite,
56
- nyplLionBlack,
57
- nyplLionWhite,
58
- openebooksColor,
59
- openebooksNegative,
60
- openebooksWithTextColor,
61
- openebooksWithTextNegative,
62
- qplAltBlack,
63
- qplAltWhite,
64
- qplBlack,
65
- qplColor,
66
- qplWhite,
67
- reservoirIconColor,
68
- reservoirVerticalColor,
69
- schomburgBlack,
70
- schomburgCircleBlack,
71
- schomburgCircleColor,
72
- schomburgCircleWhite,
73
- schomburgColor,
74
- schomburgWhite,
75
- simplyeBlack,
76
- simplyeWhite,
77
- simplyeColor,
78
- snflBlack,
79
- snflWhite,
80
- treasuresColor,
81
- treasuresColorNegative,
82
- };