Checkpoint
This commit is contained in:
parent
c6e20aed9b
commit
b040ae8d4d
4 changed files with 40 additions and 16 deletions
|
@ -1,8 +1,8 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
phi, point, rems, AbsoluteLength, BorrowAppContext, BorrowWindow, Bounds, ContentMask, Corners,
|
black, phi, point, rems, AbsoluteLength, BorrowAppContext, BorrowWindow, Bounds, ContentMask,
|
||||||
CornersRefinement, DefiniteLength, Edges, EdgesRefinement, Font, FontFeatures, FontStyle,
|
Corners, CornersRefinement, DefiniteLength, Edges, EdgesRefinement, Font, FontFeatures,
|
||||||
FontWeight, Hsla, Length, Pixels, Point, PointRefinement, Rems, Result, SharedString, Size,
|
FontStyle, FontWeight, Hsla, Length, Pixels, Point, PointRefinement, Rems, Result,
|
||||||
SizeRefinement, TextRun, ViewContext, WindowContext,
|
SharedString, Size, SizeRefinement, TextRun, ViewContext, WindowContext,
|
||||||
};
|
};
|
||||||
use refineable::{Cascade, Refineable};
|
use refineable::{Cascade, Refineable};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
@ -125,8 +125,8 @@ pub struct TextStyle {
|
||||||
impl Default for TextStyle {
|
impl Default for TextStyle {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
TextStyle {
|
TextStyle {
|
||||||
color: Hsla::default(),
|
color: black(),
|
||||||
font_family: SharedString::default(),
|
font_family: "Helvetica".into(), // todo!("Get a font we know exists on the system")
|
||||||
font_features: FontFeatures::default(),
|
font_features: FontFeatures::default(),
|
||||||
font_size: rems(1.),
|
font_size: rems(1.),
|
||||||
line_height: phi(),
|
line_height: phi(),
|
||||||
|
|
|
@ -1,2 +1,7 @@
|
||||||
pub mod kitchen_sink;
|
mod kitchen_sink;
|
||||||
pub mod z_index;
|
mod text;
|
||||||
|
mod z_index;
|
||||||
|
|
||||||
|
pub use kitchen_sink::*;
|
||||||
|
pub use text::*;
|
||||||
|
pub use z_index::*;
|
||||||
|
|
20
crates/storybook2/src/stories/text.rs
Normal file
20
crates/storybook2/src/stories/text.rs
Normal file
|
@ -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::str::FromStr;
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
|
use crate::stories::*;
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use clap::builder::PossibleValue;
|
use clap::builder::PossibleValue;
|
||||||
use clap::ValueEnum;
|
use clap::ValueEnum;
|
||||||
use gpui3::{view, AnyView, Context};
|
use gpui3::{view, AnyView, Context};
|
||||||
use strum::{EnumIter, EnumString, IntoEnumIterator};
|
use strum::{EnumIter, EnumString, IntoEnumIterator};
|
||||||
|
|
||||||
use ui::prelude::*;
|
use ui::prelude::*;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Clone, Copy, strum::Display, EnumString, EnumIter)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy, strum::Display, EnumString, EnumIter)]
|
||||||
|
@ -18,6 +18,7 @@ pub enum ElementStory {
|
||||||
Icon,
|
Icon,
|
||||||
Input,
|
Input,
|
||||||
Label,
|
Label,
|
||||||
|
Text,
|
||||||
ZIndex,
|
ZIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,10 +44,10 @@ impl ElementStory {
|
||||||
Self::Label => {
|
Self::Label => {
|
||||||
view(cx.entity(|cx| ()), |_, _| ui::LabelStory::new().into_any()).into_any()
|
view(cx.entity(|cx| ()), |_, _| ui::LabelStory::new().into_any()).into_any()
|
||||||
}
|
}
|
||||||
Self::ZIndex => view(cx.entity(|cx| ()), |_, _| {
|
Self::Text => TextStory::view(cx).into_any(),
|
||||||
crate::stories::z_index::ZIndexStory::new().into_any()
|
Self::ZIndex => {
|
||||||
})
|
view(cx.entity(|cx| ()), |_, _| ZIndexStory::new().into_any()).into_any()
|
||||||
.into_any(),
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,9 +213,7 @@ impl StorySelector {
|
||||||
match self {
|
match self {
|
||||||
Self::Element(element_story) => element_story.story(cx),
|
Self::Element(element_story) => element_story.story(cx),
|
||||||
Self::Component(component_story) => component_story.story(cx),
|
Self::Component(component_story) => component_story.story(cx),
|
||||||
Self::KitchenSink => {
|
Self::KitchenSink => KitchenSinkStory::view(cx).into_any(),
|
||||||
crate::stories::kitchen_sink::KitchenSinkStory::view(cx).into_any()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue