Loading files
c730ec352This file is pinned to the selected release. Download the original to open it in your design tool.
import { Badge, LinkText } from "../widgets.slint";
import { Data, RuleCheckData } from "../api.slint";
export component LibraryRuleCheckLink inherits HorizontalLayout {
in property <RuleCheckData> data;
property <bool> has-messages: (data.unapproved > 0) || (data.messages.length > 0);
property <string> text: {
if data.unapproved > 0 {
@tr("" | "{n} warning(s)" % data.unapproved)
} else if data.messages.length > 0 {
@tr("" | "{n} approved message(s)" % data.messages.length)
} else {
@tr("All checks passed!")
}
};
callback clicked;
// Accessibility
accessible-role: button;
accessible-description: "rule check status";
accessible-enabled: true;
accessible-label: text;
accessible-action-default => {
clicked();
}
if has-messages: badge := Badge {
y: (parent.height - self.height) / 2;
background: {
if data.unapproved > 0 {
Data.theme.error.with-alpha(self.has-hover ? 1 : 0.7)
} else {
Data.theme.info.with-alpha(self.has-hover ? 1 : 0.7)
}
};
border-color: self.background;
text-color: {
if data.unapproved > 0 {
Data.theme.error-text
} else {
Data.theme.info-text
}
};
text-color-hover: self.text-color;
font-size: 12px;
text: text;
clickable: true;
accessible-role: none;
clicked => {
clicked();
}
}
if !has-messages: link-btn := LinkText {
text-color: Data.theme.base-text-success.with-alpha(0.8);
text-color-hovered: Data.theme.base-text-success;
vertical-alignment: center;
text: text;
overflow: elide;
accessible-role: none;
clicked => {
clicked();
}
}
}