label.rs

 1use gpui::{Div, Render};
 2use story::Story;
 3
 4use crate::prelude::*;
 5use crate::{HighlightedLabel, Label};
 6
 7pub struct LabelStory;
 8
 9impl Render for LabelStory {
10    type Element = Div;
11
12    fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
13        Story::container()
14            .child(Story::title_for::<Label>())
15            .child(Story::label("Default"))
16            .child(Label::new("Hello, world!"))
17            .child(Story::label("Highlighted"))
18            .child(HighlightedLabel::new(
19                "Hello, world!",
20                vec![0, 1, 2, 7, 8, 12],
21            ))
22            .child(HighlightedLabel::new(
23                "Héllo, world!",
24                vec![0, 1, 3, 8, 9, 13],
25            ))
26            .child(Story::label("Highlighted with `color`"))
27            .child(
28                HighlightedLabel::new("Hello, world!", vec![0, 1, 2, 7, 8, 12]).color(Color::Error),
29            )
30    }
31}