Implemented fallback component

This commit is contained in:
Daniel Cojocea committed 2024-07-22 16:35:57 -04:00
1 parent ff7404e891
commit 6aacfe0ca8
6 files changed
+128 -5

No files matched your search

+8 -3
View File
@@ -1,6 +1,7 @@
import "./check.css";
import PropTypes from "prop-types";
import CheckGrey from "../../assets/icons/check.svg?react";
import CheckOutlined from "../../assets/icons/check-outlined.svg?react";
import { Stack, Typography } from "@mui/material";
import { useTheme } from "@emotion/react";
@@ -18,12 +19,12 @@ import { useTheme } from "@emotion/react";
*
* @returns {React.Element} The `Check` component with a check icon and a label, defined by the `text` prop.
*/
const Check = ({ text, variant = "info" }) => {
const Check = ({ text, variant = "info", outlined = false }) => {
const theme = useTheme();
return (
<Stack
direction="row"
gap={theme.gap.small}
gap={outlined ? theme.gap.medium : theme.gap.small}
className={`check${
variant === "error"
? " check-error"
@@ -33,7 +34,11 @@ const Check = ({ text, variant = "info" }) => {
}`}
alignItems="center"
>
<CheckGrey alt="form checks" />
{outlined ? (
<CheckOutlined alt="check" />
) : (
<CheckGrey alt="form checks" />
)}
<Typography component="span">{text}</Typography>
</Stack>
);
+23
View File
@@ -0,0 +1,23 @@
[class*="fallback__"] {
width: 255px;
margin: auto;
margin-top: 100px;
}
[class*="fallback__"] h1.MuiTypography-root {
font-size: var(--env-var-font-size-large);
font-weight: 600;
}
[class*="fallback__"] .check span.MuiTypography-root,
[class*="fallback__"] h1.MuiTypography-root {
color: var(--env-var-color-5);
}
[class*="fallback__"] button.MuiButtonBase-root,
[class*="fallback__"] .check {
width: max-content;
}
[class*="fallback__"] button.MuiButtonBase-root {
height: 34px;
}
[class*="fallback__"] .check span.MuiTypography-root {
font-size: var(--env-var-font-size-medium);
}
+44
View File
@@ -0,0 +1,44 @@
import { useTheme } from "@emotion/react";
import { Stack, Typography } from "@mui/material";
import Skeleton from "../../assets/Images/create-placeholder.svg?react";
import Button from "../Button";
import Check from "../Check/Check";
import { useNavigate } from "react-router-dom";
import "./index.css";
const Fallback = ({ title, checks, link = "/" }) => {
const theme = useTheme();
const navigate = useNavigate();
return (
<Stack
className={`fallback__${title.trim().split(" ")[0]}`}
gap={theme.gap.xl}
>
<Skeleton />
<Stack gap={theme.gap.small}>
<Typography
component="h1"
marginY={theme.gap.medium}
>
A {title} is used to:
</Typography>
{checks.map((check, index) => (
<Check
text={check}
key={`${title.trim().split(" ")[0]}-${index}`}
outlined={true}
/>
))}
</Stack>
<Button
level="primary"
label={`Let's create your ${title}`}
sx={{ alignSelf: "center" }}
onClick={() => navigate(link)}
/>
</Stack>
);
};
export default Fallback;