Skip to content

Commit eae32ac

Browse files
Merge pull request #7128 from kishore08-07/stack-doc
Added Stack component to Sistent components page
2 parents 61dd64e + 8df4212 commit eae32ac

File tree

5 files changed

+760
-21
lines changed

5 files changed

+760
-21
lines changed

src/components/SistentNavigation/content.js

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -103,31 +103,35 @@ export const content = [
103103
{ id: 75, link: "/projects/sistent/components/select/guidance", text: "Select" },
104104
{ id: 76, link: "/projects/sistent/components/select/code", text: "Select" },
105105

106-
{ id: 77, link: "/projects/sistent/components/stepper", text: "Stepper" },
107-
{ id: 78, link: "/projects/sistent/components/stepper/guidance", text: "Stepper" },
108-
{ id: 79, link: "/projects/sistent/components/stepper/code", text: "Stepper" },
106+
{ id: 77, link: "/projects/sistent/components/stack", text: "Stack" },
107+
{ id: 78, link: "/projects/sistent/components/stack/guidance", text: "Stack" },
108+
{ id: 79, link: "/projects/sistent/components/stack/code", text: "Stack" },
109109

110-
{ id: 80, link: "/projects/sistent/components/switch", text: "Switch" },
111-
{ id: 81, link: "/projects/sistent/components/switch/guidance", text: "Switch" },
112-
{ id: 82, link: "/projects/sistent/components/switch/code", text: "Switch" },
110+
{ id: 80, link: "/projects/sistent/components/stepper", text: "Stepper" },
111+
{ id: 81, link: "/projects/sistent/components/stepper/guidance", text: "Stepper" },
112+
{ id: 82, link: "/projects/sistent/components/stepper/code", text: "Stepper" },
113113

114-
{ id: 83, link: "/projects/sistent/components/tabs", text: "Tabs" },
115-
{ id: 84, link: "/projects/sistent/components/tabs/guidance", text: "Tabs" },
116-
{ id: 85, link: "/projects/sistent/components/tabs/code", text: "Tabs" },
114+
{ id: 83, link: "/projects/sistent/components/switch", text: "Switch" },
115+
{ id: 84, link: "/projects/sistent/components/switch/guidance", text: "Switch" },
116+
{ id: 85, link: "/projects/sistent/components/switch/code", text: "Switch" },
117117

118-
{ id: 86, link: "/projects/sistent/components/text-field", text: "Text Field" },
119-
{ id: 87, link: "/projects/sistent/components/text-field/guidance", text: "Text Field" },
120-
{ id: 88, link: "/projects/sistent/components/text-field/code", text: "Text Field" },
118+
{ id: 86, link: "/projects/sistent/components/tabs", text: "Tabs" },
119+
{ id: 87, link: "/projects/sistent/components/tabs/guidance", text: "Tabs" },
120+
{ id: 88, link: "/projects/sistent/components/tabs/code", text: "Tabs" },
121121

122-
{ id: 89, link: "/projects/sistent/components/text-input", text: "Text Input" },
123-
{ id: 90, link: "/projects/sistent/components/text-input/guidance", text: "Text Input" },
124-
{ id: 91, link: "/projects/sistent/components/text-input/code", text: "Text Input" },
122+
{ id: 89, link: "/projects/sistent/components/text-field", text: "Text Field" },
123+
{ id: 90, link: "/projects/sistent/components/text-field/guidance", text: "Text Field" },
124+
{ id: 91, link: "/projects/sistent/components/text-field/code", text: "Text Field" },
125125

126-
{ id: 92, link: "/projects/sistent/components/toolbar", text: "Toolbar" },
127-
{ id: 93, link: "/projects/sistent/components/toolbar/guidance", text: "Toolbar" },
128-
{ id: 94, link: "/projects/sistent/components/toolbar/code", text: "Toolbar" },
126+
{ id: 92, link: "/projects/sistent/components/text-input", text: "Text Input" },
127+
{ id: 93, link: "/projects/sistent/components/text-input/guidance", text: "Text Input" },
128+
{ id: 94, link: "/projects/sistent/components/text-input/code", text: "Text Input" },
129129

130-
{ id: 95, link: "/projects/sistent/components/tooltip", text: "Tooltip" },
131-
{ id: 96, link: "/projects/sistent/components/tooltip/guidance", text: "Tooltip" },
132-
{ id: 97, link: "/projects/sistent/components/tooltip/code", text: "Tooltip" },
130+
{ id: 95, link: "/projects/sistent/components/toolbar", text: "Toolbar" },
131+
{ id: 96, link: "/projects/sistent/components/toolbar/guidance", text: "Toolbar" },
132+
{ id: 97, link: "/projects/sistent/components/toolbar/code", text: "Toolbar" },
133+
134+
{ id: 98, link: "/projects/sistent/components/tooltip", text: "Tooltip" },
135+
{ id: 99, link: "/projects/sistent/components/tooltip/guidance", text: "Tooltip" },
136+
{ id: 100, link: "/projects/sistent/components/tooltip/code", text: "Tooltip" },
133137
];

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,13 @@ const componentsData = [
244244
url: "/projects/sistent/components/stepper",
245245
src: "/stepper",
246246
},
247+
{
248+
id: 32,
249+
name: "Stack",
250+
description: "Stack is a layout component that arranges elements in a one-dimensional flow with customizable spacing and direction.",
251+
url: "/projects/sistent/components/stack",
252+
src: "/stack",
253+
},
247254
];
248255

