@@ -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(),
@@ -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.",
+ ))
+ })
+ }
+}
@@ -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(),
}
}
}