Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Remove unused code from storybook 2
Nate Butler3f076eeda660
diff --git a/crates/storybook2/src/collab_panel.rs b/crates/storybook2/src/collab_panel.rsdeleted file mode 100644index 1202d5ccd70..00000000000--- a/crates/storybook2/src/collab_panel.rs+++ /dev/null@@ -1,193 +0,0 @@-use gpui3::{- div, svg, view, Active, AppContext, Context, Element, ElementId, Hover, IntoAnyElement,- ParentElement, ScrollState, SharedString, Styled, View, ViewContext, WindowContext,-};-use ui::{theme, Theme};--pub struct CollabPanel {- scroll_state: ScrollState,-}--pub fn collab_panel(cx: &mut WindowContext) -> View<CollabPanel> {- view(cx.entity(|cx| CollabPanel::new(cx)), CollabPanel::render)-}--impl CollabPanel {- fn new(_: &mut AppContext) -> Self {- CollabPanel {- scroll_state: ScrollState::default(),- }- }-}--impl CollabPanel {- fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {- let theme = theme(cx);-- // Panel- div()- .w_64()- .h_full()- .flex()- .flex_col()- .font("Courier")- .text_color(theme.middle.base.default.foreground)- .border_color(theme.middle.base.default.border)- .border()- .bg(theme.middle.base.default.background)- .child(- div()- .w_full()- .flex()- .flex_col()- .overflow_y_scroll(self.scroll_state.clone())- // List Container- // .child(- // div()- // .id(0)- // .on_click(|_, _, _| {- // dbg!("click!");- // })- // .fill(theme.lowest.base.default.background)- // .pb_1()- // .border_color(theme.lowest.base.default.border)- // .border_b()- // //:: https://tailwindcss.com/docs/hover-focus-and-other-states#styling-based-on-parent-state- // // .group()- // // List Section Header- // .child(self.list_section_header(0, "#CRDB 🗃️", true, theme))- // // List Item Large- // .child(self.list_item(- // "http://github.com/maxbrunsfeld.png?s=50",- // "maxbrunsfeld",- // theme,- // )),- // )- .child(- div()- .py_2()- .flex()- .flex_col()- .child(self.list_section_header(1, "CHANNELS", true, &theme)),- )- .child(- div()- .py_2()- .flex()- .flex_col()- .child(self.list_section_header(2, "CONTACTS", true, &theme))- .children(- std::iter::repeat_with(|| {- vec![- self.list_item(- "http://github.com/as-cii.png?s=50",- "as-cii",- &theme,- ),- // self.list_item(- // "http://github.com/nathansobo.png?s=50",- // "nathansobo",- // theme,- // ),- // self.list_item(- // "http://github.com/maxbrunsfeld.png?s=50",- // "maxbrunsfeld",- // theme,- // ),- ]- })- .take(1)- .flatten(),- ),- ),- )- .child(- div()- .h_7()- .px_2()- .border_t()- .border_color(theme.middle.variant.default.border)- .flex()- .items_center()- .child(- div()- .text_sm()- .text_color(theme.middle.variant.default.foreground)- .child("Find..."),- ),- )- }-- fn list_section_header(- &self,- id: impl Into<ElementId>,- label: impl IntoAnyElement<Self>,- expanded: bool,- theme: &Theme,- ) -> impl Element<ViewState = Self> {- div()- .id(id)- .h_7()- .px_2()- .flex()- .justify_between()- .items_center()- .active(|style| style.bg(theme.highest.accent.default.background))- .child(div().flex().gap_1().text_sm().child(label))- .child(- div().flex().h_full().gap_1().items_center().child(- svg()- .path(if expanded {- "icons/caret_down.svg"- } else {- "icons/caret_up.svg"- })- .w_3p5()- .h_3p5()- .text_color(theme.middle.variant.default.foreground),- ),- )- }-- fn list_item(- &self,- avatar_uri: impl Into<SharedString>,- label: impl IntoAnyElement<Self>,- theme: &Theme,- ) -> impl Element<ViewState = Self> {- div()- .group("")- .h_7()- .px_2()- .flex()- .items_center()- // .hover()- // .fill(theme.lowest.variant.hovered.background)- // .active()- // .fill(theme.lowest.variant.pressed.background)- .child(- div()- .flex()- .items_center()- .gap_1()- .text_sm()- .child(- div()- .id("avatar")- // .uri(avatar_uri)- .size_3p5()- .rounded_full()- .bg(theme.middle.positive.default.foreground)- .shadow()- .group_hover("", |style| {- style.bg(theme.middle.negative.default.foreground)- })- .hover(|style| style.bg(theme.middle.warning.default.foreground))- .group_active("", |style| {- style.bg(theme.middle.accent.default.foreground)- }),- )- .child(label),- )- }-}diff --git a/crates/storybook2/src/storybook2.rs b/crates/storybook2/src/storybook2.rsindex 1141f11eed8..490006ecb9a 100644--- a/crates/storybook2/src/storybook2.rs+++ b/crates/storybook2/src/storybook2.rs@@ -1,12 +1,10 @@#![allow(dead_code, unused_variables)]mod assets;-mod collab_panel;mod stories;mod story;mod story_selector;mod themes;-mod workspace;use std::sync::Arc;@@ -23,7 +21,6 @@ use ui::themed;use crate::assets::Assets;use crate::story_selector::StorySelector;-use crate::workspace::workspace;// gpui2::actions! {// storybook,diff --git a/crates/storybook2/src/workspace.rs b/crates/storybook2/src/workspace.rsdeleted file mode 100644index 0919b50fc1e..00000000000--- a/crates/storybook2/src/workspace.rs+++ /dev/null@@ -1,496 +0,0 @@-use crate::{- collab_panel::{collab_panel, CollabPanel},- themes::rose_pine,-};-use gpui3::{- div, img, svg, view, Context, Element, Hover, ParentElement, Styled, View, ViewContext,- WindowContext,-};-use ui::{theme, themed};--pub struct Workspace {- left_panel: View<CollabPanel>,- right_panel: View<CollabPanel>,-}--pub fn workspace(cx: &mut WindowContext) -> View<Workspace> {- view(cx.entity(|cx| Workspace::new(cx)), Workspace::render)-}--impl Workspace {- fn new(cx: &mut ViewContext<Self>) -> Self {- Self {- left_panel: collab_panel(cx),- right_panel: collab_panel(cx),- }- }-- fn hover_test(&self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {- let theme = theme(cx);-- div().size_full().child(- div()- .group("")- .w_full()- .h_5()- .mt_10()- .bg(theme.middle.warning.default.foreground)- .flex()- .flex_row()- .justify_center()- .child(- div()- .size_5()- .bg(theme.middle.negative.default.foreground)- .group_hover("", |style| {- style.bg(theme.middle.positive.default.foreground)- })- .hover(|style| style.bg(theme.middle.variant.default.foreground)),- ),- )- }-- fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {- themed(rose_pine(), cx, |cx| {- // self.hover_test(cx)- let theme = theme(cx);- div()- .size_full()- .flex()- .flex_col()- .font("Courier")- .gap_0()- .justify_start()- .items_start()- .text_color(theme.lowest.base.default.foreground)- .bg(theme.middle.base.default.background)- .child(titlebar(cx))- .child(- div()- .flex_1()- .w_full()- .flex()- .flex_row()- .overflow_hidden()- .child(self.left_panel.clone())- .child(div().h_full().flex_1()), // .child(self.right_panel.clone()),- )- .child(statusbar::statusbar(cx))- })- }-}--struct Titlebar;--pub fn titlebar<S: 'static + Send + Sync>(cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {- let ref mut this = Titlebar;- let theme = theme(cx);- div()- .flex()- .items_center()- .justify_between()- .w_full()- .h_8()- .bg(theme.lowest.base.default.background)- .child(this.left_group(cx))- .child(this.right_group(cx))-}--impl Titlebar {- fn render<V: 'static + Send + Sync>(- &mut self,- cx: &mut ViewContext<V>,- ) -> impl Element<ViewState = V> {- let theme = theme(cx);- div()- .flex()- .items_center()- .justify_between()- .w_full()- .h_8()- .bg(theme.lowest.base.default.background)- .child(self.left_group(cx))- .child(self.right_group(cx))- }-- fn left_group<S: 'static + Send + Sync>(- &mut self,- cx: &mut ViewContext<S>,- ) -> impl Element<ViewState = S> {- let theme = theme(cx);- div()- .flex()- .items_center()- .h_full()- .gap_4()- .px_2()- // === Traffic Lights === //- .child(- div()- .flex()- .items_center()- .gap_2()- .child(- div().w_3().h_3().rounded_full().bg(theme- .lowest- .positive- .default- .foreground),- )- .child(- div().w_3().h_3().rounded_full().bg(theme- .lowest- .warning- .default- .foreground),- )- .child(- div().w_3().h_3().rounded_full().bg(theme- .lowest- .negative- .default- .foreground),- ),- )- // === Project Info === //- .child(- div()- .flex()- .items_center()- .gap_1()- .child(- div()- .h_full()- .flex()- .items_center()- .justify_center()- .px_2()- .rounded_md()- // .hover()- // .fill(theme.lowest.base.hovered.background)- // .active()- // .fill(theme.lowest.base.pressed.background)- .child(div().text_sm().child("project")),- )- .child(- div()- .h_full()- .flex()- .items_center()- .justify_center()- .px_2()- .rounded_md()- .text_color(theme.lowest.variant.default.foreground)- // .hover()- // .fill(theme.lowest.base.hovered.background)- // .active()- // .fill(theme.lowest.base.pressed.background)- .child(- div()- .text_sm()- .text_decoration_1()- .text_decoration_wavy()- .child("branch"),- ),- ),- )- }-- fn right_group<S: 'static + Send + Sync>(- &mut self,- cx: &mut ViewContext<S>,- ) -> impl Element<ViewState = S> {- let theme = theme(cx);- div()- .flex()- .items_center()- .h_full()- .gap_3()- .px_2()- // === Actions === //- .child(- div().child(- div().flex().items_center().gap_1().child(- div().size_4().flex().items_center().justify_center().child(- svg()- .path("icons/exit.svg")- .size_4()- .text_color(theme.lowest.base.default.foreground),- ),- ),- ),- )- .child(div().w_px().h_3().bg(theme.lowest.base.default.border))- // === Comms === //- .child(- div().child(- div()- .flex()- .items_center()- .gap_px()- .child(- div()- .px_2()- .py_1()- .rounded_md()- .h_full()- .flex()- .items_center()- .justify_center()- // .hover()- // .fill(theme.lowest.base.hovered.background)- // .active()- // .fill(theme.lowest.base.pressed.background)- .child(- svg()- .path("icons/mic.svg")- .size_3p5()- .text_color(theme.lowest.base.default.foreground),- ),- )- .child(- div()- .px_2()- .py_1()- .rounded_md()- .h_full()- .flex()- .items_center()- .justify_center()- // .hover()- // .fill(theme.lowest.base.hovered.background)- // .active()- // .fill(theme.lowest.base.pressed.background)- .child(- svg()- .path("icons/speaker-loud.svg")- .size_3p5()- .text_color(theme.lowest.base.default.foreground),- ),- )- .child(- div()- .px_2()- .py_1()- .rounded_md()- .h_full()- .flex()- .items_center()- .justify_center()- // .hover()- // .fill(theme.lowest.base.hovered.background)- // .active()- // .fill(theme.lowest.base.pressed.background)- .child(- svg()- .path("icons/desktop.svg")- .size_3p5()- .text_color(theme.lowest.base.default.foreground),- ),- ),- ),- )- .child(div().w_px().h_3().bg(theme.lowest.base.default.border))- // User Group- .child(- div().child(- div()- .px_1()- .py_1()- .flex()- .items_center()- .justify_center()- .rounded_md()- .gap_0p5()- // .hover()- // .fill(theme.lowest.base.hovered.background)- // .active()- // .fill(theme.lowest.base.pressed.background)- .child(- img()- .uri("https://avatars.githubusercontent.com/u/1714999?v=4")- .size_4()- .rounded_md()- .bg(theme.middle.on.default.foreground),- )- .child(- svg()- .path("icons/caret_down.svg")- .w_2()- .h_2()- .text_color(theme.lowest.variant.default.foreground),- ),- ),- )- }-}--// ================================================================================ //--mod statusbar {-- use super::*;-- pub fn statusbar<S: 'static + Send + Sync>(- cx: &mut ViewContext<S>,- ) -> impl Element<ViewState = S> {- let theme = theme(cx);- div()- .flex()- .items_center()- .justify_between()- .w_full()- .h_8()- .bg(theme.lowest.base.default.background)- // .child(left_group(cx))- // .child(right_group(cx))- }-- fn left_group<V: 'static + Send + Sync>(- cx: &mut ViewContext<V>,- ) -> impl Element<ViewState = V> {- let theme = theme(cx);- div()- .flex()- .items_center()- .h_full()- .gap_4()- .px_2()- // === Tools === //- .child(- div()- .flex()- .items_center()- .gap_1()- .child(- div()- .w_6()- .h_full()- .flex()- .items_center()- .justify_center()- .child(- svg()- .path("icons/project.svg")- .w_4()- .h_4()- .text_color(theme.lowest.base.default.foreground),- ),- )- .child(- div()- .w_6()- .h_full()- .flex()- .items_center()- .justify_center()- .child(- svg()- .path("icons/conversations.svg")- .w_4()- .h_4()- .text_color(theme.lowest.base.default.foreground),- ),- )- .child(- div()- .w_6()- .h_full()- .flex()- .items_center()- .justify_center()- .child(- svg()- .path("icons/file_icons/notebook.svg")- .w_4()- .h_4()- .text_color(theme.lowest.accent.default.foreground),- ),- ),- )- // === Diagnostics === //- .child(- div()- .flex()- .items_center()- .gap_2()- .child(- div()- .h_full()- .flex()- .items_center()- .justify_center()- .gap_0p5()- .px_1()- .text_color(theme.lowest.variant.default.foreground)- // .hover()- // .fill(theme.lowest.base.hovered.background)- // .active()- // .fill(theme.lowest.base.pressed.background)- .child(- svg()- .path("icons/error.svg")- .w_4()- .h_4()- .text_color(theme.lowest.negative.default.foreground),- )- .child(div().text_sm().child("2")),- )- .child(- div()- .text_sm()- .text_color(theme.lowest.variant.default.foreground)- .child("Something is wrong"),- ),- )- }-- fn right_group<S: 'static + Send + Sync>(- cx: &mut ViewContext<S>,- ) -> impl Element<ViewState = S> {- let theme = theme(cx);- div()- .flex()- .items_center()- .h_full()- .gap_4()- .px_2()- // === Tools === //- .child(- div()- .flex()- .items_center()- .gap_1()- .child(- div()- .w_6()- .h_full()- .flex()- .items_center()- .justify_center()- .child(- svg()- .path("icons/check_circle.svg")- .w_4()- .h_4()- .text_color(theme.lowest.base.default.foreground),- ),- )- .child(- div()- .w_6()- .h_full()- .flex()- .items_center()- .justify_center()- .child(- svg()- .path("icons/copilot.svg")- .w_4()- .h_4()- .text_color(theme.lowest.accent.default.foreground),- ),- ),- )- }-}diff --git a/crates/ui2/src/elements/button.rs b/crates/ui2/src/elements/button.rsindex b4d9d8afa63..01f76fdd49d 100644--- a/crates/ui2/src/elements/button.rs+++ b/crates/ui2/src/elements/button.rs@@ -1,7 +1,6 @@use std::marker::PhantomData;use std::sync::Arc;-use gpui3::rems;use gpui3::{DefiniteLength, Hsla, Interactive, MouseButton, WindowContext};use crate::prelude::*;