Add WithRemSize element (#11928)

This PR adds a new `WithRemSize` element to the `ui` crate.

This element can be used to create an element tree that has a different
rem size than the base window.

`WithRemSize` can be nested, allowing for subtrees that have a different
rem size than their parent and their children.

<img width="912" alt="Screenshot 2024-05-16 at 2 25 28 PM"
src="https://github.com/zed-industries/zed/assets/1486634/f599cd9f-c101-496b-93e8-06e570fbf74f">

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-05-16 14:37:55 -04:00 committed by GitHub
parent 13bbaf1e18
commit fdadbc7174
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 150 additions and 10 deletions

View file

@ -40,6 +40,7 @@ pub enum ComponentStory {
ToggleButton,
ToolStrip,
ViewportUnits,
WithRemSize,
}
impl ComponentStory {
@ -76,6 +77,7 @@ impl ComponentStory {
Self::ToggleButton => cx.new_view(|_| ui::ToggleButtonStory).into(),
Self::ToolStrip => cx.new_view(|_| ui::ToolStripStory).into(),
Self::ViewportUnits => cx.new_view(|_| crate::stories::ViewportUnitsStory).into(),
Self::WithRemSize => cx.new_view(|_| crate::stories::WithRemSizeStory).into(),
Self::Picker => PickerStory::new(cx).into(),
}
}