Skip to content

Commit

Permalink
feat: using Layout for User Guide
Browse files Browse the repository at this point in the history
  • Loading branch information
jimcase committed Jul 29, 2024
1 parent c6973f3 commit a75632b
Show file tree
Hide file tree
Showing 7 changed files with 182 additions and 837 deletions.
5 changes: 5 additions & 0 deletions ui/summit-2024/src/__fixtures__/userGuide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ interface UserGuideSection {

interface UserGuideMenuEntry {
label: string;
title: string;
sections: UserGuideSection[];
}

const userGuideMenu: UserGuideMenuEntry[] = [
{
label: "What You’ll Need",
title: "To Submit Votes, You’ll Need:",
sections: [
{
number: 1,
Expand All @@ -39,6 +41,7 @@ const userGuideMenu: UserGuideMenuEntry[] = [
},
{
label: "Creating an Account",
title: "Create and Verify Your Account:",
sections: [
{
number: 1,
Expand All @@ -58,6 +61,7 @@ const userGuideMenu: UserGuideMenuEntry[] = [
},
{
label: "How to Vote",
title: "How to Submit a Vote:",
sections: [
{
number: 1,
Expand Down Expand Up @@ -99,4 +103,5 @@ const userGuideMenu: UserGuideMenuEntry[] = [
},
];

export type { UserGuideMenuEntry }
export { userGuideMenu };
29 changes: 28 additions & 1 deletion ui/summit-2024/src/components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ type MenuItem = {

type LayoutProps = {
menuOptions: MenuItem[];
title: string;
bottom?: ReactNode;
mode?: "scroll" | "change";
defaultOption?: number;
};

const Layout: React.FC<LayoutProps> = ({
menuOptions,
title,
bottom,
mode = "scroll",
defaultOption = 0,
}) => {
Expand Down Expand Up @@ -192,7 +196,27 @@ const Layout: React.FC<LayoutProps> = ({
</>
)}
</Grid>
<Grid item xs={12} md={9.6} lg={10} sx={{ padding: "0px 20px" }}>
<Grid item xs={12} md={9.6} lg={10} sx={{
background: "transparent",
padding: {
xs: "0px 20px",
sm: "20px 0pxs",
},
marginTop: "10px"
}}>
<Typography
sx={{
color: theme.palette.text.neutralLightest,
fontFamily: "Dosis",
fontSize: "32px",
fontStyle: "normal",
fontWeight: 700,
lineHeight: "36px",
marginBottom: "32px",
}}
>
{title}
</Typography>
{mode === "change"
? menuOptions.find((option) => option.label === selectedOption)
?.content
Expand All @@ -208,6 +232,9 @@ const Layout: React.FC<LayoutProps> = ({
{option.content}
</div>
))}
{
bottom
}
</Grid>
</Grid>
</Box>
Expand Down
Loading

0 comments on commit a75632b

Please sign in to comment.