@czi-sds/mcp 0.2.2 → 0.4.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/data/component-props/Accordion.json +14 -15
- package/data/component-props/Alert.json +2 -44
- package/data/component-props/Autocomplete.json +14 -32
- package/data/component-props/Banner.json +11 -12
- package/data/component-props/Button.json +17 -82
- package/data/component-props/ButtonDropdown.json +26 -0
- package/data/component-props/ButtonIcon.json +4 -60
- package/data/component-props/ButtonToggle.json +2 -66
- package/data/component-props/Callout.json +11 -65
- package/data/component-props/CellBasic.json +28 -56
- package/data/component-props/CellComponent.json +4 -32
- package/data/component-props/CellHeader.json +13 -49
- package/data/component-props/ComplexFilter.json +24 -4
- package/data/component-props/ContentCard.json +66 -2
- package/data/component-props/Dialog.json +26 -0
- package/data/component-props/Dropdown.json +29 -67
- package/data/component-props/DropdownMenu.json +16 -56
- package/data/component-props/HeatmapChart.json +6 -87
- package/data/component-props/Icon.json +3 -8
- package/data/component-props/InputCheckbox.json +5 -53
- package/data/component-props/InputDropdown.json +11 -33
- package/data/component-props/InputRadio.json +5 -53
- package/data/component-props/InputSearch.json +6 -70
- package/data/component-props/InputSlider.json +21 -35
- package/data/component-props/InputText.json +7 -63
- package/data/component-props/InputToggle.json +5 -54
- package/data/component-props/Link.json +18 -0
- package/data/component-props/LoadingIndicator.json +1 -2
- package/data/component-props/MenuItem.json +11 -41
- package/data/component-props/MenuSelect.json +4 -67
- package/data/component-props/NavigationFooter.json +0 -8
- package/data/component-props/NavigationHeader.json +14 -65
- package/data/component-props/NavigationJumpTo.json +0 -40
- package/data/component-props/Notification.json +14 -58
- package/data/component-props/Pagination.json +8 -33
- package/data/component-props/Panel.json +4 -54
- package/data/component-props/SegmentedControl.json +0 -55
- package/data/component-props/TableRow.json +10 -38
- package/data/component-props/Tabs.json +18 -0
- package/data/component-props/Tag.json +10 -56
- package/data/component-props/TagFilter.json +0 -47
- package/data/component-props/Tooltip.json +12 -61
- package/data/component-props/TooltipCondensed.json +18 -0
- package/data/component-props/TooltipTable.json +0 -4
- package/data/zeroheight-cache.json +5195 -0
- package/data/zeroheight-exports/Accordion.md +717 -0
- package/data/zeroheight-exports/Banner.md +599 -0
- package/data/zeroheight-exports/Borders.md +117 -0
- package/data/zeroheight-exports/Buttons.md +2305 -0
- package/data/zeroheight-exports/Callout.md +778 -0
- package/data/zeroheight-exports/Colors.md +632 -0
- package/data/zeroheight-exports/Content-Card.md +161 -0
- package/data/zeroheight-exports/Contributing-to-SDS.md +98 -0
- package/data/zeroheight-exports/Control-Inputs.md +2121 -0
- package/data/zeroheight-exports/Corners.md +111 -0
- package/data/zeroheight-exports/Cover-page.md +3 -0
- package/data/zeroheight-exports/Dialog.md +1191 -0
- package/data/zeroheight-exports/Downloads.md +120 -0
- package/data/zeroheight-exports/Drop-Shadows.md +79 -0
- package/data/zeroheight-exports/Dropdown-Input.md +1180 -0
- package/data/zeroheight-exports/Dropdown-Menu.md +3883 -0
- package/data/zeroheight-exports/Element-Status-Tracker.md +267 -0
- package/data/zeroheight-exports/Field-Inputs.md +984 -0
- package/data/zeroheight-exports/Filters.md +888 -0
- package/data/zeroheight-exports/Getting-Started.md +1159 -0
- package/data/zeroheight-exports/Hero.md +262 -0
- package/data/zeroheight-exports/Icons.md +431 -0
- package/data/zeroheight-exports/Intent.md +46 -0
- package/data/zeroheight-exports/Introduction-to-Bases.md +35 -0
- package/data/zeroheight-exports/Introduction-to-Cells.md +35 -0
- package/data/zeroheight-exports/Introduction-to-DNA.md +35 -0
- package/data/zeroheight-exports/Introduction-to-Genes.md +35 -0
- package/data/zeroheight-exports/Introduction.md +115 -0
- package/data/zeroheight-exports/Link.md +386 -0
- package/data/zeroheight-exports/Lists.md +632 -0
- package/data/zeroheight-exports/Loading-Indicator.md +37 -0
- package/data/zeroheight-exports/Navigation.md +874 -0
- package/data/zeroheight-exports/Notification.md +888 -0
- package/data/zeroheight-exports/Panel.md +978 -0
- package/data/zeroheight-exports/README.md +124 -0
- package/data/zeroheight-exports/Responsive-Design.md +278 -0
- package/data/zeroheight-exports/Search-Input.md +53 -0
- package/data/zeroheight-exports/Search.md +592 -0
- package/data/zeroheight-exports/Segmented-Control.md +584 -0
- package/data/zeroheight-exports/Spacing.md +297 -0
- package/data/zeroheight-exports/Table.md +4944 -0
- package/data/zeroheight-exports/Tabs.md +801 -0
- package/data/zeroheight-exports/Tags.md +1055 -0
- package/data/zeroheight-exports/Text-Link.md +184 -0
- package/data/zeroheight-exports/Theming.md +332 -0
- package/data/zeroheight-exports/Tooltips.md +1580 -0
- package/data/zeroheight-exports/Typography.md +768 -0
- package/dist/stdio.js +193 -93
- package/package.json +4 -4
- package/data/component-props/Chip.json +0 -73
- package/data/component-props/List.json +0 -43
- package/data/component-props/Menu.json +0 -48
- package/data/component-props/Table.json +0 -26
- package/data/component-props-storybook/Accordion-storybook.json +0 -45
- package/data/component-props-storybook/Alert-storybook.json +0 -30
- package/data/component-props-storybook/Autocomplete-storybook.json +0 -67
- package/data/component-props-storybook/Banner-storybook.json +0 -78
- package/data/component-props-storybook/Button-storybook.json +0 -115
- package/data/component-props-storybook/ButtonDropdown-storybook.json +0 -73
- package/data/component-props-storybook/ButtonIcon-storybook.json +0 -60
- package/data/component-props-storybook/ButtonToggle-storybook.json +0 -68
- package/data/component-props-storybook/Callout-storybook.json +0 -90
- package/data/component-props-storybook/CellBasic-storybook.json +0 -138
- package/data/component-props-storybook/CellComponent-storybook.json +0 -48
- package/data/component-props-storybook/CellHeader-storybook.json +0 -71
- package/data/component-props-storybook/Chip-storybook.json +0 -26
- package/data/component-props-storybook/ComplexFilter-storybook.json +0 -60
- package/data/component-props-storybook/ContentCard-storybook.json +0 -175
- package/data/component-props-storybook/Dialog-storybook.json +0 -56
- package/data/component-props-storybook/Dropdown-storybook.json +0 -93
- package/data/component-props-storybook/DropdownMenu-storybook.json +0 -73
- package/data/component-props-storybook/HeatmapChart-storybook.json +0 -55
- package/data/component-props-storybook/Icon-storybook.json +0 -75
- package/data/component-props-storybook/InputCheckbox-storybook.json +0 -57
- package/data/component-props-storybook/InputDropdown-storybook.json +0 -80
- package/data/component-props-storybook/InputRadio-storybook.json +0 -56
- package/data/component-props-storybook/InputSearch-storybook.json +0 -55
- package/data/component-props-storybook/InputSlider-storybook.json +0 -55
- package/data/component-props-storybook/InputText-storybook.json +0 -59
- package/data/component-props-storybook/InputToggle-storybook.json +0 -42
- package/data/component-props-storybook/Link-storybook.json +0 -50
- package/data/component-props-storybook/List-storybook.json +0 -26
- package/data/component-props-storybook/LoadingIndicator-storybook.json +0 -34
- package/data/component-props-storybook/Menu-storybook.json +0 -26
- package/data/component-props-storybook/MenuItem-storybook.json +0 -74
- package/data/component-props-storybook/MenuSelect-storybook.json +0 -38
- package/data/component-props-storybook/NavigationFooter-storybook.json +0 -67
- package/data/component-props-storybook/NavigationHeader-storybook.json +0 -115
- package/data/component-props-storybook/NavigationJumpTo-storybook.json +0 -41
- package/data/component-props-storybook/Notification-storybook.json +0 -89
- package/data/component-props-storybook/Pagination-storybook.json +0 -50
- package/data/component-props-storybook/Panel-storybook.json +0 -52
- package/data/component-props-storybook/SegmentedControl-storybook.json +0 -30
- package/data/component-props-storybook/Table-storybook.json +0 -26
- package/data/component-props-storybook/TableHeader-storybook.json +0 -26
- package/data/component-props-storybook/TableRow-storybook.json +0 -62
- package/data/component-props-storybook/Tabs-storybook.json +0 -45
- package/data/component-props-storybook/Tag-storybook.json +0 -78
- package/data/component-props-storybook/TagFilter-storybook.json +0 -30
- package/data/component-props-storybook/Tooltip-storybook.json +0 -85
- package/data/component-props-storybook/TooltipCondensed-storybook.json +0 -38
- package/data/component-props-storybook/TooltipTable-storybook.json +0 -47
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
# Banners
|
|
2
|
+
|
|
3
|
+
Banners are used to communicate product status updates to users, allowing the product teams to provide important information to their users.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
## Banner Variants
|
|
8
|
+
|
|
9
|
+
| Banners are meant to communicate product status updates to users such as system maintenance, new features, known product bugs or issues. etc. and are not meant to be used in response to an action the user has taken within the product. Use a Callout or Notification for these purposes. There are two Banner variants meant to be used in an alternating manner, allowing multiple Banners to be stacked together while maintaining the ability to differentiate between them. Both Banner variants can optionally be set to be manually dismissible by the user, allowing them to hide the Banner from view once it has been read. Banners span the full width of the page. Follow the usage criteria accompanying each variant as a guide for selecting the correct Banner for any given use case. | | **Jump to variant:** Primary Secondary |
|
|
10
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | -------------------------------------- |
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Banner
|
|
15
|
+
|
|
16
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
17
|
+
| --- | -------- | --- | --- | ------------------- | --- | --- | ----------------- |
|
|
18
|
+
|
|
19
|
+
### Primary Banner
|
|
20
|
+
|
|
21
|
+
Use this variant in instances where only one Banner will be used on the page. If using multiple, this should be the first or top Banner used, followed by the secondary variant. Continue alternating variants for as many Banners as are needed. This ensures the Banners can be differentiated without the need for space or divider lines between them.
|
|
22
|
+
|
|
23
|
+
If additional context or information is needed beyond the space available on the Banner, it is recommended that a Link to an additional page with this information is included.
|
|
24
|
+
|
|
25
|
+
When the information being communicated on the Banner is intended to remain persistent on the screen and is not manually dismissible by the user, use a persistent Banner. To allow the user to manually dismiss the Banner, use a dismissible Banner.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### Secondary Banner
|
|
34
|
+
|
|
35
|
+
Use only when accompanied by the primary variant. If using multiple, this should be the second Banner used, followed by the primary variant. Continue alternating variants for as many Banners as are needed. This ensures the Banners can be differentiated without the need for space or divider lines between them.
|
|
36
|
+
|
|
37
|
+
If additional context or information is needed beyond the space available on the Banner, it is recommended that a Link to an additional page with this information is included.
|
|
38
|
+
|
|
39
|
+
When the information being communicated on the Banner is intended to remain persistent on the screen and is not manually dismissible by the user, use a persistent Banner. To allow the user to manually dismiss the Banner, use a dismissible Banner.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
### Banner Spacing
|
|
48
|
+
|
|
49
|
+
These rules establish how much margin should exist between and around elements.
|
|
50
|
+
|
|
51
|
+
## Code
|
|
52
|
+
|
|
53
|
+
## Banner Component
|
|
54
|
+
|
|
55
|
+
| Below you will find an interactive Storybook iframe for Banners. Tabs within each iframe provide a different set of tools: The Controls tab allows you to see and adjust all available props. The Actions tab shows you data displayed by event handler arguments. | | **Jump to component:** Banner |
|
|
56
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --- | ----------------------------- |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### Banner
|
|
61
|
+
|
|
62
|
+
Storybook
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
Banners are used to communicate product status updates to users, allowing the product teams to provide important information to their users.
|
|
67
|
+
|
|
68
|
+
## Guidelines
|
|
69
|
+
|
|
70
|
+
## Overview
|
|
71
|
+
|
|
72
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
73
|
+
| --- | -------- | --- | --- | ------------------- | --- | --- | ------- |
|
|
74
|
+
|
|
75
|
+
### Banner Variants
|
|
76
|
+
|
|
77
|
+
Banners communicate product status updates such as system maintenance, new features, known product bugs or issues. etc. and should not be used to respond to actions the user has taken within the product; use a Callout or Notification for these purposes.
|
|
78
|
+
|
|
79
|
+
There are two Banner variants: a primary Banner if only one Banner is needed and a secondary Banner if two or more Banners need to be shown at one time. This allows multiple Banners to be stacked together while maintaining the ability to differentiate between them.
|
|
80
|
+
|
|
81
|
+
Both Banner variants can optionally be set to be manually dismissible by the user, allowing them to hide the Banner from view once it has been read.
|
|
82
|
+
|
|
83
|
+
Banners span the full width of the page.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
### Live Instance
|
|
88
|
+
|
|
89
|
+
Interact with the live instance below and adjust the available props to better conceptualize how it will appear in product:
|
|
90
|
+
|
|
91
|
+
Default
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### Banner – Primary
|
|
96
|
+
|
|
97
|
+
Use Banner – Primary in instances where only one Banner will be used on the page. If using multiple, it should be the first or top Banner used, followed by the secondary variant. Continue alternating variants for as many Banners as are needed. This ensures the Banners can be differentiated without the need for space or divider lines between them.
|
|
98
|
+
|
|
99
|
+
If additional context or information is needed beyond the space available on the Banner, it is recommended that a Link to an additional page with this information is included on the Banner which can be inserted using the optional content slot.
|
|
100
|
+
|
|
101
|
+
When the information being communicated on the Banner is intended to remain persistent on the screen and is not manually dismissible by the user, use a persistent Banner. To allow the user to manually dismiss the Banner, use a dismissible Banner.
|
|
102
|
+
|
|
103
|
+
| Default (Persistent) | Default (Dismissible) | Hover (Dismissible) |
|
|
104
|
+
| -------------------- | --------------------- | ------------------- |
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### Banner – Secondary
|
|
109
|
+
|
|
110
|
+
Use only when accompanied by the primary variant. If using multiple, Banner – Secondary should be the second Banner used, followed by the primary variant. Continue alternating variants for as many Banners as are needed. This ensures the Banners can be differentiated without the need for space or divider lines between them.
|
|
111
|
+
|
|
112
|
+
If additional context or information is needed beyond the space available on the Banner, it is recommended that a Link to an additional page with this information is included on the Banner which can be inserted using the optional content slot.
|
|
113
|
+
|
|
114
|
+
When the information being communicated on the Banner is intended to remain persistent on the screen and is not manually dismissible by the user, use a persistent Banner. To allow the user to manually dismiss the Banner, use a dismissible Banner.
|
|
115
|
+
|
|
116
|
+
| Default (Persistent) | Default (Dismissible) | Hover (Dismissible) |
|
|
117
|
+
| -------------------- | --------------------- | ------------------- |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### Banner Spacing
|
|
122
|
+
|
|
123
|
+
These rules establish how much margin should exist between and around elements.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### Intent Variations
|
|
128
|
+
|
|
129
|
+
There are four different intents that Banners can communicate: Info, Negative, Notice, and Positive. Each intent is communicated using color and iconography.
|
|
130
|
+
|
|
131
|
+
Each intent is demonstrated below using the Dismissible variant for reference. Regardless of variant, the colors and icons used are the same.
|
|
132
|
+
|
|
133
|
+
#### Primary
|
|
134
|
+
|
|
135
|
+
| Info | Negative | Notice | Positive |
|
|
136
|
+
| ---- | -------- | ------ | -------- |
|
|
137
|
+
|
|
138
|
+
#### Secondary
|
|
139
|
+
|
|
140
|
+
| Info | Negative | Notice | Positive |
|
|
141
|
+
| ---- | -------- | ------ | -------- |
|
|
142
|
+
|
|
143
|
+
## Code
|
|
144
|
+
|
|
145
|
+
> **Note:** The code examples below must install dependencies before displaying and may take extra time to load
|
|
146
|
+
|
|
147
|
+
## Banner
|
|
148
|
+
|
|
149
|
+
### SDS Source Code
|
|
150
|
+
|
|
151
|
+
The component's source code in the SDS codebase can be found here.
|
|
152
|
+
|
|
153
|
+
### Props
|
|
154
|
+
|
|
155
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
156
|
+
|
|
157
|
+
| Name | Type | Default | Description |
|
|
158
|
+
| -------------- | -------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
159
|
+
| `dismissed` | `bool` | `false` | If `true`, the banner has been dismissed by the user. |
|
|
160
|
+
| `dismissible` | `bool` | `true` | If `true`, the banner can be dismissed by the user. |
|
|
161
|
+
| `sdsType` | `"primary"` ` | "secondary"` | `primary` | The `primary` variant has a `400` background color and white text color. The `secondary` variant has a `100` background color and `primary` text color. |
|
|
162
|
+
| `icon` | `ReactNode` | `-` | The icon to be displayed within the banner. If not provided, a`InfoCircle` icon will be displayed. |
|
|
163
|
+
| `sdsIconProps` | `Partial<IconProps>` | `-` | Additional props to be passed to the icon component. |
|
|
164
|
+
| `onClose` | `fn` | `-` | Callback fired when the component requests to be closed. When provided and no `action` prop is set, a close icon button is displayed that triggers the callback when clicked. **Signature:**`function(event: React.SyntheticEvent) => void` `event`. The event source of the callback. |
|
|
165
|
+
|
|
166
|
+
### Code examples
|
|
167
|
+
|
|
168
|
+
#### Default Banner
|
|
169
|
+
|
|
170
|
+
This example has the minimum props needed for the `Banner` component.
|
|
171
|
+
|
|
172
|
+
**/styles.css**
|
|
173
|
+
|
|
174
|
+
```css
|
|
175
|
+
body {
|
|
176
|
+
font-size: 13px;
|
|
177
|
+
font-weight: 400;
|
|
178
|
+
letter-spacing: 0.08px;
|
|
179
|
+
line-height: 20px;
|
|
180
|
+
text-transform: none;
|
|
181
|
+
font-family: "Inter", sans-serif;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
h1 {
|
|
185
|
+
font-size: 1.5rem;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.app {
|
|
189
|
+
padding: 20px;
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**tsconfig.json**
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"include": ["./**/*"],
|
|
198
|
+
"compilerOptions": {
|
|
199
|
+
"strict": true,
|
|
200
|
+
"esModuleInterop": true,
|
|
201
|
+
"lib": ["dom", "es2015"],
|
|
202
|
+
"jsx": "react-jsx"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**/App.tsx**
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
import { Banner } from "@czi-sds/components";
|
|
211
|
+
import "./styles.css";
|
|
212
|
+
|
|
213
|
+
function App() {
|
|
214
|
+
return (
|
|
215
|
+
<div className="app">
|
|
216
|
+
<Banner sdsType="primary">
|
|
217
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
218
|
+
</Banner>
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export default App;
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**/index.tsx**
|
|
227
|
+
|
|
228
|
+
```tsx
|
|
229
|
+
import React from "react";
|
|
230
|
+
import { createRoot } from "react-dom/client";
|
|
231
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
232
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
233
|
+
import { Theme } from "@czi-sds/components";
|
|
234
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
235
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
236
|
+
|
|
237
|
+
import App from "./App";
|
|
238
|
+
|
|
239
|
+
const container = document.getElementById("root");
|
|
240
|
+
const root = createRoot(container!);
|
|
241
|
+
|
|
242
|
+
const RootApp = () => {
|
|
243
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
244
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
245
|
+
|
|
246
|
+
return (
|
|
247
|
+
<StyledEngineProvider injectFirst>
|
|
248
|
+
<ThemeProvider theme={theme}>
|
|
249
|
+
<EmotionThemeProvider theme={theme}>
|
|
250
|
+
<CssBaseline />
|
|
251
|
+
<App />
|
|
252
|
+
</EmotionThemeProvider>
|
|
253
|
+
</ThemeProvider>
|
|
254
|
+
</StyledEngineProvider>
|
|
255
|
+
);
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
root.render(
|
|
259
|
+
<React.StrictMode>
|
|
260
|
+
<RootApp />
|
|
261
|
+
</React.StrictMode>
|
|
262
|
+
);
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**/public/index.html**
|
|
266
|
+
|
|
267
|
+
```html
|
|
268
|
+
<!doctype html>
|
|
269
|
+
<html lang="en">
|
|
270
|
+
<head>
|
|
271
|
+
<meta charset="UTF-8" />
|
|
272
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
273
|
+
<title>Banner</title>
|
|
274
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
275
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
276
|
+
<link
|
|
277
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
278
|
+
rel="stylesheet"
|
|
279
|
+
/>
|
|
280
|
+
<link
|
|
281
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
282
|
+
rel="stylesheet"
|
|
283
|
+
/>
|
|
284
|
+
</head>
|
|
285
|
+
<body>
|
|
286
|
+
<div id="root"></div>
|
|
287
|
+
</body>
|
|
288
|
+
</html>
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**/package.json**
|
|
292
|
+
|
|
293
|
+
```json
|
|
294
|
+
{
|
|
295
|
+
"dependencies": {
|
|
296
|
+
"react": "^18.0.0",
|
|
297
|
+
"react-dom": "^18.0.0",
|
|
298
|
+
"react-scripts": "^4.0.0"
|
|
299
|
+
},
|
|
300
|
+
"devDependencies": {
|
|
301
|
+
"@types/react": "^18.0.0",
|
|
302
|
+
"@types/react-dom": "^18.0.0",
|
|
303
|
+
"typescript": "^4.0.0"
|
|
304
|
+
},
|
|
305
|
+
"main": "/index.tsx"
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
#### Persistent Banner
|
|
312
|
+
|
|
313
|
+
This example showcases a `Banner` component that cannot be closed or dismissed.
|
|
314
|
+
|
|
315
|
+
**/styles.css**
|
|
316
|
+
|
|
317
|
+
```css
|
|
318
|
+
body {
|
|
319
|
+
font-size: 13px;
|
|
320
|
+
font-weight: 400;
|
|
321
|
+
letter-spacing: 0.08px;
|
|
322
|
+
line-height: 20px;
|
|
323
|
+
text-transform: none;
|
|
324
|
+
font-family: "Inter", sans-serif;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
h1 {
|
|
328
|
+
font-size: 1.5rem;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.app {
|
|
332
|
+
padding: 20px;
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
**tsconfig.json**
|
|
337
|
+
|
|
338
|
+
```json
|
|
339
|
+
{
|
|
340
|
+
"include": ["./**/*"],
|
|
341
|
+
"compilerOptions": {
|
|
342
|
+
"strict": true,
|
|
343
|
+
"esModuleInterop": true,
|
|
344
|
+
"lib": ["dom", "es2015"],
|
|
345
|
+
"jsx": "react-jsx"
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
**/App.tsx**
|
|
351
|
+
|
|
352
|
+
```tsx
|
|
353
|
+
import { Banner } from "@czi-sds/components";
|
|
354
|
+
import "./styles.css";
|
|
355
|
+
|
|
356
|
+
function App() {
|
|
357
|
+
return (
|
|
358
|
+
<div className="app">
|
|
359
|
+
<Banner sdsType="primary" dismissible={false}>
|
|
360
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
361
|
+
</Banner>
|
|
362
|
+
</div>
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export default App;
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
**/index.tsx**
|
|
370
|
+
|
|
371
|
+
```tsx
|
|
372
|
+
import React from "react";
|
|
373
|
+
import { createRoot } from "react-dom/client";
|
|
374
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
375
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
376
|
+
import { Theme } from "@czi-sds/components";
|
|
377
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
378
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
379
|
+
|
|
380
|
+
import App from "./App";
|
|
381
|
+
|
|
382
|
+
const container = document.getElementById("root");
|
|
383
|
+
const root = createRoot(container!);
|
|
384
|
+
|
|
385
|
+
const RootApp = () => {
|
|
386
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
387
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
388
|
+
|
|
389
|
+
return (
|
|
390
|
+
<StyledEngineProvider injectFirst>
|
|
391
|
+
<ThemeProvider theme={theme}>
|
|
392
|
+
<EmotionThemeProvider theme={theme}>
|
|
393
|
+
<CssBaseline />
|
|
394
|
+
<App />
|
|
395
|
+
</EmotionThemeProvider>
|
|
396
|
+
</ThemeProvider>
|
|
397
|
+
</StyledEngineProvider>
|
|
398
|
+
);
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
root.render(
|
|
402
|
+
<React.StrictMode>
|
|
403
|
+
<RootApp />
|
|
404
|
+
</React.StrictMode>
|
|
405
|
+
);
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
**/public/index.html**
|
|
409
|
+
|
|
410
|
+
```html
|
|
411
|
+
<!doctype html>
|
|
412
|
+
<html lang="en">
|
|
413
|
+
<head>
|
|
414
|
+
<meta charset="UTF-8" />
|
|
415
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
416
|
+
<title>Banner</title>
|
|
417
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
418
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
419
|
+
<link
|
|
420
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
421
|
+
rel="stylesheet"
|
|
422
|
+
/>
|
|
423
|
+
<link
|
|
424
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
425
|
+
rel="stylesheet"
|
|
426
|
+
/>
|
|
427
|
+
</head>
|
|
428
|
+
<body>
|
|
429
|
+
<div id="root"></div>
|
|
430
|
+
</body>
|
|
431
|
+
</html>
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
**/package.json**
|
|
435
|
+
|
|
436
|
+
```json
|
|
437
|
+
{
|
|
438
|
+
"dependencies": {
|
|
439
|
+
"react": "^18.0.0",
|
|
440
|
+
"react-dom": "^18.0.0",
|
|
441
|
+
"react-scripts": "^4.0.0"
|
|
442
|
+
},
|
|
443
|
+
"devDependencies": {
|
|
444
|
+
"@types/react": "^18.0.0",
|
|
445
|
+
"@types/react-dom": "^18.0.0",
|
|
446
|
+
"typescript": "^4.0.0"
|
|
447
|
+
},
|
|
448
|
+
"main": "/index.tsx"
|
|
449
|
+
}
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
#### Banner with a custom background color
|
|
455
|
+
|
|
456
|
+
This example shows how to implement a `Banner` component with a custom background color.
|
|
457
|
+
|
|
458
|
+
**/styles.css**
|
|
459
|
+
|
|
460
|
+
```css
|
|
461
|
+
body {
|
|
462
|
+
font-size: 13px;
|
|
463
|
+
font-weight: 400;
|
|
464
|
+
letter-spacing: 0.08px;
|
|
465
|
+
line-height: 20px;
|
|
466
|
+
text-transform: none;
|
|
467
|
+
font-family: "Inter", sans-serif;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
h1 {
|
|
471
|
+
font-size: 1.5rem;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.app {
|
|
475
|
+
padding: 20px;
|
|
476
|
+
}
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
**tsconfig.json**
|
|
480
|
+
|
|
481
|
+
```json
|
|
482
|
+
{
|
|
483
|
+
"include": ["./**/*"],
|
|
484
|
+
"compilerOptions": {
|
|
485
|
+
"strict": true,
|
|
486
|
+
"esModuleInterop": true,
|
|
487
|
+
"lib": ["dom", "es2015"],
|
|
488
|
+
"jsx": "react-jsx"
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
**/App.tsx**
|
|
494
|
+
|
|
495
|
+
```tsx
|
|
496
|
+
import { styled } from "@mui/material/styles";
|
|
497
|
+
import { Banner } from "@czi-sds/components";
|
|
498
|
+
import "./styles.css";
|
|
499
|
+
|
|
500
|
+
function App() {
|
|
501
|
+
const StyledBanner = styled(Banner)`
|
|
502
|
+
background-color: Crimson;
|
|
503
|
+
`;
|
|
504
|
+
return (
|
|
505
|
+
<div className="app">
|
|
506
|
+
<StyledBanner sdsType="primary">
|
|
507
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
508
|
+
</StyledBanner>
|
|
509
|
+
</div>
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
export default App;
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
**/index.tsx**
|
|
517
|
+
|
|
518
|
+
```tsx
|
|
519
|
+
import React from "react";
|
|
520
|
+
import { createRoot } from "react-dom/client";
|
|
521
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
522
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
523
|
+
import { Theme } from "@czi-sds/components";
|
|
524
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
525
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
526
|
+
|
|
527
|
+
import App from "./App";
|
|
528
|
+
|
|
529
|
+
const container = document.getElementById("root");
|
|
530
|
+
const root = createRoot(container!);
|
|
531
|
+
|
|
532
|
+
const RootApp = () => {
|
|
533
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
534
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
535
|
+
|
|
536
|
+
return (
|
|
537
|
+
<StyledEngineProvider injectFirst>
|
|
538
|
+
<ThemeProvider theme={theme}>
|
|
539
|
+
<EmotionThemeProvider theme={theme}>
|
|
540
|
+
<CssBaseline />
|
|
541
|
+
<App />
|
|
542
|
+
</EmotionThemeProvider>
|
|
543
|
+
</ThemeProvider>
|
|
544
|
+
</StyledEngineProvider>
|
|
545
|
+
);
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
root.render(
|
|
549
|
+
<React.StrictMode>
|
|
550
|
+
<RootApp />
|
|
551
|
+
</React.StrictMode>
|
|
552
|
+
);
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
**/public/index.html**
|
|
556
|
+
|
|
557
|
+
```html
|
|
558
|
+
<!doctype html>
|
|
559
|
+
<html lang="en">
|
|
560
|
+
<head>
|
|
561
|
+
<meta charset="UTF-8" />
|
|
562
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
563
|
+
<title>Banner</title>
|
|
564
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
565
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
566
|
+
<link
|
|
567
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
568
|
+
rel="stylesheet"
|
|
569
|
+
/>
|
|
570
|
+
<link
|
|
571
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
572
|
+
rel="stylesheet"
|
|
573
|
+
/>
|
|
574
|
+
</head>
|
|
575
|
+
<body>
|
|
576
|
+
<div id="root"></div>
|
|
577
|
+
</body>
|
|
578
|
+
</html>
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
**/package.json**
|
|
582
|
+
|
|
583
|
+
```json
|
|
584
|
+
{
|
|
585
|
+
"dependencies": {
|
|
586
|
+
"react": "^18.0.0",
|
|
587
|
+
"react-dom": "^18.0.0",
|
|
588
|
+
"react-scripts": "^4.0.0"
|
|
589
|
+
},
|
|
590
|
+
"devDependencies": {
|
|
591
|
+
"@types/react": "^18.0.0",
|
|
592
|
+
"@types/react-dom": "^18.0.0",
|
|
593
|
+
"typescript": "^4.0.0"
|
|
594
|
+
},
|
|
595
|
+
"main": "/index.tsx"
|
|
596
|
+
}
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
---
|