This commit is contained in:
2026-01-30 12:56:00 +08:00
parent 91f24cb462
commit dcbbda951e
89 changed files with 13486 additions and 72 deletions

44
ui/components/label.slint Normal file
View File

@@ -0,0 +1,44 @@
import { Theme, Typography } from "../theme/theme.slint";
export enum LabelSize {
xs,
sm,
base,
lg,
xl,
}
export enum LabelColor {
foreground,
muted,
primary,
secondary,
destructive,
}
export component Label {
in property <string> text: "";
in property <LabelSize> size: LabelSize.base;
in property <LabelColor> color-variant: LabelColor.foreground;
in property <int> font-weight: Typography.weights.normal;
private property <length> font-size: size == LabelSize.xs ? Typography.sizes.xs :
size == LabelSize.sm ? Typography.sizes.sm :
size == LabelSize.lg ? Typography.sizes.lg :
size == LabelSize.xl ? Typography.sizes.xl :
Typography.sizes.base;
private property <color> text-color: color-variant == LabelColor.muted ? Theme.colors.muted-foreground :
color-variant == LabelColor.primary ? Theme.colors.primary :
color-variant == LabelColor.secondary ? Theme.colors.secondary :
color-variant == LabelColor.destructive ? Theme.colors.destructive :
Theme.colors.foreground;
Text {
text: root.text;
color: root.text-color;
font-size: root.font-size;
font-weight: root.font-weight;
vertical-alignment: center;
}
}