File tree Expand file tree Collapse file tree 3 files changed +95
-0
lines changed
components/design_system/dialog Expand file tree Collapse file tree 3 files changed +95
-0
lines changed Original file line number Diff line number Diff line change
1
+ import type { Meta , StoryObj } from "@storybook/react" ;
2
+
3
+ import Dialog from "./Dialog" ;
4
+
5
+ const meta : Meta < typeof Dialog > = {
6
+ title : "Components/Design System/Dialog" ,
7
+ component : Dialog ,
8
+ decorators : [
9
+ ( Story ) => (
10
+ < >
11
+ < div id = "anchor" >
12
+ < Story />
13
+ </ div >
14
+ < div style = { { height : "8rem" } } > </ div >
15
+ </ >
16
+ ) ,
17
+ ] ,
18
+ } ;
19
+ export default meta ;
20
+
21
+ type Story = StoryObj < typeof Dialog > ;
22
+
23
+ export const Default : Story = {
24
+ args : {
25
+ open : true ,
26
+ size : "sm" ,
27
+ title : "Dialog Test" ,
28
+ children : < p style = { { width : "100%" } } > Testing, testing testing</ p > ,
29
+ cancelLabel : "Cancel" ,
30
+ confirmLabel : "Save" ,
31
+ } ,
32
+ } ;
Original file line number Diff line number Diff line change
1
+ import { ReactNode } from "react" ;
2
+ import {
3
+ Dialog as MuiDialog ,
4
+ DialogActions ,
5
+ DialogContent ,
6
+ DialogTitle ,
7
+ } from "@mui/material" ;
8
+ import Button from "@/components/design_system/button/Button" ;
9
+
10
+ interface DialogProps {
11
+ cancelLabel ?: string ;
12
+ children : ReactNode ;
13
+ confirmLabel ?: string ;
14
+ open : boolean ;
15
+ size : "xs" | "sm" | "md" | "lg" | "xl" ;
16
+ title : ReactNode ;
17
+ }
18
+
19
+ function Dialog ( {
20
+ cancelLabel,
21
+ children,
22
+ confirmLabel,
23
+ open,
24
+ size = "sm" ,
25
+ title,
26
+ } : DialogProps ) {
27
+ return (
28
+ < MuiDialog open = { open } fullWidth maxWidth = { size } >
29
+ < DialogTitle align = "center" variant = "h3" >
30
+ { title }
31
+ </ DialogTitle >
32
+ < DialogContent > { children } </ DialogContent >
33
+ < DialogActions >
34
+ { cancelLabel && < Button variant = "secondary" > { cancelLabel } </ Button > }
35
+ { confirmLabel && < Button variant = "primary" > { confirmLabel } </ Button > }
36
+ </ DialogActions >
37
+ </ MuiDialog >
38
+ ) ;
39
+ }
40
+
41
+ export default Dialog ;
Original file line number Diff line number Diff line change @@ -156,6 +156,28 @@ export const compassTheme = createTheme({
156
156
disableRipple : true ,
157
157
} ,
158
158
} ,
159
+ MuiDialogActions : {
160
+ styleOverrides : {
161
+ root : {
162
+ padding : ".5rem 1.5rem 1.5rem 1.5rem" ,
163
+ } ,
164
+ } ,
165
+ } ,
166
+ MuiDialogTitle : {
167
+ styleOverrides : {
168
+ root : {
169
+ paddingTop : "1.5rem" ,
170
+ paddingBottom : "2rem" ,
171
+ } ,
172
+ } ,
173
+ } ,
174
+ MuiDialogContent : {
175
+ styleOverrides : {
176
+ root : {
177
+ padding : "0 1.5rem 1.5rem 1.5rem" ,
178
+ } ,
179
+ } ,
180
+ } ,
159
181
MuiInputLabel : {
160
182
styleOverrides : {
161
183
root : {
You can’t perform that action at this time.
0 commit comments