@czi-sds/mcp 0.2.2 → 0.3.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/zeroheight-cache.json +5195 -0
- package/data/zeroheight-exports/Accordion.md +675 -0
- package/data/zeroheight-exports/Banner.md +576 -0
- package/data/zeroheight-exports/Borders.md +118 -0
- package/data/zeroheight-exports/Buttons.md +2260 -0
- package/data/zeroheight-exports/Callout.md +756 -0
- package/data/zeroheight-exports/Colors.md +633 -0
- package/data/zeroheight-exports/Content-Card.md +162 -0
- package/data/zeroheight-exports/Contributing-to-SDS.md +99 -0
- package/data/zeroheight-exports/Control-Inputs.md +2066 -0
- package/data/zeroheight-exports/Corners.md +112 -0
- package/data/zeroheight-exports/Cover-page.md +4 -0
- package/data/zeroheight-exports/Dialog.md +1133 -0
- package/data/zeroheight-exports/Downloads.md +121 -0
- package/data/zeroheight-exports/Drop-Shadows.md +80 -0
- package/data/zeroheight-exports/Dropdown-Input.md +1149 -0
- package/data/zeroheight-exports/Dropdown-Menu.md +3787 -0
- package/data/zeroheight-exports/Element-Status-Tracker.md +268 -0
- package/data/zeroheight-exports/Field-Inputs.md +965 -0
- package/data/zeroheight-exports/Filters.md +868 -0
- package/data/zeroheight-exports/Getting-Started.md +1296 -0
- package/data/zeroheight-exports/Hero.md +256 -0
- package/data/zeroheight-exports/Icons.md +432 -0
- package/data/zeroheight-exports/Intent.md +47 -0
- package/data/zeroheight-exports/Introduction-to-Bases.md +36 -0
- package/data/zeroheight-exports/Introduction-to-Cells.md +36 -0
- package/data/zeroheight-exports/Introduction-to-DNA.md +36 -0
- package/data/zeroheight-exports/Introduction-to-Genes.md +36 -0
- package/data/zeroheight-exports/Introduction.md +116 -0
- package/data/zeroheight-exports/Link.md +373 -0
- package/data/zeroheight-exports/Lists.md +617 -0
- package/data/zeroheight-exports/Loading-Indicator.md +38 -0
- package/data/zeroheight-exports/Navigation.md +853 -0
- package/data/zeroheight-exports/Notification.md +858 -0
- package/data/zeroheight-exports/Panel.md +862 -0
- package/data/zeroheight-exports/README.md +124 -0
- package/data/zeroheight-exports/Responsive-Design.md +275 -0
- package/data/zeroheight-exports/Search-Input.md +54 -0
- package/data/zeroheight-exports/Search.md +609 -0
- package/data/zeroheight-exports/Segmented-Control.md +561 -0
- package/data/zeroheight-exports/Spacing.md +298 -0
- package/data/zeroheight-exports/Table.md +4832 -0
- package/data/zeroheight-exports/Tabs.md +773 -0
- package/data/zeroheight-exports/Tags.md +1025 -0
- package/data/zeroheight-exports/Text-Link.md +185 -0
- package/data/zeroheight-exports/Theming.md +313 -0
- package/data/zeroheight-exports/Tooltips.md +1564 -0
- package/data/zeroheight-exports/Typography.md +769 -0
- package/dist/stdio.js +188 -0
- package/package.json +4 -3
|
@@ -0,0 +1,862 @@
|
|
|
1
|
+
# Panels
|
|
2
|
+
|
|
3
|
+
Panels are elements that contain supplementary information or actions for the page's content they appear on. Where and how they display is determined by the type of content on them.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
## Basic Panel
|
|
8
|
+
|
|
9
|
+
| | In Figma | | | Meets Accessibility | | | In CZ GEN EPI Codebase |
|
|
10
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
11
|
+
|
|
12
|
+
Panels are comprised of containers within which other elements are placed. Use the Basic Panel when the elements contained within it are able to functionally adjust the content on the page next to it. In CZ GEN EPI's case, the Basic Panel is positioned on the left-hand side of the screen and contains Filters.
|
|
13
|
+
|
|
14
|
+
### Basic Panel Example
|
|
15
|
+
|
|
16
|
+
The example below shows where in CZ GEN EPI the Basic Panel is used.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Code
|
|
21
|
+
|
|
22
|
+
## Panel Components
|
|
23
|
+
|
|
24
|
+
| Below you will find an interactive Storybook iframe for Panels. 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:** PanelBasic |
|
|
25
|
+
| --- | --- | --- |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
>This component appears as it is in the default SDS codebase. Once imported into the CZ GEN EPI codebase, use a theme file to enable the CZ GEN EPI visual appearance customization.
|
|
30
|
+
|
|
31
|
+
### PanelBasic (coming soon)
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
Panels are elements that contain supplementary information or actions for the page's content they appear on. Where and how they display is determined by the type of content on them.
|
|
36
|
+
|
|
37
|
+
## Overview
|
|
38
|
+
|
|
39
|
+
## Panel Variants
|
|
40
|
+
|
|
41
|
+
| Panels are comprised of containers within which other elements are placed. They come in two different variants for designers to use depending on the type of content and elements contained within them. These variants also establish how the Panel functions and appears on the page, whether within the flow of the page's content or outside of it, on top of other elements. Follow the usage criteria accompanying each variant as a guide for selecting the correct Panel for any given use case. | | **Jump to variant:** Basic Overlay |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Basic Panel
|
|
47
|
+
|
|
48
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
49
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
50
|
+
|
|
51
|
+
### Basic Panel
|
|
52
|
+
|
|
53
|
+
Use the Basic Panel when the elements contained within it are able to functionally adjust the content on the page, such as filters or dataset selectors. Basic Panels can be toggled open or closed using an Icon Button. When toggled open, the page's content is resized to make room for the Panel.
|
|
54
|
+
|
|
55
|
+
Basic Panels can be positioned on the left or right side of the screen using the `position` prop. If needed, designers can have up to two Panels per page, one of the left and one on the right.
|
|
56
|
+
|
|
57
|
+
Although Basic Panels can be designed to contain a wide range of elements, there are a few common configurations used within the products today that have been turned into templates: Filter Panel, Info Panel, and Info Panel with Accordions (templates coming soon).
|
|
58
|
+
|
|
59
|
+
### Basic Panel Examples
|
|
60
|
+
|
|
61
|
+
The examples below show where in CZ ID the Basic Panel is currently being used.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Overlay Panel
|
|
68
|
+
|
|
69
|
+
| | In Figma | | | Meets Accessibility | | | In CZ ID Codebase |
|
|
70
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
71
|
+
|
|
72
|
+
### Overlay Panel
|
|
73
|
+
|
|
74
|
+
Use the Overlay Panel when needing to display supplementary information about the content on the underlying page. The elements on the Overlay Panel cannot functionally adjust the content on the page below it. Overlay Panels can be toggled open or closed using a range of different Button types (Rounded, Square, Minimal, and Icon Buttons). When active, like its name suggests, the Overlay Panel appears on top of the other content on the page, outside of the page's flow.
|
|
75
|
+
|
|
76
|
+
Overlay Panels can be positioned on the bottom or right side of the screen using the `position` prop. Use the bottom-positioned Overlay Panel when the content contained on it is wider than it is tall. Designers can have as many Overlay Panels per page as needed, but only one can be triggered at any time. If one is currently open and another is triggered, the opened Overlay Panel will close before the newly triggered one opens.
|
|
77
|
+
|
|
78
|
+
Although Overlay Panels can be designed to contain a wide range of elements, there are a few common configurations used within the products today that have been turned into templates: Sample Details, Taxon Details, Genes Details, and Pipeline Information (templates coming soon).
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### Overlay Panel Examples
|
|
83
|
+
|
|
84
|
+
The examples below show where in CZ ID the Overlay Panel is currently being used.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Code
|
|
89
|
+
|
|
90
|
+
## Panel Components
|
|
91
|
+
|
|
92
|
+
| Below you will find an interactive Storybook iframe for Panels. 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:** PanelBasic PanelOverlay |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### PanelBasic (coming soon)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### PanelOverlay (coming soon)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
Panels are elements that contain supplementary information or actions for the page's content they appear on. Where and how they display is determined by the type of content on them.
|
|
110
|
+
|
|
111
|
+
## Guidelines
|
|
112
|
+
|
|
113
|
+
## Panel Components
|
|
114
|
+
|
|
115
|
+
| Panels contain containers within which other elements are placed. They come in two different variants depending on the type of content and elements contained within them and their functionality, whether appearing on the page, within the flow of the page's content or outside of it, on top of other elements. | | **Jump to variant:** Basic Overlay |
|
|
116
|
+
| --- | --- | --- |
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Panel – Basic
|
|
121
|
+
|
|
122
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
123
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
124
|
+
|
|
125
|
+
### Panel – Basic Anatomy
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### Overview
|
|
130
|
+
|
|
131
|
+
Use Panel – Basic when the elements contained within it are able to make adjustments to the content on the page, such as filters or dataset selectors. Panel – Basic is toggled open or closed using a Button placed on the page (as opposed to contained within the Panel itself). When toggled open, the page's content is resized to make room for the Panel.
|
|
132
|
+
|
|
133
|
+
Panel – Basic can be positioned on the left or right side of the screen. Both sides can be open at the same time.
|
|
134
|
+
|
|
135
|
+
| Left | Right |
|
|
136
|
+
| :---: | :---: |
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### Panel – Basic Spacing
|
|
141
|
+
|
|
142
|
+
These rules establish how much margin should exist to the left or right of an opened Panel – Basic.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Panel – Overlay
|
|
147
|
+
|
|
148
|
+
| | In Figma | | | Meets Accessibility | | | In Code |
|
|
149
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
150
|
+
|
|
151
|
+
### Panel – Overlay Anatomy
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
### Overview
|
|
156
|
+
|
|
157
|
+
Use Panel – Overlay when needing to display supplementary information about a piece of content on the page beneath it; the elements on Panel – Overlay cannot make adjustments to the page's content. When active, like its name suggests, the Panel – Overlay appears on top of the other content on the page, outside of the page's flow. Panel – Overlay is toggled open by any Button on the page and is closed by clicking the same on-page Button or using the close Button built into panel itself.
|
|
158
|
+
|
|
159
|
+
Panel – Overlay can be positioned on the bottom, left, or right side of the screen; use the bottom-positioned Panel – Overlay when the content contained on it is wider than it is tall. A page can contain as many Panel - Overlays per page as needed, but only one can be open at a time. If one is currently open and another is triggered to open, the currently opened Panel – Overlay will close before the newly triggered one opens.
|
|
160
|
+
|
|
161
|
+
| Bottom | Left | Right |
|
|
162
|
+
| :---: | :---: | :---: |
|
|
163
|
+
|
|
164
|
+
## Code
|
|
165
|
+
|
|
166
|
+
>**Note:** The code examples below must install dependencies before displaying and may take extra time to load
|
|
167
|
+
|
|
168
|
+
## Panel
|
|
169
|
+
|
|
170
|
+
### SDS Source Code
|
|
171
|
+
|
|
172
|
+
The component's source code in the SDS codebase can be found here.
|
|
173
|
+
|
|
174
|
+
### SDS vs MUI
|
|
175
|
+
|
|
176
|
+
The SDS `Panel` component is built upon the MUI `Drawer` component, but with several key differences:
|
|
177
|
+
|
|
178
|
+
* **Variant vs sdsType:** In MUI’s Drawer, the `variant` prop determines the type of drawer (e.g., persistent, temporary). However, in SDS’s Panel, this is replaced by the `sdsType` prop, which takes two values: `"basic"` and `"overlay"`.
|
|
179
|
+
* `"basic"` corresponds to MUI’s persistent drawer.
|
|
180
|
+
* `"overlay"` corresponds to MUI’s temporary drawer.
|
|
181
|
+
* **Position vs Anchor**: Unlike MUI’s Drawer, which uses the `anchor` prop to determine the placement of the drawer (left, right, top, or bottom), the SDS Panel uses a `position` prop.
|
|
182
|
+
* The `"basic"` Panel can only be positioned to the `left` or `right`.
|
|
183
|
+
* The `"overlay"` Panel can be positioned to the `left`, `right`, or `bottom`.
|
|
184
|
+
* **Width Prop:** The SDS Panel allows control over the width of the panel using the width prop.
|
|
185
|
+
* The default width is **240px** for the `"basic"` panel.
|
|
186
|
+
* The default width is **320px** for the `"overlay"` panel.
|
|
187
|
+
* **Custom Header and Close Button Components:** The `"overlay"` Panel in SDS introduces two additional props that are not available in MUI’s Drawer: `headerComponent` and `closeButtonComponent`. These allow for custom components to be rendered in the panel’s header section, providing greater flexibility for design and functionality.
|
|
188
|
+
|
|
189
|
+
### MUI Documentation
|
|
190
|
+
|
|
191
|
+
Documentation for the underlying MUI component can be found here.
|
|
192
|
+
|
|
193
|
+
### Props
|
|
194
|
+
|
|
195
|
+
Any custom SDS props and MUI props required for implementation are found on the table below. See the MUI documentation for additional optional props.
|
|
196
|
+
|
|
197
|
+
| Name | Type | Default | Description |
|
|
198
|
+
| --- | --- | --- | --- |
|
|
199
|
+
| `sdsType` | `"basic"` | `"overlay"` | `"basic"` | `"basic"` corresponds to a persistent drawer, and `"overlay"` corresponds to a temporary drawer. |
|
|
200
|
+
| `position` | `"left"` | `"right"` | `"bottom"` (only for overlay) | `"left"` | Determines the panel’s position. The `"basic"` panel supports only `"left"` and `"right"`, while the `"overlay"` panel also supports `"bottom"`. |
|
|
201
|
+
| `width` | `number` | `string` | `"240px"` (basic) | `"320px"` (overlay) | Specifies the `width` of the panel. |
|
|
202
|
+
| `headerComponent` | `React.ReactNode` | `undefined` | For the `"overlay"` panel only, this prop allows you to pass a custom component to be rendered as the panel’s header. |
|
|
203
|
+
| `closeButtonComponent` | `React.ReactNode` | <Button sdsStyle="icon" sdsType="tertiary" icon="XMark" aria-label="Panel Toggle" /> | For the `"overlay"` panel only, this prop allows you to pass a custom component to be rendered as the close button. |
|
|
204
|
+
| `closeButtonOnClick` | `React.MouseEventHandler<HTMLDivElement>` | `undefined` | For the `"overlay"` panel only, this is the onClick event handler for the close button. |
|
|
205
|
+
|
|
206
|
+
### Code examples
|
|
207
|
+
|
|
208
|
+
#### Basic Panel
|
|
209
|
+
|
|
210
|
+
This example demonstrates the most basic usage of the `Panel` component with default props.
|
|
211
|
+
|
|
212
|
+
**/styles.css**
|
|
213
|
+
|
|
214
|
+
```css
|
|
215
|
+
body {
|
|
216
|
+
font-size: 13px;
|
|
217
|
+
font-weight: 400;
|
|
218
|
+
letter-spacing: 0.08px;
|
|
219
|
+
line-height: 20px;
|
|
220
|
+
text-transform: none;
|
|
221
|
+
font-family: "Inter", sans-serif;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
h1 {
|
|
225
|
+
font-size: 1.5rem;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.app {
|
|
229
|
+
padding: 20px;
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**tsconfig.json**
|
|
234
|
+
|
|
235
|
+
```json
|
|
236
|
+
{
|
|
237
|
+
"include": [
|
|
238
|
+
"./**/*"
|
|
239
|
+
],
|
|
240
|
+
"compilerOptions": {
|
|
241
|
+
"strict": true,
|
|
242
|
+
"esModuleInterop": true,
|
|
243
|
+
"lib": [ "dom", "es2015" ],
|
|
244
|
+
"jsx": "react-jsx"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**/App.tsx**
|
|
250
|
+
|
|
251
|
+
```tsx
|
|
252
|
+
import { useState } from "react";
|
|
253
|
+
import { Button, Panel } from "@czi-sds/components";
|
|
254
|
+
import { Box } from "@mui/material";
|
|
255
|
+
import "./styles.css";
|
|
256
|
+
|
|
257
|
+
function App() {
|
|
258
|
+
const [open, setOpen] = useState(true);
|
|
259
|
+
|
|
260
|
+
const Main = (
|
|
261
|
+
props: { open: boolean; children?: React.ReactNode }
|
|
262
|
+
) => {
|
|
263
|
+
const { open, children } = props;
|
|
264
|
+
|
|
265
|
+
const margin = "0 0 0 250px";
|
|
266
|
+
|
|
267
|
+
return (
|
|
268
|
+
<Box
|
|
269
|
+
sx={{
|
|
270
|
+
margin: open ? margin : "none",
|
|
271
|
+
}}
|
|
272
|
+
>
|
|
273
|
+
{children}
|
|
274
|
+
</Box>
|
|
275
|
+
);
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
return (
|
|
279
|
+
<div className="app">
|
|
280
|
+
<Main open={open}>
|
|
281
|
+
<Button
|
|
282
|
+
sdsType="primary"
|
|
283
|
+
sdsStyle="icon"
|
|
284
|
+
icon="InfoCircle"
|
|
285
|
+
onClick={() => setOpen((prev) => !prev)}
|
|
286
|
+
aria-label="Panel Toggle"
|
|
287
|
+
>
|
|
288
|
+
Toggle Panel
|
|
289
|
+
</Button>
|
|
290
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus facilisis tortor et pellentesque pulvinar. Ut at convallis ipsum. Nullam scelerisque tempor arcu, quis pretium magna semper eu. Nam hendrerit lectus in enim scelerisque, sed ornare sapien consequat. Proin sed congue quam. Integer consequat elit tristique sodales rhoncus. In bibendum dolor sit amet erat porta, nec posuere nibh consectetur. Cras scelerisque interdum eros ut porta. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut in lacus et mi efficitur scelerisque. Pellentesque congue purus eu feugiat cursus. Phasellus urna massa, sollicitudin id elit et, efficitur faucibus nibh.</p>
|
|
291
|
+
<p>Nam sit amet tortor varius, lacinia velit quis, lacinia metus. Quisque dictum, nulla at luctus fringilla, ligula diam fringilla nisl, non consequat nulla turpis at ex. Donec hendrerit facilisis nisl at fringilla. Pellentesque posuere tortor ac ante luctus, at euismod augue vulputate. Vivamus pretium pretium nisi, non convallis nunc volutpat ac. Nam finibus justo leo, vel pellentesque velit gravida vel. Sed in turpis non sem efficitur eleifend vel ac lacus. Sed volutpat feugiat dictum. Pellentesque tristique mollis magna sit amet vestibulum. Nulla ac tellus eu orci volutpat congue. In vitae dolor et est feugiat fringilla. Sed varius neque nunc, sed pulvinar neque lobortis posuere.</p>
|
|
292
|
+
<Panel open={open}>
|
|
293
|
+
[Panel Content]
|
|
294
|
+
</Panel>
|
|
295
|
+
</Main>
|
|
296
|
+
</div>
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export default App;
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**/index.tsx**
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
import React from "react";
|
|
307
|
+
import { createRoot } from "react-dom/client";
|
|
308
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
309
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
310
|
+
import { Theme } from "@czi-sds/components";
|
|
311
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
312
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
313
|
+
|
|
314
|
+
import App from "./App";
|
|
315
|
+
|
|
316
|
+
const container = document.getElementById("root");
|
|
317
|
+
const root = createRoot(container!);
|
|
318
|
+
|
|
319
|
+
const RootApp = () => {
|
|
320
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
321
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
322
|
+
|
|
323
|
+
return (
|
|
324
|
+
<StyledEngineProvider injectFirst>
|
|
325
|
+
<ThemeProvider theme={theme}>
|
|
326
|
+
<EmotionThemeProvider theme={theme}>
|
|
327
|
+
<CssBaseline />
|
|
328
|
+
<App />
|
|
329
|
+
</EmotionThemeProvider>
|
|
330
|
+
</ThemeProvider>
|
|
331
|
+
</StyledEngineProvider>
|
|
332
|
+
);
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
root.render(
|
|
336
|
+
<React.StrictMode>
|
|
337
|
+
<RootApp />
|
|
338
|
+
</React.StrictMode>
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
**/public/index.html**
|
|
344
|
+
|
|
345
|
+
```html
|
|
346
|
+
<!DOCTYPE html>
|
|
347
|
+
<html lang="en">
|
|
348
|
+
<head>
|
|
349
|
+
<meta charset="UTF-8" />
|
|
350
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
351
|
+
<title>Panel</title>
|
|
352
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
353
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
354
|
+
<link
|
|
355
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
356
|
+
rel="stylesheet"
|
|
357
|
+
/>
|
|
358
|
+
<link
|
|
359
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
360
|
+
rel="stylesheet"
|
|
361
|
+
/>
|
|
362
|
+
</head>
|
|
363
|
+
<body>
|
|
364
|
+
<div id="root"></div>
|
|
365
|
+
</body>
|
|
366
|
+
</html>
|
|
367
|
+
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
**/package.json**
|
|
371
|
+
|
|
372
|
+
```json
|
|
373
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
**Overlay Panel**
|
|
379
|
+
|
|
380
|
+
This example shows how to use the `Panel` component as an overlay. The overlay version allows the panel to slide in over the existing content, typically used for side panels or modal-like interactions. It can be triggered by a button or any other interactive element.
|
|
381
|
+
|
|
382
|
+
**/styles.css**
|
|
383
|
+
|
|
384
|
+
```css
|
|
385
|
+
body {
|
|
386
|
+
font-size: 13px;
|
|
387
|
+
font-weight: 400;
|
|
388
|
+
letter-spacing: 0.08px;
|
|
389
|
+
line-height: 20px;
|
|
390
|
+
text-transform: none;
|
|
391
|
+
font-family: "Inter", sans-serif;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
h1 {
|
|
395
|
+
font-size: 1.5rem;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.app {
|
|
399
|
+
padding: 20px;
|
|
400
|
+
}
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**tsconfig.json**
|
|
404
|
+
|
|
405
|
+
```json
|
|
406
|
+
{
|
|
407
|
+
"include": [
|
|
408
|
+
"./**/*"
|
|
409
|
+
],
|
|
410
|
+
"compilerOptions": {
|
|
411
|
+
"strict": true,
|
|
412
|
+
"esModuleInterop": true,
|
|
413
|
+
"lib": [ "dom", "es2015" ],
|
|
414
|
+
"jsx": "react-jsx"
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**/App.tsx**
|
|
420
|
+
|
|
421
|
+
```tsx
|
|
422
|
+
import { useState } from "react";
|
|
423
|
+
import { Button, Panel } from "@czi-sds/components";
|
|
424
|
+
import { Box } from "@mui/material";
|
|
425
|
+
import "./styles.css";
|
|
426
|
+
|
|
427
|
+
function App() {
|
|
428
|
+
const [open, setOpen] = useState(true);
|
|
429
|
+
|
|
430
|
+
return (
|
|
431
|
+
<div className="app">
|
|
432
|
+
<Button
|
|
433
|
+
sdsType="primary"
|
|
434
|
+
sdsStyle="icon"
|
|
435
|
+
icon="InfoCircle"
|
|
436
|
+
onClick={() => setOpen((prev) => !prev)}
|
|
437
|
+
aria-label="Panel Toggle"
|
|
438
|
+
>
|
|
439
|
+
Toggle Panel
|
|
440
|
+
</Button>
|
|
441
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus facilisis tortor et pellentesque pulvinar. Ut at convallis ipsum. Nullam scelerisque tempor arcu, quis pretium magna semper eu. Nam hendrerit lectus in enim scelerisque, sed ornare sapien consequat. Proin sed congue quam. Integer consequat elit tristique sodales rhoncus. In bibendum dolor sit amet erat porta, nec posuere nibh consectetur. Cras scelerisque interdum eros ut porta. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut in lacus et mi efficitur scelerisque. Pellentesque congue purus eu feugiat cursus. Phasellus urna massa, sollicitudin id elit et, efficitur faucibus nibh.</p>
|
|
442
|
+
<p>Nam sit amet tortor varius, lacinia velit quis, lacinia metus. Quisque dictum, nulla at luctus fringilla, ligula diam fringilla nisl, non consequat nulla turpis at ex. Donec hendrerit facilisis nisl at fringilla. Pellentesque posuere tortor ac ante luctus, at euismod augue vulputate. Vivamus pretium pretium nisi, non convallis nunc volutpat ac. Nam finibus justo leo, vel pellentesque velit gravida vel. Sed in turpis non sem efficitur eleifend vel ac lacus. Sed volutpat feugiat dictum. Pellentesque tristique mollis magna sit amet vestibulum. Nulla ac tellus eu orci volutpat congue. In vitae dolor et est feugiat fringilla. Sed varius neque nunc, sed pulvinar neque lobortis posuere.</p>
|
|
443
|
+
<Panel open={open} sdsType="overlay" closeButtonOnClick={() => setOpen(false)}>
|
|
444
|
+
[Panel Content]
|
|
445
|
+
</Panel>
|
|
446
|
+
</div>
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export default App;
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
**/index.tsx**
|
|
454
|
+
|
|
455
|
+
```tsx
|
|
456
|
+
import React from "react";
|
|
457
|
+
import { createRoot } from "react-dom/client";
|
|
458
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
459
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
460
|
+
import { Theme } from "@czi-sds/components";
|
|
461
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
462
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
463
|
+
|
|
464
|
+
import App from "./App";
|
|
465
|
+
|
|
466
|
+
const container = document.getElementById("root");
|
|
467
|
+
const root = createRoot(container!);
|
|
468
|
+
|
|
469
|
+
const RootApp = () => {
|
|
470
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
471
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
472
|
+
|
|
473
|
+
return (
|
|
474
|
+
<StyledEngineProvider injectFirst>
|
|
475
|
+
<ThemeProvider theme={theme}>
|
|
476
|
+
<EmotionThemeProvider theme={theme}>
|
|
477
|
+
<CssBaseline />
|
|
478
|
+
<App />
|
|
479
|
+
</EmotionThemeProvider>
|
|
480
|
+
</ThemeProvider>
|
|
481
|
+
</StyledEngineProvider>
|
|
482
|
+
);
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
root.render(
|
|
486
|
+
<React.StrictMode>
|
|
487
|
+
<RootApp />
|
|
488
|
+
</React.StrictMode>
|
|
489
|
+
);
|
|
490
|
+
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
**/public/index.html**
|
|
494
|
+
|
|
495
|
+
```html
|
|
496
|
+
<!DOCTYPE html>
|
|
497
|
+
<html lang="en">
|
|
498
|
+
<head>
|
|
499
|
+
<meta charset="UTF-8" />
|
|
500
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
501
|
+
<title>Panel</title>
|
|
502
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
503
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
504
|
+
<link
|
|
505
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
506
|
+
rel="stylesheet"
|
|
507
|
+
/>
|
|
508
|
+
<link
|
|
509
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
510
|
+
rel="stylesheet"
|
|
511
|
+
/>
|
|
512
|
+
</head>
|
|
513
|
+
<body>
|
|
514
|
+
<div id="root"></div>
|
|
515
|
+
</body>
|
|
516
|
+
</html>
|
|
517
|
+
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
**/package.json**
|
|
521
|
+
|
|
522
|
+
```json
|
|
523
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
---
|
|
527
|
+
|
|
528
|
+
**Overlay Panel with Custom Header (opens from right)**
|
|
529
|
+
|
|
530
|
+
This example demonstrates how to implement an overlay `Panel` with a custom header component. The panel still retains the overlay behavior, sliding over the existing content when triggered.
|
|
531
|
+
|
|
532
|
+
**/styles.css**
|
|
533
|
+
|
|
534
|
+
```css
|
|
535
|
+
body {
|
|
536
|
+
font-size: 13px;
|
|
537
|
+
font-weight: 400;
|
|
538
|
+
letter-spacing: 0.08px;
|
|
539
|
+
line-height: 20px;
|
|
540
|
+
text-transform: none;
|
|
541
|
+
font-family: "Inter", sans-serif;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
h1 {
|
|
545
|
+
font-size: 1.5rem;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.app {
|
|
549
|
+
padding: 20px;
|
|
550
|
+
}
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
**tsconfig.json**
|
|
554
|
+
|
|
555
|
+
```json
|
|
556
|
+
{
|
|
557
|
+
"include": [
|
|
558
|
+
"./**/*"
|
|
559
|
+
],
|
|
560
|
+
"compilerOptions": {
|
|
561
|
+
"strict": true,
|
|
562
|
+
"esModuleInterop": true,
|
|
563
|
+
"lib": [ "dom", "es2015" ],
|
|
564
|
+
"jsx": "react-jsx"
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
**/App.tsx**
|
|
570
|
+
|
|
571
|
+
```tsx
|
|
572
|
+
import { useState } from "react";
|
|
573
|
+
import { Button, Panel } from "@czi-sds/components";
|
|
574
|
+
import { Box, Typography } from "@mui/material";
|
|
575
|
+
import "./styles.css";
|
|
576
|
+
|
|
577
|
+
function App() {
|
|
578
|
+
const [open, setOpen] = useState(true);
|
|
579
|
+
|
|
580
|
+
const HeaderComponent = (
|
|
581
|
+
<Typography variant="h2">
|
|
582
|
+
Panel Header
|
|
583
|
+
</Typography>
|
|
584
|
+
);
|
|
585
|
+
|
|
586
|
+
return (
|
|
587
|
+
<div className="app">
|
|
588
|
+
<Button
|
|
589
|
+
sdsType="primary"
|
|
590
|
+
sdsStyle="icon"
|
|
591
|
+
icon="InfoCircle"
|
|
592
|
+
onClick={() => setOpen((prev) => !prev)}
|
|
593
|
+
aria-label="Panel Toggle"
|
|
594
|
+
>
|
|
595
|
+
Toggle Panel
|
|
596
|
+
</Button>
|
|
597
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus facilisis tortor et pellentesque pulvinar. Ut at convallis ipsum. Nullam scelerisque tempor arcu, quis pretium magna semper eu. Nam hendrerit lectus in enim scelerisque, sed ornare sapien consequat. Proin sed congue quam. Integer consequat elit tristique sodales rhoncus. In bibendum dolor sit amet erat porta, nec posuere nibh consectetur. Cras scelerisque interdum eros ut porta. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut in lacus et mi efficitur scelerisque. Pellentesque congue purus eu feugiat cursus. Phasellus urna massa, sollicitudin id elit et, efficitur faucibus nibh.</p>
|
|
598
|
+
<p>Nam sit amet tortor varius, lacinia velit quis, lacinia metus. Quisque dictum, nulla at luctus fringilla, ligula diam fringilla nisl, non consequat nulla turpis at ex. Donec hendrerit facilisis nisl at fringilla. Pellentesque posuere tortor ac ante luctus, at euismod augue vulputate. Vivamus pretium pretium nisi, non convallis nunc volutpat ac. Nam finibus justo leo, vel pellentesque velit gravida vel. Sed in turpis non sem efficitur eleifend vel ac lacus. Sed volutpat feugiat dictum. Pellentesque tristique mollis magna sit amet vestibulum. Nulla ac tellus eu orci volutpat congue. In vitae dolor et est feugiat fringilla. Sed varius neque nunc, sed pulvinar neque lobortis posuere.</p>
|
|
599
|
+
<Panel
|
|
600
|
+
open={open}
|
|
601
|
+
sdsType="overlay"
|
|
602
|
+
closeButtonOnClick={() => setOpen(false)}
|
|
603
|
+
HeaderComponent={HeaderComponent}
|
|
604
|
+
position="right"
|
|
605
|
+
>
|
|
606
|
+
[Panel Content]
|
|
607
|
+
</Panel>
|
|
608
|
+
</div>
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
export default App;
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
**/index.tsx**
|
|
616
|
+
|
|
617
|
+
```tsx
|
|
618
|
+
import React from "react";
|
|
619
|
+
import { createRoot } from "react-dom/client";
|
|
620
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
621
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
622
|
+
import { Theme } from "@czi-sds/components";
|
|
623
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
624
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
625
|
+
|
|
626
|
+
import App from "./App";
|
|
627
|
+
|
|
628
|
+
const container = document.getElementById("root");
|
|
629
|
+
const root = createRoot(container!);
|
|
630
|
+
|
|
631
|
+
const RootApp = () => {
|
|
632
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
633
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
634
|
+
|
|
635
|
+
return (
|
|
636
|
+
<StyledEngineProvider injectFirst>
|
|
637
|
+
<ThemeProvider theme={theme}>
|
|
638
|
+
<EmotionThemeProvider theme={theme}>
|
|
639
|
+
<CssBaseline />
|
|
640
|
+
<App />
|
|
641
|
+
</EmotionThemeProvider>
|
|
642
|
+
</ThemeProvider>
|
|
643
|
+
</StyledEngineProvider>
|
|
644
|
+
);
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
root.render(
|
|
648
|
+
<React.StrictMode>
|
|
649
|
+
<RootApp />
|
|
650
|
+
</React.StrictMode>
|
|
651
|
+
);
|
|
652
|
+
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
**/public/index.html**
|
|
656
|
+
|
|
657
|
+
```html
|
|
658
|
+
<!DOCTYPE html>
|
|
659
|
+
<html lang="en">
|
|
660
|
+
<head>
|
|
661
|
+
<meta charset="UTF-8" />
|
|
662
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
663
|
+
<title>Panel</title>
|
|
664
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
665
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
666
|
+
<link
|
|
667
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
668
|
+
rel="stylesheet"
|
|
669
|
+
/>
|
|
670
|
+
<link
|
|
671
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
672
|
+
rel="stylesheet"
|
|
673
|
+
/>
|
|
674
|
+
</head>
|
|
675
|
+
<body>
|
|
676
|
+
<div id="root"></div>
|
|
677
|
+
</body>
|
|
678
|
+
</html>
|
|
679
|
+
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
**/package.json**
|
|
683
|
+
|
|
684
|
+
```json
|
|
685
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
---
|
|
689
|
+
|
|
690
|
+
**Overlay Panel with a Custom Closing Button (opens from bottom)**
|
|
691
|
+
|
|
692
|
+
This example demonstrates how to implement an overlay `Panel` with a custom close button. Instead of using the default close functionality, the close button can be customized to match specific design requirements or to add additional features, such as custom icons, animations, or styling. The panel will still function as an overlay, sliding over the current content, but with enhanced control over how it is closed.
|
|
693
|
+
|
|
694
|
+
**/styles.css**
|
|
695
|
+
|
|
696
|
+
```css
|
|
697
|
+
body {
|
|
698
|
+
font-size: 13px;
|
|
699
|
+
font-weight: 400;
|
|
700
|
+
letter-spacing: 0.08px;
|
|
701
|
+
line-height: 20px;
|
|
702
|
+
text-transform: none;
|
|
703
|
+
font-family: "Inter", sans-serif;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
h1 {
|
|
707
|
+
font-size: 1.5rem;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
.app {
|
|
711
|
+
padding: 20px;
|
|
712
|
+
}
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
**tsconfig.json**
|
|
716
|
+
|
|
717
|
+
```json
|
|
718
|
+
{
|
|
719
|
+
"include": [
|
|
720
|
+
"./**/*"
|
|
721
|
+
],
|
|
722
|
+
"compilerOptions": {
|
|
723
|
+
"strict": true,
|
|
724
|
+
"esModuleInterop": true,
|
|
725
|
+
"lib": [ "dom", "es2015" ],
|
|
726
|
+
"jsx": "react-jsx"
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
**/App.tsx**
|
|
732
|
+
|
|
733
|
+
```tsx
|
|
734
|
+
import { useState } from "react";
|
|
735
|
+
import { Button, Panel } from "@czi-sds/components";
|
|
736
|
+
import { Box, Typography } from "@mui/material";
|
|
737
|
+
import "./styles.css";
|
|
738
|
+
|
|
739
|
+
function App() {
|
|
740
|
+
const [open, setOpen] = useState(true);
|
|
741
|
+
|
|
742
|
+
const HeaderComponent = (
|
|
743
|
+
<Typography variant="h2">
|
|
744
|
+
Panel Header
|
|
745
|
+
</Typography>
|
|
746
|
+
);
|
|
747
|
+
|
|
748
|
+
const CloseButton = (
|
|
749
|
+
<Button
|
|
750
|
+
sdsStyle="icon"
|
|
751
|
+
sdsSize="small"
|
|
752
|
+
sdsType="secondary"
|
|
753
|
+
icon="ChevronDown"
|
|
754
|
+
aria-label="Panel Toggle"
|
|
755
|
+
/>
|
|
756
|
+
);
|
|
757
|
+
|
|
758
|
+
return (
|
|
759
|
+
<div className="app">
|
|
760
|
+
<Button
|
|
761
|
+
sdsType="primary"
|
|
762
|
+
sdsStyle="icon"
|
|
763
|
+
icon="InfoCircle"
|
|
764
|
+
onClick={() => setOpen((prev) => !prev)}
|
|
765
|
+
aria-label="Panel Toggle"
|
|
766
|
+
>
|
|
767
|
+
Toggle Panel
|
|
768
|
+
</Button>
|
|
769
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus facilisis tortor et pellentesque pulvinar. Ut at convallis ipsum. Nullam scelerisque tempor arcu, quis pretium magna semper eu. Nam hendrerit lectus in enim scelerisque, sed ornare sapien consequat. Proin sed congue quam. Integer consequat elit tristique sodales rhoncus. In bibendum dolor sit amet erat porta, nec posuere nibh consectetur. Cras scelerisque interdum eros ut porta. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut in lacus et mi efficitur scelerisque. Pellentesque congue purus eu feugiat cursus. Phasellus urna massa, sollicitudin id elit et, efficitur faucibus nibh.</p>
|
|
770
|
+
<p>Nam sit amet tortor varius, lacinia velit quis, lacinia metus. Quisque dictum, nulla at luctus fringilla, ligula diam fringilla nisl, non consequat nulla turpis at ex. Donec hendrerit facilisis nisl at fringilla. Pellentesque posuere tortor ac ante luctus, at euismod augue vulputate. Vivamus pretium pretium nisi, non convallis nunc volutpat ac. Nam finibus justo leo, vel pellentesque velit gravida vel. Sed in turpis non sem efficitur eleifend vel ac lacus. Sed volutpat feugiat dictum. Pellentesque tristique mollis magna sit amet vestibulum. Nulla ac tellus eu orci volutpat congue. In vitae dolor et est feugiat fringilla. Sed varius neque nunc, sed pulvinar neque lobortis posuere.</p>
|
|
771
|
+
<Panel
|
|
772
|
+
open={open}
|
|
773
|
+
sdsType="overlay"
|
|
774
|
+
closeButtonOnClick={() => setOpen(false)}
|
|
775
|
+
HeaderComponent={HeaderComponent}
|
|
776
|
+
CloseButtonComponent={CloseButton}
|
|
777
|
+
position="bottom"
|
|
778
|
+
>
|
|
779
|
+
[Panel Content]
|
|
780
|
+
</Panel>
|
|
781
|
+
</div>
|
|
782
|
+
);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
export default App;
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
**/index.tsx**
|
|
789
|
+
|
|
790
|
+
```tsx
|
|
791
|
+
import React from "react";
|
|
792
|
+
import { createRoot } from "react-dom/client";
|
|
793
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
794
|
+
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
|
|
795
|
+
import { Theme } from "@czi-sds/components";
|
|
796
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
797
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
798
|
+
|
|
799
|
+
import App from "./App";
|
|
800
|
+
|
|
801
|
+
const container = document.getElementById("root");
|
|
802
|
+
const root = createRoot(container!);
|
|
803
|
+
|
|
804
|
+
const RootApp = () => {
|
|
805
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
806
|
+
const theme = prefersDarkMode ? Theme("dark") : Theme("light");
|
|
807
|
+
|
|
808
|
+
return (
|
|
809
|
+
<StyledEngineProvider injectFirst>
|
|
810
|
+
<ThemeProvider theme={theme}>
|
|
811
|
+
<EmotionThemeProvider theme={theme}>
|
|
812
|
+
<CssBaseline />
|
|
813
|
+
<App />
|
|
814
|
+
</EmotionThemeProvider>
|
|
815
|
+
</ThemeProvider>
|
|
816
|
+
</StyledEngineProvider>
|
|
817
|
+
);
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
root.render(
|
|
821
|
+
<React.StrictMode>
|
|
822
|
+
<RootApp />
|
|
823
|
+
</React.StrictMode>
|
|
824
|
+
);
|
|
825
|
+
|
|
826
|
+
```
|
|
827
|
+
|
|
828
|
+
**/public/index.html**
|
|
829
|
+
|
|
830
|
+
```html
|
|
831
|
+
<!DOCTYPE html>
|
|
832
|
+
<html lang="en">
|
|
833
|
+
<head>
|
|
834
|
+
<meta charset="UTF-8" />
|
|
835
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
836
|
+
<title>Panel</title>
|
|
837
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
838
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
839
|
+
<link
|
|
840
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
|
841
|
+
rel="stylesheet"
|
|
842
|
+
/>
|
|
843
|
+
<link
|
|
844
|
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"
|
|
845
|
+
rel="stylesheet"
|
|
846
|
+
/>
|
|
847
|
+
</head>
|
|
848
|
+
<body>
|
|
849
|
+
<div id="root"></div>
|
|
850
|
+
</body>
|
|
851
|
+
</html>
|
|
852
|
+
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
**/package.json**
|
|
856
|
+
|
|
857
|
+
```json
|
|
858
|
+
{"dependencies":{"react":"^18.0.0","react-dom":"^18.0.0","react-scripts":"^4.0.0"},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","typescript":"^4.0.0"},"main":"/index.tsx"}
|
|
859
|
+
```
|
|
860
|
+
|
|
861
|
+
---
|
|
862
|
+
|