From 3de2a17cbc607a70df0bdab700a15d665fd71f59 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Fri, 10 May 2024 12:25:05 -0700 Subject: [PATCH] Renamed link component, added links to Demo page --- Client/src/Components/Button/Button.jsx | 1 + .../Components/Link/{index.css => Link.css} | 0 .../Components/Link/{index.jsx => Link.jsx} | 17 +-- Client/src/Pages/Demo/Demo.jsx | 110 +++++++++++++++--- 4 files changed, 101 insertions(+), 27 deletions(-) rename Client/src/Components/Link/{index.css => Link.css} (100%) rename Client/src/Components/Link/{index.jsx => Link.jsx} (78%) diff --git a/Client/src/Components/Button/Button.jsx b/Client/src/Components/Button/Button.jsx index 0756cda1b..a43142be8 100644 --- a/Client/src/Components/Button/Button.jsx +++ b/Client/src/Components/Button/Button.jsx @@ -33,6 +33,7 @@ const levelConfig = { }; /** + * @component * @param {Object} props * @param {'primary' | 'secondary' | 'tertiary' | 'error' | 'imagePrimary' | 'imageSecondary' | 'imageTertiary'} props.level - The level of the button * @param {string} props.label - The label of the button diff --git a/Client/src/Components/Link/index.css b/Client/src/Components/Link/Link.css similarity index 100% rename from Client/src/Components/Link/index.css rename to Client/src/Components/Link/Link.css diff --git a/Client/src/Components/Link/index.jsx b/Client/src/Components/Link/Link.jsx similarity index 78% rename from Client/src/Components/Link/index.jsx rename to Client/src/Components/Link/Link.jsx index e8d26a7c7..9c643ebbe 100644 --- a/Client/src/Components/Link/index.jsx +++ b/Client/src/Components/Link/Link.jsx @@ -1,6 +1,15 @@ import { Link as MuiLink, useTheme } from "@mui/material"; import PropTypes from "prop-types"; +/** + * @component + * @param {Object} props + * @param {'primary' | 'secondary' | 'tertiary' | 'error'} props.level - The level of the link + * @param {string} props.label - The label of the link + * @param {string} props.url - The URL of the link + * @returns {JSX.Element} + */ + const Link = ({ level, label, url }) => { const theme = useTheme(); @@ -22,14 +31,6 @@ const Link = ({ level, label, url }) => { }, error: {}, }; - - /** - * @typedef {Object} Props - * @property {'primary' | 'secondary' | 'tertiary' | 'error'} level - The level of the link - * @property {string} label - The label of the link - * @property {string} url - The URL of the link - */ - const { sx, color } = levelConfig[level]; return ( diff --git a/Client/src/Pages/Demo/Demo.jsx b/Client/src/Pages/Demo/Demo.jsx index ad97bb0e8..1c294ba5c 100644 --- a/Client/src/Pages/Demo/Demo.jsx +++ b/Client/src/Pages/Demo/Demo.jsx @@ -1,6 +1,6 @@ import React from "react"; import Button from "../../Components/Button/Button"; -import Link from "../../Components/Link"; +import Link from "../../Components/Link/Link"; import ColoredLabel from "../../Components/Label/ColoredLabel"; import { useTheme, @@ -25,6 +25,7 @@ import { DatePicker } from "@mui/x-date-pickers/DatePicker"; import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider"; import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs"; import AddIcon from "@mui/icons-material/Add"; +import Divider from "@mui/material/Divider"; const cols = [ { @@ -112,23 +113,87 @@ const Demo = () => { alert(event.target.checked ? `${type} checked` : `${type} unchecked`); }; + const links = [ + { + name: "Buttons", + url: "#buttons", + }, + { + name: "Disabled Buttons", + url: "#disabled-buttons", + }, + { + name: "Labels", + url: "#labels", + }, + { + name: "Status Labels", + url: "#status-labels", + }, + { + name: "Avatar", + url: "#avatar", + }, + { + name: "Switches", + url: "#switches", + }, + { + name: "Checkboxes", + url: "#checkboxes", + }, + { + name: "Radio", + url: "#radio", + }, + { + name: "Table", + url: "#table", + }, + { + name: "Tabs", + url: "#tabs", + }, + { + name: "Date Picker", + url: "#date-picker", + }, + { + name: "Stepper", + url: "#stepper", + }, + { + name: "Section", + url: "#section", + }, + ]; + const theme = useTheme(); return (
-

Buttons

+
    + {links.map((link) => ( +
  • + +
  • + ))} +
+ +

Buttons

-

Disabled Buttons

+ +

Disabled Buttons

{ url={"https://www.google.com"} />
-

Labels

+ +

Labels

- -

Status Lables

+ +

Status Lables

-

Avatar

+ +

Avatar

-

Switches

+ +

Switches

change(event, "Switch")} />
-

Checkboxes

+ +

Checkboxes

change(event, "Checkbox")} />
-

Radio

+ +

Radio

Demo Radio @@ -195,7 +265,8 @@ const Demo = () => {
-

Table

+ +

Table

{ pageSizeOptions={[5, 10]} />
-

Tabs

+ +

Tabs

{" "} @@ -219,21 +291,21 @@ const Demo = () => {
- -

Date Picker

+ +

Date Picker

{date}

- -

Stepper

+ +

Stepper

- -

Section

+ +

Section

);