update switch

master
yutent 2023-11-29 12:24:46 +08:00
parent 08a6bb043d
commit eba5090656
1 changed files with 13 additions and 35 deletions

View File

@ -77,42 +77,20 @@ class Switch extends Component {
// 尺寸
css`
@use 'sass:map';
@use 'sass:math';
$sizes: (
s: (
hd: 14px,
h: 20px,
f: 10px
),
m: (
hd: 16px,
h: 24px,
f: 12px
),
xl: (
hd: 20px,
h: 36px,
f: 14px
)
);
@loop $s, $v in $sizes {
:host([size='#{$s}']) {
:host([size='small']) {
label {
height: map.get($v, 'h');
font-size: math.max(map.get($v, 'f'), 12px);
height: 24px;
font-size: 12px;
}
.switch {
min-width: map.get($v, 'hd') * 2 - 4;
height: map.get($v, 'hd');
padding: 0 #{math.div((map.get($v, 'hd') - map.get($v, 'f')), 2)};
min-width: 28px;
height: 16px;
padding: 0 2px;
}
.dot {
width: map.get($v, 'f');
height: map.get($v, 'f');
}
width: 12px;
height: 12px;
}
}
`,