feat: add focus style to button

This commit is contained in:
Ashley Wulber 2023-05-10 13:20:16 -04:00
parent eb0fcf5278
commit ba41a48971
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
2 changed files with 16 additions and 17 deletions

View file

@ -253,23 +253,22 @@ impl button::StyleSheet for Theme {
}
}
// TODO add back
// fn focused(&self, style: &Self::Style) -> button::Appearance {
// if let Button::Custom { hover, .. } = style {
// return hover(self);
// }
fn focused(&self, style: &Self::Style) -> button::Appearance {
if let Button::Custom { hover, .. } = style {
return hover(self);
}
// let active = self.active(style);
// let component = style.cosmic(self);
// button::Appearance {
// background: match style {
// Button::Link => None,
// Button::LinkActive => Some(Background::Color(component.divider.into())),
// _ => Some(Background::Color(component.hover.into())),
// },
// ..active
// }
// }
let active = self.active(style);
let component = style.cosmic(self);
button::Appearance {
background: match style {
Button::Link => None,
Button::LinkActive => Some(Background::Color(component.divider.into())),
_ => Some(Background::Color(component.hover.into())),
},
..active
}
}
}
/*

View file

@ -71,7 +71,7 @@ impl<'a> IconSource<'a> {
let handle = if let Some(path) = icon {
svg::Handle::from_path(path)
} else {
eprintln!("svg icon '{:?}' size {} not found", self, size);
eprintln!("svg icon '{self:?}' size {size} not found");
svg::Handle::from_memory(Vec::new())
};