跳到主要内容

全局样式工具

尺寸

$basic-font-sizes: (
'xs': 12px,
'sm': 12px,
'md': 14px,
'lg': 16px,
'xl': 16px,
);
类名大概相当于 CSS
c-h-xsfont-size: 12px; line-height: 12px;
c-h-smfont-size: 12px; line-height: 12px;
c-h-mdfont-size: 14px; line-height: 14px;
c-h-lgfont-size: 16px; line-height: 16px;
c-h-xlfont-size: 16px; line-height: 16px;

圆角

$basic-rounded-sizes: (
'xs': 4px,
'sm': 4px,
'md': 8px,
'lg': 12px,
'xl': 12px,
);
类名大概相当于 CSS
c-rounded-xsborder-radius: 4px;
c-rounded-smborder-radius: 4px;
c-rounded-mdborder-radius: 8px;
c-rounded-lgborder-radius: 12px;
c-rounded-xlborder-radius: 12px;

flex 布局

类名大概相当于 CSS
o-flex c-column c-rowdisplay: inline-flex;
c-justify-startjustify-content: flex-start;
c-justify-centerjustify-content: center;
c-justify-endjustify-content: flex-end;
c-justify-betweenjustify-content: space-between;
c-justify-evenlyjustify-content: space-evenly;
c-justify-aroundjustify-content: space-around;
c-items-startalign-items: flex-start;
c-items-centeralign-items: flex-center;
c-items-endalign-items: flex-end;
c-items-baselinealign-items: baseline;
c-items-stretchalign-items: stretch;

间距

$sizes: (
'xs': 4px,
'sm': 8px,
'md': 12px,
'lg': 16px,
'xl': 24px,
);

.o-[p | m][a | x | y| l | t | r | b]-[xs | sm | md | lg | xl]

类名大概相当于 CSS
c-pa-mdpadding: 12px;
c-mr-smmargin-right: 8px;
c-px-lgpadding-left: 16px; padding-right: 16px;
......

栅格

Casual UI 使用经典的 12 栅格机制

c-col-[colSize]

子元素间距

提示

该项需要配合.c-row或者.c-column使用

.c-gutter[-x | -y ]-[xs | sm | md | lg | xl]

类名含义
c-gutter-x-[size]水平方向上子元素具有[size]大小的间距
c-gutter-y-[size]垂直方向上子元素具有[size]大小的间距
c-gutter-[size]水平与垂直方向上子元素具有[size]大小的间距

一些示例

Loading...
function Demo() {
const colStyle = {
backgroundColor: 'lightblue',
textAlign: 'center',
color: '#fff',
padding: '12px 0',
}
const createRepeatCols = (n, span) =>
Array(n)
.fill(0)
.map((_, i) => (
<div key={i} className={`c-col-${span}`}>
<div style={colStyle}>col-{span} + gutter-sm</div>
</div>
))
return (
<>
<div className="c-row c-gutter-x-sm">{createRepeatCols(6, 2)}</div>
<div className="c-row c-gutter-x-md c-mt-md">
{createRepeatCols(4, 3)}
</div>
<div className="c-row c-gutter-x-lg c-mt-md">
{createRepeatCols(3, 4)}
</div>
</>
)
}
折叠/展开 代码