V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
colliedog
V2EX  ›  分享创造

写了个静态提取 css 的 css-in-jss 的库,能不能给点个 star https://github.com/colliejs/colliejs

  •  1
     
  •   colliedog · 130 天前 · 745 次点击
    这是一个创建于 130 天前的主题,其中的信息可能已经有所发展或是发生改变。
    3 条回复    2024-01-04 12:17:34 +08:00
    colliedog
        1
    colliedog  
    OP
       130 天前
    import { absYCenter } from "@collie-ui/css";
    import { makeStyled } from "@colliejs/react";
    import { collieConfig } from "../collie.config";
    export const styled = makeStyled(collieConfig);

    export const StyledButton = styled("button", {
    w: 100,
    h: 40,
    _hover: {
    opacity: 0.8,
    background: "$primary",
    borderRadius: 10,
    color: "white",
    },
    _after: {
    h: "100%",
    w: [10, 4],
    background: "red",
    ...absYCenter({ right: 0 }),
    },

    variants: {
    size: {
    full: {
    w: "100%",
    },
    big: {
    w: 80,
    },
    md: {
    w: 40,
    },
    sm: {
    w: 20,
    },
    dynamic: x => ({
    //any size you want
    w: x,
    }),
    },
    shape: {
    round: {
    borderRadius: 9999,
    },
    rect: {
    borderRadius: 0,
    },
    },
    status: {
    disabled: {
    true: {
    cursor: "not-allowed",
    background: "$gray200",
    },
    },
    },
    },

    compoundVariants: [
    {
    size: "big",
    shape: "round",
    css: {
    background: "$gray200",
    },
    },
    ],
    defaultVariants: {
    shape: "rect",
    },
    });
    privateproxies
        2
    privateproxies  
       129 天前
    支持一下
    colliedog
        3
    colliedog  
    OP
       129 天前
    @privateproxies 感谢大佬
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2875 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 08:10 · PVG 16:10 · LAX 01:10 · JFK 04:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.