Renamed link component, added links to Demo page
This commit is contained in:
1 parent
f4832f0324
commit
3de2a17cbc
4 files changed
+101
-27
No files matched your search
@@ -33,6 +33,7 @@ const levelConfig = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @component
|
||||||
* @param {Object} props
|
* @param {Object} props
|
||||||
* @param {'primary' | 'secondary' | 'tertiary' | 'error' | 'imagePrimary' | 'imageSecondary' | 'imageTertiary'} props.level - The level of the button
|
* @param {'primary' | 'secondary' | 'tertiary' | 'error' | 'imagePrimary' | 'imageSecondary' | 'imageTertiary'} props.level - The level of the button
|
||||||
* @param {string} props.label - The label of the button
|
* @param {string} props.label - The label of the button
|
||||||
|
|||||||
File renamed without changes.
@@ -1,6 +1,15 @@
|
|||||||
import { Link as MuiLink, useTheme } from "@mui/material";
|
import { Link as MuiLink, useTheme } from "@mui/material";
|
||||||
import PropTypes from "prop-types";
|
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 Link = ({ level, label, url }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
@@ -22,14 +31,6 @@ const Link = ({ level, label, url }) => {
|
|||||||
},
|
},
|
||||||
error: {},
|
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];
|
const { sx, color } = levelConfig[level];
|
||||||
return (
|
return (
|
||||||
<MuiLink href={url} sx={sx} color={color}>
|
<MuiLink href={url} sx={sx} color={color}>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import Button from "../../Components/Button/Button";
|
import Button from "../../Components/Button/Button";
|
||||||
import Link from "../../Components/Link";
|
import Link from "../../Components/Link/Link";
|
||||||
import ColoredLabel from "../../Components/Label/ColoredLabel";
|
import ColoredLabel from "../../Components/Label/ColoredLabel";
|
||||||
import {
|
import {
|
||||||
useTheme,
|
useTheme,
|
||||||
@@ -25,6 +25,7 @@ import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
|||||||
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
||||||
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
||||||
import AddIcon from "@mui/icons-material/Add";
|
import AddIcon from "@mui/icons-material/Add";
|
||||||
|
import Divider from "@mui/material/Divider";
|
||||||
|
|
||||||
const cols = [
|
const cols = [
|
||||||
{
|
{
|
||||||
@@ -112,23 +113,87 @@ const Demo = () => {
|
|||||||
alert(event.target.checked ? `${type} checked` : `${type} unchecked`);
|
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();
|
const theme = useTheme();
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h4>Buttons</h4>
|
<ul style={{ listStyle: "none" }}>
|
||||||
|
{links.map((link) => (
|
||||||
|
<li key={link.url}>
|
||||||
|
<Link level="primary" label={link.name} url={link.url} />
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
<Divider sx={{ margin: `${theme.spacing(2)}` }} />
|
||||||
|
<h4 id="buttons">Buttons</h4>
|
||||||
<div>
|
<div>
|
||||||
<Button level="primary" label="Primary" />
|
<Button level="primary" label="Primary" />
|
||||||
<Button level="secondary" label="Secondary" />
|
<Button level="secondary" label="Secondary" />
|
||||||
<Button level="tertiary" label="Tertiary" />
|
<Button level="tertiary" label="Tertiary" />
|
||||||
<Button level="error" label="Error" />
|
<Button level="error" label="Error" />
|
||||||
|
<Button level="imageTertiary" label="Image Button" img={<AddIcon />} />
|
||||||
</div>
|
</div>
|
||||||
<h4>Disabled Buttons</h4>
|
<Divider sx={{ margin: `${theme.spacing(2)}` }} />
|
||||||
|
<h4 id="disabled-buttons">Disabled Buttons</h4>
|
||||||
<div>
|
<div>
|
||||||
<Button level="primary" label="Primary" disabled />
|
<Button level="primary" label="Primary" disabled />
|
||||||
<Button level="secondary" label="Secondary" disabled />
|
<Button level="secondary" label="Secondary" disabled />
|
||||||
<Button level="tertiary" label="Tertiary" disabled />
|
<Button level="tertiary" label="Tertiary" disabled />
|
||||||
<Button level="error" label="Error" disabled />
|
<Button level="error" label="Error" disabled />
|
||||||
<Button level="imageTertiary" label="Image Button" img={<AddIcon />} />
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Link
|
<Link
|
||||||
@@ -137,43 +202,48 @@ const Demo = () => {
|
|||||||
url={"https://www.google.com"}
|
url={"https://www.google.com"}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<h4>Labels</h4>
|
<Divider sx={{ margin: `${theme.spacing(2)}` }} />
|
||||||
|
<h4 id="labels">Labels</h4>
|
||||||
<div>
|
<div>
|
||||||
<ColoredLabel label="Label" color={theme.palette.labelGray.color} />
|
<ColoredLabel label="Label" color={theme.palette.labelGray.color} />
|
||||||
<ColoredLabel label="Label" color={theme.palette.labelPurple.color} />
|
<ColoredLabel label="Label" color={theme.palette.labelPurple.color} />
|
||||||
<ColoredLabel label="Label" color={theme.palette.labelGreen.color} />
|
<ColoredLabel label="Label" color={theme.palette.labelGreen.color} />
|
||||||
<ColoredLabel label="Label" color={theme.palette.labelOrange.color} />
|
<ColoredLabel label="Label" color={theme.palette.labelOrange.color} />
|
||||||
</div>
|
</div>
|
||||||
|
<Divider sx={{ margin: `${theme.spacing(2)}` }} />
|
||||||
<h4>Status Lables</h4>
|
<h4 id="status-labels">Status Lables</h4>
|
||||||
<div>
|
<div>
|
||||||
<StatusLabel status="Seen" />
|
<StatusLabel status="Seen" />
|
||||||
<StatusLabel status="Waiting" />
|
<StatusLabel status="Waiting" />
|
||||||
<StatusLabel status="New" />
|
<StatusLabel status="New" />
|
||||||
<StatusLabel status="Active" />
|
<StatusLabel status="Active" />
|
||||||
</div>
|
</div>
|
||||||
<h4>Avatar</h4>
|
<Divider sx={{ margin: `${theme.spacing(2)}` }} />
|
||||||
|
<h4 id="avatar">Avatar</h4>
|
||||||
<div style={{ display: "flex" }}>
|
<div style={{ display: "flex" }}>
|
||||||
<Avatar src={avatarImage} firstName="Alex" lastName="Holliday" />
|
<Avatar src={avatarImage} firstName="Alex" lastName="Holliday" />
|
||||||
<Avatar firstName="Alex" lastName="Holliday" />
|
<Avatar firstName="Alex" lastName="Holliday" />
|
||||||
<Avatar src={avatarImage} firstName="Alex" lastName="Holliday" small />
|
<Avatar src={avatarImage} firstName="Alex" lastName="Holliday" small />
|
||||||
<Avatar firstName="Alex" lastName="Holliday" small />
|
<Avatar firstName="Alex" lastName="Holliday" small />
|
||||||
</div>
|
</div>
|
||||||
<h4>Switches</h4>
|
<Divider sx={{ margin: `${theme.spacing(2)}` }} />
|
||||||
|
<h4 id="switches">Switches</h4>
|
||||||
<div>
|
<div>
|
||||||
<Switch onChange={(event) => change(event, "Switch")} />
|
<Switch onChange={(event) => change(event, "Switch")} />
|
||||||
<Switch size="small" />
|
<Switch size="small" />
|
||||||
<Switch disabled />
|
<Switch disabled />
|
||||||
<Switch checked />
|
<Switch checked />
|
||||||
</div>
|
</div>
|
||||||
<h4>Checkboxes</h4>
|
<Divider sx={{ margin: `${theme.spacing(2)}` }} />
|
||||||
|
<h4 id="checkboxes">Checkboxes</h4>
|
||||||
<div>
|
<div>
|
||||||
<Checkbox onChange={(event) => change(event, "Checkbox")} />
|
<Checkbox onChange={(event) => change(event, "Checkbox")} />
|
||||||
<Checkbox size="small" />
|
<Checkbox size="small" />
|
||||||
<Checkbox disabled />
|
<Checkbox disabled />
|
||||||
<Checkbox checked />
|
<Checkbox checked />
|
||||||
</div>
|
</div>
|
||||||
<h4>Radio</h4>
|
<Divider sx={{ margin: `${theme.spacing(2)}` }} />
|
||||||
|
<h4 id="radio">Radio</h4>
|
||||||
<div>
|
<div>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<FormLabel>Demo Radio</FormLabel>
|
<FormLabel>Demo Radio</FormLabel>
|
||||||
@@ -195,7 +265,8 @@ const Demo = () => {
|
|||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</div>
|
</div>
|
||||||
<h4>Table</h4>
|
<Divider sx={{ margin: `${theme.spacing(2)}` }} />
|
||||||
|
<h4 id="table">Table</h4>
|
||||||
<div style={{ width: "75vw" }}>
|
<div style={{ width: "75vw" }}>
|
||||||
<DataGrid
|
<DataGrid
|
||||||
autoHeight
|
autoHeight
|
||||||
@@ -209,7 +280,8 @@ const Demo = () => {
|
|||||||
pageSizeOptions={[5, 10]}
|
pageSizeOptions={[5, 10]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<h4>Tabs</h4>
|
<Divider sx={{ margin: `${theme.spacing(2)}` }} />
|
||||||
|
<h4 id="tabs">Tabs</h4>
|
||||||
<div style={{ display: "flex", justifyContent: "center" }}>
|
<div style={{ display: "flex", justifyContent: "center" }}>
|
||||||
{" "}
|
{" "}
|
||||||
<Tabs value={tab} onChange={handleTab}>
|
<Tabs value={tab} onChange={handleTab}>
|
||||||
@@ -219,21 +291,21 @@ const Demo = () => {
|
|||||||
<Tab label="Approvals" value="approvals" />
|
<Tab label="Approvals" value="approvals" />
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
|
<Divider sx={{ margin: `${theme.spacing(2)}` }} />
|
||||||
<h4>Date Picker</h4>
|
<h4 id="date-picker">Date Picker</h4>
|
||||||
<div>
|
<div>
|
||||||
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
||||||
<DatePicker onChange={handleDate} />
|
<DatePicker onChange={handleDate} />
|
||||||
</LocalizationProvider>
|
</LocalizationProvider>
|
||||||
<h4>{date}</h4>
|
<h4>{date}</h4>
|
||||||
</div>
|
</div>
|
||||||
|
<Divider sx={{ margin: `${theme.spacing(2)}` }} />
|
||||||
<h4>Stepper</h4>
|
<h4 id="stepper">Stepper</h4>
|
||||||
<div>
|
<div>
|
||||||
<ProgressStepper steps={steps}></ProgressStepper>
|
<ProgressStepper steps={steps}></ProgressStepper>
|
||||||
</div>
|
</div>
|
||||||
|
<Divider sx={{ margin: `${theme.spacing(2)}` }} />
|
||||||
<h4>Section</h4>
|
<h4 id="section">Section</h4>
|
||||||
<Section monitors={monitors} />
|
<Section monitors={monitors} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user