label.rs

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