diff --git a/src/_test.tsx b/src/_test.tsx index a10b147..83842e0 100644 --- a/src/_test.tsx +++ b/src/_test.tsx @@ -5,6 +5,7 @@ import Upload from "./components/upload/upload"; import Tab from "./components/tab/tab"; import * as GOJI from "goji_ui"; import Input from "./components/input"; +import Tag from "./components/tag"; function App() { const [visible, setVisible] = useState(false); @@ -18,6 +19,89 @@ function App() { return (
+
+ + + + + } + > + Success + + + + + + + } + > + Error + + Processing + Waring + + + + + + } + onClose={(e) => { + console.log("eeee", e); + }} + > + Delete + + console.log("e====>", e)} + > + tag + +
+ { + className?: string | undefined; + style?: React.CSSProperties | undefined; + children: React.ReactNode; + color?: string | undefined; + background?: tagsBackgroundColor; + bordered?: boolean | undefined; + icon?: React.ReactNode | undefined; + closeIcon?: React.ReactNode | undefined; + closable?: boolean | undefined; + onClose?: (e: React.MouseEvent) => void; +} + +const Tag = (props: ITagProps) => { + const { + className, + style, + children, + color, + background, + icon, + closeIcon, + bordered = true, + closable, + onClose + } = props; + + const TagColor = (background: tagsBackgroundColor) => { + switch (background) { + case "success": + return "success"; + case "waring": + return "waring"; + case "error": + return "error"; + case "processing": + return "processing"; + default: + break; + } + }; + + return ( + +
+ {!closable && {icon}} + {children} + + {closable && closeIcon} + +
+
+ ); +}; + +export default Tag;