Skip to content

Commit a74d358

Browse files
committed
[Docs] Add full-screen and form examples to Dialog component
Signed-off-by: Ayush More <ayushmore42595@gmail.com>
1 parent 9d5d52e commit a74d358

2 files changed

Lines changed: 52 additions & 5 deletions

File tree

src/sections/Projects/Sistent/components/content.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ const componentsData = [
127127
src: "/icons"
128128
},
129129
{
130-
id: 17,
131-
name: "Dialog",
132-
description: "Dialogs display important prompts or confirmation requests that interrupt user interaction flow.",
133-
url: "/projects/sistent/components/dialog",
134-
src: "/dialog",
130+
id: 17,
131+
name: "Dialog",
132+
description: "Dialogs display important prompts or confirmation requests that interrupt user interaction flow.",
133+
url: "/projects/sistent/components/dialog",
134+
src: "/dialog",
135135
},
136136

137137
];

src/sections/Projects/Sistent/components/dialog/code.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ const DialogCode = () => {
3737
const location = useLocation();
3838
const { isDark } = useStyledDarkMode();
3939
const [open, setOpen] = useState(false);
40+
const [openFull, setOpenFull] = useState(false);
41+
const [openForm, setOpenForm] = useState(false);
4042

4143
const handleOpen = () => setOpen(true);
4244
const handleClose = () => setOpen(false);
@@ -87,6 +89,51 @@ const DialogCode = () => {
8789

8890
<h3 style={{ marginTop: "2rem" }}>Code Snippet</h3>
8991
<CodeBlock name="dialog-basic" code={dialogCodeExample} />
92+
93+
{/* Full Screen Dialog */}
94+
<h3 style={{ marginTop: "3rem" }}>Full-Screen Dialog Example</h3>
95+
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
96+
<Button onClick={() => setOpenFull(true)}>Open Full-Screen Dialog</Button>
97+
<Dialog
98+
open={openFull}
99+
onClose={() => setOpenFull(false)}
100+
style={{ width: "100%", height: "100vh", maxWidth: "none" }}
101+
>
102+
<DialogTitle>Full-Screen Dialog</DialogTitle>
103+
<DialogContent>
104+
<p>This dialog stretches to full screen. Use it when the user's full attention is needed.</p>
105+
</DialogContent>
106+
<DialogActions>
107+
<Button onClick={() => setOpenFull(false)}>Cancel</Button>
108+
<Button color="primary" onClick={() => setOpenFull(false)}>Save</Button>
109+
</DialogActions>
110+
</Dialog>
111+
</SistentThemeProvider>
112+
113+
{/* Form Inside Dialog */}
114+
<h3 style={{ marginTop: "3rem" }}>Dialog with Form Example</h3>
115+
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
116+
<Button onClick={() => setOpenForm(true)}>Open Form Dialog</Button>
117+
<Dialog open={openForm} onClose={() => setOpenForm(false)}>
118+
<DialogTitle>Subscribe</DialogTitle>
119+
<DialogContent>
120+
<form style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
121+
<label>
122+
Email Address:
123+
<input type="email" placeholder="you@example.com" style={{ width: '100%', padding: '0.5rem' }} />
124+
</label>
125+
<label>
126+
Name:
127+
<input type="text" placeholder="John Doe" style={{ width: '100%', padding: '0.5rem' }} />
128+
</label>
129+
</form>
130+
</DialogContent>
131+
<DialogActions>
132+
<Button onClick={() => setOpenForm(false)}>Cancel</Button>
133+
<Button color="primary" onClick={() => setOpenForm(false)}>Subscribe</Button>
134+
</DialogActions>
135+
</Dialog>
136+
</SistentThemeProvider>
90137
</div>
91138
</div>
92139
</SistentLayout>

0 commit comments

Comments
 (0)