euv_ui/component/carousel/view/struct.rs
1use super::*;
2
3/// One slide of the [`euv_carousel`].
4///
5/// Carries the headline of the slide and the supporting line under it.
6#[derive(Clone, Copy, CustomDebug, Data, Default, New)]
7pub struct EuvCarouselSlide {
8 /// The headline of the slide.
9 #[get(type(copy))]
10 pub title: &'static str,
11 /// The supporting line under the headline.
12 #[get(type(copy))]
13 pub desc: &'static str,
14}
15
16/// Props for the [`euv_carousel`] component.
17///
18/// Defines the strongly-typed interface for a slideshow: the slides it
19/// cycles through and the slide that is currently showing.
20#[derive(Clone, CustomDebug, Default)]
21pub struct EuvCarouselProps {
22 /// The slides, in display order.
23 pub slides: Vec<EuvCarouselSlide>,
24 /// The index of the slide that is currently showing.
25 pub active: Signal<u32>,
26 /// The callback fired when the shown slide changes.
27 #[debug(skip)]
28 pub on_change: Option<Rc<dyn Fn(u32)>>,
29}