From 45985e3c786b5d192c62719085a2341a0b2f95b1 Mon Sep 17 00:00:00 2001 From: lifeparticle Date: Mon, 18 Sep 2023 12:48:47 +1000 Subject: [PATCH] refactor --- .../components/Colors/Colors.module.scss | 6 +++ .../components/Colors/index.tsx | 19 ++++--- ui/src/pages/Colors/ShadesAndTints/index.tsx | 14 +---- .../Colors/ShadesAndTints/utils/types.ts | 1 - ui/src/pages/Data/Avatar/index.tsx | 53 +++++++++++-------- .../MdTableGenerator.module.scss | 8 +++ .../pages/Markdown/MdTableGenerator/index.tsx | 9 +++- 7 files changed, 65 insertions(+), 45 deletions(-) diff --git a/ui/src/pages/Colors/ShadesAndTints/components/Colors/Colors.module.scss b/ui/src/pages/Colors/ShadesAndTints/components/Colors/Colors.module.scss index 094d6416..81841f75 100644 --- a/ui/src/pages/Colors/ShadesAndTints/components/Colors/Colors.module.scss +++ b/ui/src/pages/Colors/ShadesAndTints/components/Colors/Colors.module.scss @@ -2,6 +2,12 @@ display: flex; flex-direction: column; + &__title { + display: flex; + align-items: center; + gap: var(--bt-size-10); + } + &__list { display: flex; flex-direction: column; diff --git a/ui/src/pages/Colors/ShadesAndTints/components/Colors/index.tsx b/ui/src/pages/Colors/ShadesAndTints/components/Colors/index.tsx index 93dec94b..2311e23b 100644 --- a/ui/src/pages/Colors/ShadesAndTints/components/Colors/index.tsx +++ b/ui/src/pages/Colors/ShadesAndTints/components/Colors/index.tsx @@ -1,19 +1,22 @@ -import { Card, Tag } from "antd"; +import { Card, Spin, Tag } from "antd"; import { getTextColor } from "lib/utils/helper"; import Clipboard from "components/RenderProps/Clipboard"; import ClipboardButton from "components/General/ClipboardButton"; import { ExtendedColorsProps } from "pages/Colors/ShadesAndTints/utils/types"; import styles from "./Colors.module.scss"; -const Colors: React.FC = ({ - colors, - isPending, - title, - type, -}) => { +const Colors: React.FC = ({ colors, isPending, type }) => { if (colors.length === 0) return null; + + const cardTitle = ( +
+ {`${type}`} + {isPending && } +
+ ); + return ( - +
{colors.map((color, index) => ( { tints={tints} /> - - + +
); diff --git a/ui/src/pages/Colors/ShadesAndTints/utils/types.ts b/ui/src/pages/Colors/ShadesAndTints/utils/types.ts index bafb476c..9eac402c 100644 --- a/ui/src/pages/Colors/ShadesAndTints/utils/types.ts +++ b/ui/src/pages/Colors/ShadesAndTints/utils/types.ts @@ -24,7 +24,6 @@ interface ColorInputsProps { interface ExtendedColorsProps extends ColorsProps { isPending: boolean; - title: string; type: string; } diff --git a/ui/src/pages/Data/Avatar/index.tsx b/ui/src/pages/Data/Avatar/index.tsx index 143bc2c3..25f9a284 100644 --- a/ui/src/pages/Data/Avatar/index.tsx +++ b/ui/src/pages/Data/Avatar/index.tsx @@ -18,9 +18,10 @@ import { import InputGrid from "components/Layouts/InputGrid"; import style from "./Avatar.module.scss"; import DropdownDownloadButton from "components/General/DropdownDownloadButton"; +import Warning from "components/General/Warning"; const Avatar = () => { - const [text, setText] = useState("BT"); + const [text, setText] = useState(""); const [avatarFont, setAvatarFont] = useState(FONTS[0].value); const [textColor, setTextColor] = useState( "rgba(255, 255, 255, 1)" @@ -142,27 +143,35 @@ const Avatar = () => {
- - - {text} - - - - + {text.length > 0 ? ( + + + {text} + + + + ) : ( + + )} ); diff --git a/ui/src/pages/Markdown/MdTableGenerator/MdTableGenerator.module.scss b/ui/src/pages/Markdown/MdTableGenerator/MdTableGenerator.module.scss index 811ccf9d..fb5ba013 100644 --- a/ui/src/pages/Markdown/MdTableGenerator/MdTableGenerator.module.scss +++ b/ui/src/pages/Markdown/MdTableGenerator/MdTableGenerator.module.scss @@ -8,5 +8,13 @@ &__editor { flex: 1; overflow: auto; + position: relative; + + &__spinner { + position: absolute; + top: 5%; + left: 1%; + z-index: 10; + } } } diff --git a/ui/src/pages/Markdown/MdTableGenerator/index.tsx b/ui/src/pages/Markdown/MdTableGenerator/index.tsx index bec17d89..d3cc58f6 100644 --- a/ui/src/pages/Markdown/MdTableGenerator/index.tsx +++ b/ui/src/pages/Markdown/MdTableGenerator/index.tsx @@ -1,5 +1,5 @@ import MDEditor from "@uiw/react-md-editor"; -import { Card, Form, Space } from "antd"; +import { Card, Form, Space, Spin } from "antd"; import { useContext, useState, useTransition } from "react"; import { generateTable } from "./util/utils"; import { ResponsiveInputWithLabel } from "components/General/FormComponents"; @@ -76,8 +76,13 @@ const TableGenerator: React.FC = () => { className={style.md__editor} data-color-mode={isDarkMode ? "dark" : "light"} > + {isPending && ( +
+ +
+ )} setOutput(val || "")} height="100%" style={{ fontSize: "52" }}