Skip to content

Commit 8d3a833

Browse files
jeanp413mustard-mh
authored andcommitted
Token UI polish
1 parent 74aa75b commit 8d3a833

File tree

3 files changed

+299
-269
lines changed

3 files changed

+299
-269
lines changed

components/dashboard/src/components/PillLabel.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,27 @@
44
* See License-AGPL.txt in the project root for license information.
55
*/
66

7+
export type PillType = "info" | "warn" | "success";
8+
9+
const PillClsMap: Record<PillType, string> = {
10+
info: "bg-blue-50 text-blue-500 dark:bg-blue-500 dark:text-blue-100",
11+
warn: "bg-orange-100 text-orange-700 dark:bg-orange-600 dark:text-orange-100",
12+
success: "bg-green-100 text-green-700 dark:bg-green-600 dark:text-green-100",
13+
};
14+
715
/**
816
* Renders a pill.
917
*
1018
* **type**\
1119
* info: Renders a blue pile label (default).\
1220
* warn: Renders an orange pile label.
21+
* success: Renders an green pile label.
1322
*
1423
* **className**\
1524
* Add additional css classes to style this component.
1625
*/
17-
export default function PillLabel(props: { children?: React.ReactNode; type?: "info" | "warn"; className?: string }) {
18-
const infoStyle = "bg-blue-50 text-blue-500 dark:bg-blue-500 dark:text-blue-100";
19-
const warnStyle = "bg-orange-100 text-orange-700 dark:bg-orange-600 dark:text-orange-100";
20-
const style = `px-2 py-1 text-sm uppercase rounded-xl ${props.type === "warn" ? warnStyle : infoStyle} ${
21-
props.className
22-
}`;
26+
export default function PillLabel(props: { children?: React.ReactNode; type?: PillType; className?: string }) {
27+
const type = props.type || "info";
28+
const style = `px-2 py-1 text-sm uppercase rounded-xl ${PillClsMap[type]} ${props.className}`;
2329
return <span className={style}>{props.children}</span>;
2430
}

0 commit comments

Comments
 (0)