feat(button): add ListItem style

This commit is contained in:
Michael Aaron Murphy 2024-12-10 16:35:24 +01:00
parent 43e7213b70
commit a02fa21d36
No known key found for this signature in database
GPG key ID: B2732D4240C9212C

View file

@ -27,6 +27,7 @@ pub enum Button {
IconVertical,
Image,
Link,
ListItem,
MenuFolder,
MenuItem,
MenuRoot,
@ -137,6 +138,21 @@ pub fn appearance(
appearance.text_color = Some(component.on.into());
corner_radii = &cosmic.corner_radii.radius_s;
}
Button::ListItem => {
corner_radii = &[0.0; 4];
let (background, text, icon) = color(&cosmic.background.component);
if selected {
appearance.background =
Some(Background::Color(cosmic.primary.component.hover.into()));
appearance.icon_color = Some(cosmic.accent.base.into());
appearance.text_color = Some(cosmic.accent.base.into());
} else {
appearance.background = Some(Background::Color(background));
appearance.icon_color = icon;
appearance.text_color = text;
}
}
Button::MenuItem => {
let (background, text, icon) = color(&cosmic.background.component);
appearance.background = Some(Background::Color(background));