Unified · Split
| @@ -1,8 +1,8 @@ | |||
| 1 | use crate::{ | 1 | use crate::{ |
| 2 | phi, point, rems, AbsoluteLength, BorrowAppContext, BorrowWindow, Bounds, ContentMask, Corners, | 2 | black, phi, point, rems, AbsoluteLength, BorrowAppContext, BorrowWindow, Bounds, ContentMask, |
| 3 | CornersRefinement, DefiniteLength, Edges, EdgesRefinement, Font, FontFeatures, FontStyle, | 3 | Corners, CornersRefinement, DefiniteLength, Edges, EdgesRefinement, Font, FontFeatures, |
| 4 | FontWeight, Hsla, Length, Pixels, Point, PointRefinement, Rems, Result, SharedString, Size, | 4 | FontStyle, FontWeight, Hsla, Length, Pixels, Point, PointRefinement, Rems, Result, |
| 5 | SizeRefinement, TextRun, ViewContext, WindowContext, | 5 | SharedString, Size, SizeRefinement, TextRun, ViewContext, WindowContext, |
| 6 | }; | 6 | }; |
| 7 | use refineable::{Cascade, Refineable}; | 7 | use refineable::{Cascade, Refineable}; |
| 8 | use smallvec::SmallVec; | 8 | use smallvec::SmallVec; |
| @@ -125,8 +125,8 @@ pub struct TextStyle { · 116 unmodified lines | |||
| 125 | impl Default for TextStyle { | 125 | impl Default for TextStyle { |
| 126 | fn default() -> Self { | 126 | fn default() -> Self { |
| 127 | TextStyle { | 127 | TextStyle { |
| 128 | color: Hsla::default(), | 128 | color: black(), |
| 129 | font_family: SharedString::default(), | 129 | font_family: "Helvetica".into(), // todo!("Get a font we know exists on the system") |
| 130 | font_features: FontFeatures::default(), | 130 | font_features: FontFeatures::default(), |
| 131 | font_size: rems(1.), | 131 | font_size: rems(1.), |
| 132 | line_height: phi(), | 132 | line_height: phi(), |
| @@ -1,2 +1,7 @@ | |||
| 1 | pub mod kitchen_sink; | 1 | mod kitchen_sink; |
| 2 | pub mod z_index; | 2 | mod text; |
| 3 | mod z_index; | ||
| 4 | |||
| 5 | pub use kitchen_sink::*; | ||
| 6 | pub use text::*; | ||
| 7 | pub use z_index::*; | ||
| @@ -0,0 +1,20 @@ | |||
| 1 | use gpui3::{div, view, white, Context, ParentElement, StyleHelpers, View, WindowContext}; | ||
| 2 | |||
| 3 | pub struct TextStory { | ||
| 4 | text: View<()>, | ||
| 5 | } | ||
| 6 | |||
| 7 | impl TextStory { | ||
| 8 | pub fn view(cx: &mut WindowContext) -> View<()> { | ||
| 9 | view(cx.entity(|cx| ()), |_, cx| { | ||
| 10 | div() | ||
| 11 | .size_full() | ||
| 12 | .fill(white()) | ||
| 13 | .child(concat!( | ||
| 14 | "The quick brown fox jumps over the lazy dog. ", | ||
| 15 | "Meanwhile, the lazy dog decided it was time for a change. ", | ||
| 16 | "He started daily workout routines, ate healthier and became the fastest dog in town.", | ||
| 17 | )) | ||
| 18 | }) | ||
| 19 | } | ||
| 20 | } | ||
| @@ -1,12 +1,12 @@ | |||
| 1 | use std::str::FromStr; | 1 | use std::str::FromStr; |
| 2 | use std::sync::OnceLock; | 2 | use std::sync::OnceLock; |
| 3 | 3 | ||
| 4 | use crate::stories::*; | ||
| 4 | use anyhow::anyhow; | 5 | use anyhow::anyhow; |
| 5 | use clap::builder::PossibleValue; | 6 | use clap::builder::PossibleValue; |
| 6 | use clap::ValueEnum; | 7 | use clap::ValueEnum; |
| 7 | use gpui3::{view, AnyView, Context}; | 8 | use gpui3::{view, AnyView, Context}; |
| 8 | use strum::{EnumIter, EnumString, IntoEnumIterator}; | 9 | use strum::{EnumIter, EnumString, IntoEnumIterator}; |
| 9 | |||
| 10 | use ui::prelude::*; | 10 | use ui::prelude::*; |
| 11 | 11 | ||
| 12 | #[derive(Debug, PartialEq, Eq, Clone, Copy, strum::Display, EnumString, EnumIter)] | 12 | #[derive(Debug, PartialEq, Eq, Clone, Copy, strum::Display, EnumString, EnumIter)] |
| @@ -18,6 +18,7 @@ pub enum ElementStory { · 5 unmodified lines | |||
| 18 | Icon, | 18 | Icon, |
| 19 | Input, | 19 | Input, |
| 20 | Label, | 20 | Label, |
| 21 | Text, | ||
| 21 | ZIndex, | 22 | ZIndex, |
| 22 | } | 23 | } |
| 23 | 24 | ||
| @@ -43,10 +44,10 @@ impl ElementStory { · 19 unmodified lines | |||
| 43 | Self::Label => { | 44 | Self::Label => { |
| 44 | view(cx.entity(|cx| ()), |_, _| ui::LabelStory::new().into_any()).into_any() | 45 | view(cx.entity(|cx| ()), |_, _| ui::LabelStory::new().into_any()).into_any() |
| 45 | } | 46 | } |
| 46 | Self::ZIndex => view(cx.entity(|cx| ()), |_, _| { | 47 | Self::Text => TextStory::view(cx).into_any(), |
| 47 | crate::stories::z_index::ZIndexStory::new().into_any() | 48 | Self::ZIndex => { |
| 48 | }) | 49 | view(cx.entity(|cx| ()), |_, _| ZIndexStory::new().into_any()).into_any() |
| 49 | .into_any(), | 50 | } |
| 50 | } | 51 | } |
| 51 | } | 52 | } |
| 52 | } | 53 | } |
| @@ -212,9 +213,7 @@ impl StorySelector { · 159 unmodified lines | |||
| 212 | match self { | 213 | match self { |
| 213 | Self::Element(element_story) => element_story.story(cx), | 214 | Self::Element(element_story) => element_story.story(cx), |
| 214 | Self::Component(component_story) => component_story.story(cx), | 215 | Self::Component(component_story) => component_story.story(cx), |
| 215 | Self::KitchenSink => { | 216 | Self::KitchenSink => KitchenSinkStory::view(cx).into_any(), |
| 216 | crate::stories::kitchen_sink::KitchenSinkStory::view(cx).into_any() | ||
| 217 | } | ||
| 218 | } | 217 | } |
| 219 | } | 218 | } |
| 220 | } | 219 | } |