Merge branch 'main' into derive-element-redux
This commit is contained in:
commit
0798cfd58c
117 changed files with 7260 additions and 2951 deletions
|
@ -1,4 +1,7 @@
|
|||
use gpui::{div, white, Div, ParentElement, Render, Styled, View, VisualContext, WindowContext};
|
||||
use gpui::{
|
||||
blue, div, red, white, Div, ParentElement, Render, Styled, View, VisualContext, WindowContext,
|
||||
};
|
||||
use ui::v_stack;
|
||||
|
||||
pub struct TextStory;
|
||||
|
||||
|
@ -12,10 +15,46 @@ impl Render<Self> for TextStory {
|
|||
type Element = Div<Self>;
|
||||
|
||||
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
|
||||
div().size_full().bg(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.",
|
||||
))
|
||||
v_stack()
|
||||
.bg(blue())
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.child(div().max_w_96().bg(white()).child(concat!(
|
||||
"max-width: 96. 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.",
|
||||
))),
|
||||
)
|
||||
.child(div().h_5())
|
||||
.child(div().flex().flex_col().w_96().bg(white()).child(concat!(
|
||||
"flex-col. width: 96; 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.",
|
||||
)))
|
||||
.child(div().h_5())
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.child(div().min_w_96().bg(white()).child(concat!(
|
||||
"min-width: 96. 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.",
|
||||
))))
|
||||
.child(div().h_5())
|
||||
.child(div().flex().w_96().bg(white()).child(div().overflow_hidden().child(concat!(
|
||||
"flex-row. width 96. overflow-hidden. 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.",
|
||||
))))
|
||||
// NOTE: When rendering text in a horizonal flex container,
|
||||
// Taffy will not pass width constraints down from the parent.
|
||||
// To fix this, render text in a praent with overflow: hidden, which
|
||||
.child(div().h_5())
|
||||
.child(div().flex().w_96().bg(red()).child(concat!(
|
||||
"flex-row. width 96. 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.",
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue