-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Empty View Low Level Component
- Loading branch information
1 parent
e5246e8
commit 2879126
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
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,82 @@ | ||
// Components | ||
import { Typography, Stack } from "@mui/material"; | ||
import PropTypes from "prop-types"; | ||
import { useTheme } from "@emotion/react"; | ||
import IconBox from "../../IconBox"; | ||
|
||
const EmptyView = ({ | ||
icon, | ||
header, | ||
message = "No Data", | ||
size = "h2", | ||
borderRadiusRight = 4, | ||
justifyContent = "flex-start", | ||
height = "300px" | ||
}) => { | ||
const theme = useTheme(); | ||
return ( | ||
<Stack | ||
flex={1} | ||
direction="row" | ||
sx={{ | ||
backgroundColor: theme.palette.primary.main, | ||
|
||
border: 1, | ||
borderStyle: "solid", | ||
borderColor: theme.palette.primary.lowContrast, | ||
borderRadius: 2, | ||
borderTopRightRadius: borderRadiusRight, | ||
borderBottomRightRadius: borderRadiusRight, | ||
}} | ||
> | ||
<Stack | ||
flex={1} | ||
alignItems="center" | ||
sx={{ | ||
padding: theme.spacing(8), | ||
justifyContent, | ||
gap: theme.spacing(8), | ||
height, | ||
minWidth: 250, | ||
"& h2": { | ||
color: theme.palette.primary.contrastTextSecondary, | ||
fontSize: 15, | ||
fontWeight: 500, | ||
}, | ||
|
||
"& tspan, & text": { | ||
fill: theme.palette.primary.contrastTextTertiary, | ||
}, | ||
}} | ||
> | ||
<Stack | ||
alignSelf="flex-start" | ||
direction="row" | ||
alignItems="center" | ||
gap={theme.spacing(6)} | ||
> | ||
{icon && <IconBox>{icon}</IconBox>} | ||
{header && <Typography component="h2">{header}</Typography>} | ||
</Stack> | ||
<Stack | ||
flex={1} | ||
justifyContent="center" | ||
alignItems="center" | ||
> | ||
<Typography component={size}> | ||
{message} | ||
</Typography> | ||
</Stack> | ||
</Stack> | ||
</Stack> | ||
); | ||
}; | ||
|
||
EmptyView.propTypes = { | ||
message: PropTypes.string, | ||
icon: PropTypes.node, | ||
header: PropTypes.string, | ||
size: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'body1', 'body2']) | ||
}; | ||
|
||
export default EmptyView; |
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