This PR reworks the theme definition in the `theme2` crate to be based off of the new theme work that @iamnbutler has been working on. We're still developing the new theme system, but it is complete enough that we can now load the default theme and use it to theme the storybook (albeit with some further refining of the color palette required). --------- Co-authored-by: Nate Butler <iamnbutler@gmail.com> Co-authored-by: Marshall Bowers <marshall@zed.dev>
39 lines
979 B
Rust
39 lines
979 B
Rust
use gpui2::Div;
|
|
|
|
use crate::prelude::*;
|
|
|
|
pub struct Story {}
|
|
|
|
impl Story {
|
|
pub fn container<V: 'static>(cx: &mut ViewContext<V>) -> Div<V> {
|
|
div()
|
|
.size_full()
|
|
.flex()
|
|
.flex_col()
|
|
.pt_2()
|
|
.px_4()
|
|
.font("Zed Mono")
|
|
.bg(cx.theme().colors().background)
|
|
}
|
|
|
|
pub fn title<V: 'static>(cx: &mut ViewContext<V>, title: &str) -> impl Component<V> {
|
|
div()
|
|
.text_xl()
|
|
.text_color(cx.theme().colors().text)
|
|
.child(title.to_owned())
|
|
}
|
|
|
|
pub fn title_for<V: 'static, T>(cx: &mut ViewContext<V>) -> impl Component<V> {
|
|
Self::title(cx, std::any::type_name::<T>())
|
|
}
|
|
|
|
pub fn label<V: 'static>(cx: &mut ViewContext<V>, label: &str) -> impl Component<V> {
|
|
div()
|
|
.mt_4()
|
|
.mb_2()
|
|
.text_xs()
|
|
.text_color(cx.theme().colors().text)
|
|
.child(label.to_owned())
|
|
}
|
|
}
|