diff --git a/frontend/src/app/components/uikitBlock/UikitBlock.tsx b/frontend/src/app/components/uikitBlock/UikitBlock.tsx index 865271e..f96474d 100644 --- a/frontend/src/app/components/uikitBlock/UikitBlock.tsx +++ b/frontend/src/app/components/uikitBlock/UikitBlock.tsx @@ -1,7 +1,7 @@ import { ReactNode } from "react"; -import { Typography } from "@mui/material"; import { Highlight, themes } from "prism-react-renderer"; import "./uikit-block.scss"; +import Typography from "@components/typography/Typography"; interface IUikitBlock { title: string; @@ -16,7 +16,7 @@ export default function UikitBlock({ }: IUikitBlock) { return (
- {title} + {title} {children} {codeBlock && ( diff --git a/frontend/src/app/components/uikitColor/UikitColor.tsx b/frontend/src/app/components/uikitColor/UikitColor.tsx index f045998..7162ce1 100644 --- a/frontend/src/app/components/uikitColor/UikitColor.tsx +++ b/frontend/src/app/components/uikitColor/UikitColor.tsx @@ -1,5 +1,5 @@ import { Grid, Palette, PaletteColor, useTheme } from "@mui/material"; -import { useCallback } from "react"; +import { useCallback, useMemo } from "react"; interface IUikitColor { color: keyof Palette; @@ -7,7 +7,10 @@ interface IUikitColor { export default function UikitColor({ color }: IUikitColor) { const theme = useTheme(); - const paletteColor = theme.palette[color] as PaletteColor; + const paletteColor = useMemo( + () => theme.palette[color] as PaletteColor, + [color, theme.palette], + ); const colorItem = useCallback((bgColor: string, label: string) => { return ( diff --git a/frontend/src/app/pages/uikit/UiKit.tsx b/frontend/src/app/pages/uikit/UiKit.tsx index e215222..af4b7ba 100644 --- a/frontend/src/app/pages/uikit/UiKit.tsx +++ b/frontend/src/app/pages/uikit/UiKit.tsx @@ -1,4 +1,4 @@ -import { Grid, TextField, Typography } from "@mui/material"; +import { Grid, TextField } from "@mui/material"; import Layout from "@components/layout/Layout"; import { useTranslation } from "react-i18next"; import FieldHelperText from "@components/fieldHelperText/FieldHelperText"; @@ -7,21 +7,22 @@ import UikitBlock from "@components/uikitBlock/UikitBlock"; import { ValidationError } from "yup"; import Link from "@components/link/Link"; import Spinner from "@components/spinner/Spinner"; -import { useState } from "react"; +import { useCallback, useState } from "react"; import Button from "@components/button/Button"; import UikitColor from "@components/uikitColor/UikitColor"; +import Typography from "@components/typography/Typography"; export default function UiKit() { const [t] = useTranslation(); const [showLoading, setShowLoading] = useState(false); - const onClickShowLoading = () => { + const onClickShowLoading = useCallback(() => { setShowLoading(true); setTimeout(() => { setShowLoading(false); }, 3000); - }; + }, []); // this is for mocking, yup will format the error correctly for you const formErrors: ValidationError[] = [ @@ -57,48 +58,48 @@ export default function UiKit() { return ( - UiKit - + UiKit + This is where you can display all your custom components/containers. - - + + For all the Styled MUI components, please refer to MUI documentation - +
- H1. Heading - H2. Heading - H3. Heading - H4. Heading - H5. Heading - H6. Heading - + H1. Heading + H2. Heading + H3. Heading + H4. Heading + H5. Heading + H6. Heading + subtitle1. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos blanditiis tenetur - - + + subtitle2. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos blanditiis tenetur - - + + body1. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos blanditiis tenetur unde suscipit, quam beatae rerum inventore consectetur, neque doloribus, cupiditate numquam dignissimos laborum fugiat deleniti? Eum quasi quidem quibusdam. - - + + body2. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos blanditiis tenetur unde suscipit, quam beatae rerum inventore consectetur, neque doloribus, cupiditate numquam dignissimos laborum fugiat deleniti? Eum quasi quidem quibusdam. - - button text - caption text - overline text + + button text + caption text + overline text @@ -145,7 +146,7 @@ export default function UiKit() { - {/* styling inline like this to prevent the spinner from changing the height of the page while spinning */} + {/* styling inline like this to prevent the spinner from changing the height of the page while spinning, do not style inline in projects */}