-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#217 add DRepDirectory page and nav items
- Loading branch information
Showing
13 changed files
with
435 additions
and
98 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { Box } from "@mui/material"; | ||
import { ComponentProps, FC, PropsWithChildren } from "react"; | ||
|
||
import { ICONS } from "@consts"; | ||
import { Background, Typography } from "@atoms"; | ||
import { useScreenDimension } from "@hooks"; | ||
import { DashboardTopNav, DashboardTopNavProps, Drawer, Footer } from "@organisms"; | ||
import { NewTopNav } from "./NewTopNav"; | ||
import { theme } from "@/theme"; | ||
|
||
export type DashboardLayoutProps = PropsWithChildren | ||
& Pick<DashboardTopNavProps, 'title'> | ||
& ComponentProps<typeof Box> & { | ||
isConnected: boolean; | ||
hideDrawer?: boolean; | ||
}; | ||
|
||
export const MainLayout: FC<DashboardLayoutProps> = ({ | ||
children, | ||
sx, | ||
title, | ||
isConnected, | ||
hideDrawer, | ||
...boxProps | ||
}) => { | ||
const { isMobile } = useScreenDimension(); | ||
|
||
const showDrawer = !!isConnected && !isMobile && !hideDrawer; | ||
|
||
return ( | ||
<Background opacity={0.7}> | ||
<Box display={"flex"} flexDirection={"row"} position={"relative"}> | ||
{showDrawer && <Drawer />} | ||
|
||
<Box | ||
flex={1} | ||
height="100vh" | ||
overflow="auto" | ||
display="flex" | ||
flexDirection="column" | ||
> | ||
{isConnected ? ( | ||
<DashboardTopNav | ||
title={title} | ||
imageSRC={isMobile ? ICONS.appLogoIcon : undefined} | ||
imageHeight={24} | ||
isDrawer={!hideDrawer} | ||
sx={{ flexGrow: 0, position: "sticky", top: 0 }} | ||
/> | ||
) : ( | ||
<> | ||
<NewTopNav /> | ||
{title && ( | ||
<Box | ||
borderBottom={`1px solid ${theme.palette.neutralWhite}`} | ||
px={{ xxs: 2, md: 5 }} | ||
py={3} | ||
> | ||
<Typography variant="headline5">{title}</Typography> | ||
</Box> | ||
)} | ||
</> | ||
)} | ||
<Box flex={1} px={5} py={1.5} {...boxProps}> | ||
{children} | ||
</Box> | ||
|
||
<Footer /> | ||
</Box> | ||
</Box> | ||
</Background> | ||
); | ||
}; |
Oops, something went wrong.