@bouko/react 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
type Color = "accent" | "orange" | "dark";
|
|
3
|
+
type Props = {
|
|
3
4
|
style?: string;
|
|
5
|
+
color?: Color;
|
|
4
6
|
children: ReactNode;
|
|
5
|
-
}
|
|
7
|
+
};
|
|
8
|
+
export default function Badge({ style, color, children }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { cn, tv } from "@bouko/style";
|
|
3
|
+
export default function Badge({ style, color, children }) {
|
|
4
|
+
return (_jsx("span", { className: cn(styles({ color }), style), children: children }));
|
|
4
5
|
}
|
|
6
|
+
const styles = tv({
|
|
7
|
+
base: "w-min px-3 py-1 border rounded-full text-xs font-semibold",
|
|
8
|
+
defaultVariants: { color: "accent" },
|
|
9
|
+
variants: {
|
|
10
|
+
color: {
|
|
11
|
+
accent: "bg-accent/20 border-accent-dark text-accent-dark",
|
|
12
|
+
orange: "bg-orange-400/20 border-orange-500 text-orange-500",
|
|
13
|
+
dark: "bg-slate-700/20 border-slate-800 text-slate-800"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|