249256
module.exports = { componentsData };
Lines changed: 301 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,301 @@
1+
import React from "react";
2+
import { navigate } from "gatsby";
3+
import { useLocation } from "@reach/router";
4+
5+
import { SistentThemeProvider, Stack, Box, Button } from "@sistent/sistent";
6+
import { CodeBlock } from "../button/code-block";
7+
import { SistentLayout } from "../../sistent-layout";
8+
9+
import TabButton from "../../../../../reusecore/Button";
10+
import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode";
11+
12+
const codes = [
13+
`<SistentThemeProvider>
14+
<Stack spacing={2}>
15+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
16+
Header
17+
</Box>
18+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
19+
Content
20+
</Box>
21+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
22+
Footer
23+
</Box>
24+
</Stack>
25+
</SistentThemeProvider>`,
26+
`<SistentThemeProvider>
27+
<Stack direction="row" spacing={2}>
28+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
29+
Home
30+
</Box>
31+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
32+
About
33+
</Box>
34+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
35+
Contact
36+
</Box>
37+
</Stack>
38+
</SistentThemeProvider>`,
39+
`<SistentThemeProvider>
40+
<Stack
41+
direction={{ xs: "column", sm: "row" }}
42+
spacing={2}
43+
sx={{ width: "100%" }}
44+
>
45+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white", flex: 1 }}>
46+
Card One
47+
</Box>
48+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white", flex: 1 }}>
49+
Card Two
50+
</Box>
51+
</Stack>
52+
</SistentThemeProvider>`,
53+
`<SistentThemeProvider>
54+
<Stack
55+
spacing={2}
56+
divider={
57+
<Box
58+
sx={{
59+
borderBottom: "1px solid",
60+
borderColor: "divider",
61+
}}
62+
/>
63+
}
64+
>
65+
<Box sx={{ p: 1 }}>Profile</Box>
66+
<Box sx={{ p: 1 }}>Settings</Box>
67+
<Box sx={{ p: 1 }}>Logout</Box>
68+
</Stack>
69+
</SistentThemeProvider>`,
70+
`<SistentThemeProvider>
71+
<Stack spacing={4}>
72+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
73+
Title
74+
</Box>
75+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
76+
Description
77+
</Box>
78+
</Stack>
79+
</SistentThemeProvider>`,
80+
`<SistentThemeProvider>
81+
<Stack direction="row" spacing={2}>
82+
<Button variant="contained">Save</Button>
83+
<Button variant="outlined">Cancel</Button>
84+
<Button variant="text">Reset</Button>
85+
</Stack>
86+
</SistentThemeProvider>`,
87+
];
88+
89+
const StackCode = () => {
90+
const location = useLocation();
91+
const { isDark } = useStyledDarkMode();
92+
93+
return (
94+
<SistentLayout title="Stack">
95+
<div className="content">
96+
<a id="Identity">
97+
<h2>Stack</h2>
98+
</a>
99+
<p>
100+
The <code>Stack</code> component is a layout utility that manages
101+
one-dimensional layouts with flexible spacing and alignment. Built on
102+
Flexbox, it provides an efficient way to arrange elements vertically
103+
or horizontally with consistent spacing.
104+
</p>
105+
<div className="filterBtns">
106+
<TabButton
107+
className={
108+
location.pathname === "/projects/sistent/components/stack"
109+
? "active"
110+
: ""
111+
}
112+
onClick={() => navigate("/projects/sistent/components/stack")}
113+
title="Overview"
114+
/>
115+
<TabButton
116+
className={
117+
location.pathname === "/projects/sistent/components/stack/guidance"
118+
? "active"
119+
: ""
120+
}
121+
onClick={() =>
122+
navigate("/projects/sistent/components/stack/guidance")
123+
}
124+
title="Guidance"
125+
/>
126+
<TabButton
127+
className={
128+
location.pathname === "/projects/sistent/components/stack/code"
129+
? "active"
130+
: ""
131+
}
132+
onClick={() => navigate("/projects/sistent/components/stack/code")}
133+
title="Code"
134+
/>
135+
</div>
136+
<div className="main-content">
137+
<p>
138+
The <code>Stack</code> component arranges children in one-dimensional flow, either vertically or
139+
horizontally, with consistent spacing and no manual margin adjustments.
140+
</p>
141+
<a id="Vertical Stack">
142+
<h2>Vertical Stack</h2>
143+
</a>
144+
<p>
145+
The default Stack orientation is vertical. Use the <code>spacing</code> prop to control the gap between children.
146+
</p>
147+
<div className="showcase">
148+
<div className="items">
149+
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
150+
<Stack spacing={2}>
151+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
152+
Header
153+
</Box>
154+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
155+
Content
156+
</Box>
157+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
158+
Footer
159+
</Box>
160+
</Stack>
161+
</SistentThemeProvider>
162+
</div>
163+
<CodeBlock name="stack-vertical" code={codes[0]} />
164+
</div>
165+
<a id="Horizontal Stack">
166+
<h2>Horizontal Stack</h2>
167+
</a>
168+
<p>
169+
Set <code>direction="row"</code> to arrange children horizontally. Useful for button groups and navigation items.
170+
</p>
171+
<div className="showcase">
172+
<div className="items">
173+
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
174+
<Stack direction="row" spacing={2}>
175+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
176+
Home
177+
</Box>
178+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
179+
About
180+
</Box>
181+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
182+
Contact
183+
</Box>
184+
</Stack>
185+
</SistentThemeProvider>
186+
</div>
187+
<CodeBlock name="stack-horizontal" code={codes[1]} />
188+
</div>
189+
<a id="Responsive Stack">
190+
<h2>Responsive Stack</h2>
191+
</a>
192+
<p>
193+
Use responsive values for the <code>direction</code> prop to create adaptive layouts that stack vertically on mobile and horizontally on larger screens.
194+
</p>
195+
<div className="showcase">
196+
<div className="items">
197+
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
198+
<Stack
199+
direction={{ xs: "column", sm: "row" }}
200+
spacing={2}
201+
sx={{ width: "100%" }}
202+
>
203+
<Box
204+
sx={{
205+
p: 2,
206+
bgcolor: "primary.main",
207+
color: "white",
208+
flex: 1,
209+
}}
210+
>
211+
Card One
212+
</Box>
213+
<Box
214+
sx={{
215+
p: 2,
216+
bgcolor: "primary.main",
217+
color: "white",
218+
flex: 1,
219+
}}
220+
>
221+
Card Two
222+
</Box>
223+
</Stack>
224+
</SistentThemeProvider>
225+
</div>
226+
<CodeBlock name="stack-responsive" code={codes[2]} />
227+
</div>
228+
<a id="Divider">
229+
<h2>Divider</h2>
230+
</a>
231+
<p>
232+
Add visual separation between children using the <code>divider</code> prop.
233+
</p>
234+
<div className="showcase">
235+
<div className="items">
236+
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
237+
<Stack
238+
spacing={2}
239+
divider={
240+
<Box
241+
sx={{
242+
borderBottom: "1px solid",
243+
borderColor: "divider",
244+
}}
245+
/>
246+
}
247+
>
248+
<Box sx={{ p: 1 }}>Profile</Box>
249+
<Box sx={{ p: 1 }}>Settings</Box>
250+
<Box sx={{ p: 1 }}>Logout</Box>
251+
</Stack>
252+
</SistentThemeProvider>
253+
</div>
254+
<CodeBlock name="stack-divider" code={codes[3]} />
255+
</div>
256+
<a id="Spacing">
257+
<h2>Spacing</h2>
258+
</a>
259+
<p>
260+
Use larger spacing values to create wider gaps. Common values range from 1 (8px) to 4 (32px).
261+
</p>
262+
<div className="showcase">
263+
<div className="items">
264+
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
265+
<Stack spacing={4}>
266+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
267+
Title
268+
</Box>
269+
<Box sx={{ p: 2, bgcolor: "primary.main", color: "white" }}>
270+
Description
271+
</Box>
272+
</Stack>
273+
</SistentThemeProvider>
274+
</div>
275+
<CodeBlock name="stack-spacing" code={codes[4]} />
276+
</div>
277+
<a id="Button Group">
278+
<h2>Button Group</h2>
279+
</a>
280+
<p>
281+
Use <code>direction="row"</code> to stack horizontal button groups with consistent spacing.
282+
</p>
283+
<div className="showcase">
284+
<div className="items">
285+
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
286+
<Stack direction="row" spacing={2}>
287+
<Button variant="contained">Save</Button>
288+
<Button variant="outlined">Cancel</Button>
289+
<Button variant="text">Reset</Button>
290+
</Stack>
291+
</SistentThemeProvider>
292+
</div>
293+
<CodeBlock name="stack-buttons" code={codes[5]} />
294+
</div>
295+
</div>
296+
</div>
297+
</SistentLayout>
298+
);
299+
};
300+
301+
export default StackCode;

0 commit comments

Comments
 (0)