Checkpoint

This commit is contained in:
Antonio Scandurra
2023-10-17 22:16:48 +02:00
parent a8697df9e3
commit 4db0350f06
18 changed files with 117 additions and 66 deletions
+15 -3
View File
@@ -1,13 +1,25 @@
use crate::StyleRefinement;
use crate::{SharedString, StyleRefinement};
pub trait Hover {
fn set_hover_style(&mut self, style: StyleRefinement);
fn set_hover_style(&mut self, group_name: Option<SharedString>, style: StyleRefinement);
fn hover(mut self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self
where
Self: Sized,
{
self.set_hover_style(f(StyleRefinement::default()));
self.set_hover_style(None, f(StyleRefinement::default()));
self
}
fn group_hover(
mut self,
group_name: impl Into<SharedString>,
f: impl FnOnce(StyleRefinement) -> StyleRefinement,
) -> Self
where
Self: Sized,
{
self.set_hover_style(Some(group_name.into()), f(StyleRefinement::default()));
self
}
}