Scaffold Toolbar
and Breadcrumb
components (#3020)
This PR scaffolds the `Toolbar` and `Breadcrumb` components. Right now they both just consist of hardcoded data. <img width="846" alt="Screenshot 2023-09-22 at 4 54 00 PM" src="https://github.com/zed-industries/zed/assets/1486634/70578df2-7216-42d2-97ef-d38b83fb4a25"> <img width="799" alt="Screenshot 2023-09-22 at 4 46 04 PM" src="https://github.com/zed-industries/zed/assets/1486634/73ca3d8a-baf9-4ed4-b4c4-279c674672a3"> Release Notes: - N/A
This commit is contained in:
parent
27e3e09bb9
commit
fe4248cf34
8 changed files with 122 additions and 2 deletions
|
@ -1,2 +1,4 @@
|
|||
pub mod breadcrumb;
|
||||
pub mod facepile;
|
||||
pub mod toolbar;
|
||||
pub mod traffic_lights;
|
||||
|
|
16
crates/storybook/src/stories/components/breadcrumb.rs
Normal file
16
crates/storybook/src/stories/components/breadcrumb.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
use gpui2::{Element, IntoElement, ParentElement, ViewContext};
|
||||
use ui::breadcrumb;
|
||||
|
||||
use crate::story::Story;
|
||||
|
||||
#[derive(Element, Default)]
|
||||
pub struct BreadcrumbStory {}
|
||||
|
||||
impl BreadcrumbStory {
|
||||
fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
|
||||
Story::container()
|
||||
.child(Story::title_for::<_, ui::Breadcrumb>())
|
||||
.child(Story::label("Default"))
|
||||
.child(breadcrumb())
|
||||
}
|
||||
}
|
16
crates/storybook/src/stories/components/toolbar.rs
Normal file
16
crates/storybook/src/stories/components/toolbar.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
use gpui2::{Element, IntoElement, ParentElement, ViewContext};
|
||||
use ui::toolbar;
|
||||
|
||||
use crate::story::Story;
|
||||
|
||||
#[derive(Element, Default)]
|
||||
pub struct ToolbarStory {}
|
||||
|
||||
impl ToolbarStory {
|
||||
fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
|
||||
Story::container()
|
||||
.child(Story::title_for::<_, ui::Toolbar>())
|
||||
.child(Story::label("Default"))
|
||||
.child(toolbar())
|
||||
}
|
||||
}
|
|
@ -14,7 +14,9 @@ use legacy_theme::ThemeSettings;
|
|||
use log::LevelFilter;
|
||||
use settings::{default_settings, SettingsStore};
|
||||
use simplelog::SimpleLogger;
|
||||
use stories::components::breadcrumb::BreadcrumbStory;
|
||||
use stories::components::facepile::FacepileStory;
|
||||
use stories::components::toolbar::ToolbarStory;
|
||||
use stories::components::traffic_lights::TrafficLightsStory;
|
||||
use stories::elements::avatar::AvatarStory;
|
||||
use strum::EnumString;
|
||||
|
@ -64,7 +66,9 @@ enum ElementStory {
|
|||
#[derive(Debug, Clone, Copy, EnumString)]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
enum ComponentStory {
|
||||
Breadcrumb,
|
||||
Facepile,
|
||||
Toolbar,
|
||||
TrafficLights,
|
||||
}
|
||||
|
||||
|
@ -97,9 +101,15 @@ fn main() {
|
|||
Some(StorySelector::Element(ElementStory::Avatar)) => {
|
||||
view(|cx| render_story(&mut ViewContext::new(cx), AvatarStory::default()))
|
||||
}
|
||||
Some(StorySelector::Component(ComponentStory::Breadcrumb)) => {
|
||||
view(|cx| render_story(&mut ViewContext::new(cx), BreadcrumbStory::default()))
|
||||
}
|
||||
Some(StorySelector::Component(ComponentStory::Facepile)) => {
|
||||
view(|cx| render_story(&mut ViewContext::new(cx), FacepileStory::default()))
|
||||
}
|
||||
Some(StorySelector::Component(ComponentStory::Toolbar)) => {
|
||||
view(|cx| render_story(&mut ViewContext::new(cx), ToolbarStory::default()))
|
||||
}
|
||||
Some(StorySelector::Component(ComponentStory::TrafficLights)) => view(|cx| {
|
||||
render_story(&mut ViewContext::new(cx), TrafficLightsStory::default())
|
||||
}),
|
||||
|
|
|
@ -3,7 +3,7 @@ use gpui2::{
|
|||
style::StyleHelpers,
|
||||
Element, IntoElement, ParentElement, ViewContext,
|
||||
};
|
||||
use ui::{chat_panel, project_panel, status_bar, tab_bar, theme, title_bar};
|
||||
use ui::{chat_panel, project_panel, status_bar, tab_bar, theme, title_bar, toolbar};
|
||||
|
||||
#[derive(Element, Default)]
|
||||
pub struct WorkspaceElement {
|
||||
|
@ -45,7 +45,8 @@ impl WorkspaceElement {
|
|||
.flex()
|
||||
.flex_col()
|
||||
.flex_1()
|
||||
.child(tab_bar(self.tab_bar_scroll_state.clone())),
|
||||
.child(tab_bar(self.tab_bar_scroll_state.clone()))
|
||||
.child(toolbar()),
|
||||
),
|
||||
)
|
||||
.child(chat_panel(self.right_scroll_state.clone())),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue