// WarningBanner — a colored info / warning / error notice (HiFi wizard). // // variant ∈ {"info","warning","error"}; the tone drives the icon, the 10% // alpha background and the 30% alpha border (matching the existing inline // banners in PlaylistImportModal). Title + body both wrap; either can be "". import { Theme } from "../foundation/semantic-colors.slint"; import { Typography } from "../foundation/typography.slint"; import { QbzIcon } from "QbzIcon.slint"; export component WarningBanner inherits Rectangle { in property title: ""; in property body: ""; in property variant: "warning"; // info | warning | error | success // Themed via the semantic families. error→danger, success→success, // warning(default)→warning. "info" has no dedicated token, so it maps to // the themed informational color (accent) with the same 10% bg / 30% border // alphas the literals used. The per-variant glyph already carries the // non-color cue (WCAG 1.4.1); this only makes the tone themeable. property tone: root.variant == "error" ? Theme.danger : (root.variant == "info" ? Theme.accent : (root.variant == "success" ? Theme.success : Theme.warning)); property bg: root.variant == "error" ? Theme.danger-bg : (root.variant == "info" ? Theme.accent.with-alpha(0.10) : (root.variant == "success" ? Theme.success-bg : Theme.warning-bg)); property brd: root.variant == "error" ? Theme.danger-border : (root.variant == "info" ? Theme.accent.with-alpha(0.30) : (root.variant == "success" ? Theme.success-border : Theme.warning-border)); property glyph: root.variant == "error" ? @image-url("../assets/icons/circle-alert.svg") : (root.variant == "info" ? @image-url("../assets/icons/info.svg") : (root.variant == "success" ? @image-url("../assets/icons/circle-check-big.svg") : @image-url("../assets/icons/triangle-alert.svg"))); border-radius: 8px; background: root.bg; border-width: 1px; border-color: root.brd; height: row.preferred-height; row := HorizontalLayout { padding: 12px; spacing: 10px; VerticalLayout { alignment: start; QbzIcon { source: root.glyph; width: 16px; height: 16px; tint: root.tone; } } VerticalLayout { spacing: 3px; horizontal-stretch: 1; if root.title != "": Text { text: root.title; color: root.tone; font-size: Typography.legal; font-weight: Typography.semibold; wrap: word-wrap; } if root.body != "": Text { text: root.body; color: Theme.text-secondary; font-size: Typography.legal; wrap: word-wrap; } } } }