Reorganize list components
This commit is contained in:
parent
960ef7116d
commit
390b0d8d56
8 changed files with 436 additions and 373 deletions
38
crates/ui2/src/components/stories/list.rs
Normal file
38
crates/ui2/src/components/stories/list.rs
Normal file
|
@ -0,0 +1,38 @@
|
|||
use gpui::{Div, Render};
|
||||
use story::Story;
|
||||
|
||||
use crate::{prelude::*, ListHeader, ListSeparator, ListSubHeader};
|
||||
use crate::{List, ListItem};
|
||||
|
||||
pub struct ListStory;
|
||||
|
||||
impl Render for ListStory {
|
||||
type Element = Div;
|
||||
|
||||
fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
Story::container()
|
||||
.child(Story::title_for::<List>())
|
||||
.child(Story::label("Default"))
|
||||
.child(
|
||||
List::new()
|
||||
.child(ListItem::new("apple").child("Apple"))
|
||||
.child(ListItem::new("banana").child("Banana"))
|
||||
.child(ListItem::new("cherry").child("Cherry")),
|
||||
)
|
||||
.child(Story::label("With sections"))
|
||||
.child(
|
||||
List::new()
|
||||
.child(ListHeader::new("Fruits"))
|
||||
.child(ListItem::new("apple").child("Apple"))
|
||||
.child(ListItem::new("banana").child("Banana"))
|
||||
.child(ListItem::new("cherry").child("Cherry"))
|
||||
.child(ListSeparator)
|
||||
.child(ListHeader::new("Vegetables"))
|
||||
.child(ListSubHeader::new("Root Vegetables"))
|
||||
.child(ListItem::new("carrot").child("Carrot"))
|
||||
.child(ListItem::new("potato").child("Potato"))
|
||||
.child(ListSubHeader::new("Leafy Vegetables"))
|
||||
.child(ListItem::new("kale").child("Kale")),
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue