Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Checkpoint

Antonio Scandurrab040ae8d4dbf
diff --git a/crates/gpui3/src/style.rs b/crates/gpui3/src/style.rs
index 17cd2dc43f0..f472e05c91c 100644
--- a/crates/gpui3/src/style.rs
+++ b/crates/gpui3/src/style.rs
@@ -1,8 +1,8 @@
use crate::{
- phi, point, rems, AbsoluteLength, BorrowAppContext, BorrowWindow, Bounds, ContentMask, Corners,
- CornersRefinement, DefiniteLength, Edges, EdgesRefinement, Font, FontFeatures, FontStyle,
- FontWeight, Hsla, Length, Pixels, Point, PointRefinement, Rems, Result, SharedString, Size,
- SizeRefinement, TextRun, ViewContext, WindowContext,
+ black, phi, point, rems, AbsoluteLength, BorrowAppContext, BorrowWindow, Bounds, ContentMask,
+ Corners, CornersRefinement, DefiniteLength, Edges, EdgesRefinement, Font, FontFeatures,
+ FontStyle, FontWeight, Hsla, Length, Pixels, Point, PointRefinement, Rems, Result,
+ SharedString, Size, SizeRefinement, TextRun, ViewContext, WindowContext,
};
use refineable::{Cascade, Refineable};
use smallvec::SmallVec;
@@ -125,8 +125,8 @@ pub struct TextStyle {
impl Default for TextStyle {
fn default() -> Self {
TextStyle {
- color: Hsla::default(),
- font_family: SharedString::default(),
+ color: black(),
+ font_family: "Helvetica".into(), // todo!("Get a font we know exists on the system")
font_features: FontFeatures::default(),
font_size: rems(1.),
line_height: phi(),
diff --git a/crates/storybook2/src/stories.rs b/crates/storybook2/src/stories.rs
index a7b09443e6f..f731f7e4280 100644
--- a/crates/storybook2/src/stories.rs
+++ b/crates/storybook2/src/stories.rs
@@ -1,2 +1,7 @@
-pub mod kitchen_sink;
-pub mod z_index;
+mod kitchen_sink;
+mod text;
+mod z_index;
+
+pub use kitchen_sink::*;
+pub use text::*;
+pub use z_index::*;
diff --git a/crates/storybook2/src/stories/text.rs b/crates/storybook2/src/stories/text.rs
new file mode 100644
index 00000000000..1f35d637259
--- /dev/null
+++ b/crates/storybook2/src/stories/text.rs
@@ -0,0 +1,20 @@
+use gpui3::{div, view, white, Context, ParentElement, StyleHelpers, View, WindowContext};
+
+pub struct TextStory {
+ text: View<()>,
+}
+
+impl TextStory {
+ pub fn view(cx: &mut WindowContext) -> View<()> {
+ view(cx.entity(|cx| ()), |_, cx| {
+ div()
+ .size_full()
+ .fill(white())
+ .child(concat!(
+ "The quick brown fox jumps over the lazy dog. ",
+ "Meanwhile, the lazy dog decided it was time for a change. ",
+ "He started daily workout routines, ate healthier and became the fastest dog in town.",
+ ))
+ })
+ }
+}
diff --git a/crates/storybook2/src/story_selector.rs b/crates/storybook2/src/story_selector.rs
index 0f6159d40fa..1603a46b192 100644
--- a/crates/storybook2/src/story_selector.rs
+++ b/crates/storybook2/src/story_selector.rs
@@ -1,12 +1,12 @@
use std::str::FromStr;
use std::sync::OnceLock;
+use crate::stories::*;
use anyhow::anyhow;
use clap::builder::PossibleValue;
use clap::ValueEnum;
use gpui3::{view, AnyView, Context};
use strum::{EnumIter, EnumString, IntoEnumIterator};
-
use ui::prelude::*;
#[derive(Debug, PartialEq, Eq, Clone, Copy, strum::Display, EnumString, EnumIter)]
@@ -18,6 +18,7 @@ pub enum ElementStory {
Icon,
Input,
Label,
+ Text,
ZIndex,
}
@@ -43,10 +44,10 @@ impl ElementStory {
Self::Label => {
view(cx.entity(|cx| ()), |_, _| ui::LabelStory::new().into_any()).into_any()
}
- Self::ZIndex => view(cx.entity(|cx| ()), |_, _| {
- crate::stories::z_index::ZIndexStory::new().into_any()
- })
- .into_any(),
+ Self::Text => TextStory::view(cx).into_any(),
+ Self::ZIndex => {
+ view(cx.entity(|cx| ()), |_, _| ZIndexStory::new().into_any()).into_any()
+ }
}
}
}
@@ -212,9 +213,7 @@ impl StorySelector {
match self {
Self::Element(element_story) => element_story.story(cx),
Self::Component(component_story) => component_story.story(cx),
- Self::KitchenSink => {
- crate::stories::kitchen_sink::KitchenSinkStory::view(cx).into_any()
- }
+ Self::KitchenSink => KitchenSinkStory::view(cx).into_any(),
}
}
}