co-authored-by: conrad <conrad@zed.dev>
co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
Mikayla
2023-11-20 14:46:01 -08:00
co-authored by conrad Nathan
parent 6985b70859
commit 2c4d83c9af
96 changed files with 1926 additions and 1955 deletions
+5 -8
View File
@@ -1,11 +1,11 @@
use gpui::{div, Div, Element, ParentElement, SharedString, Styled, ViewContext};
use gpui::{div, Div, Element, ParentElement, SharedString, Styled, WindowContext};
use crate::ActiveTheme;
pub struct Story {}
impl Story {
pub fn container<V: 'static>(cx: &mut ViewContext<V>) -> Div<V> {
pub fn container(cx: &mut WindowContext) -> Div {
div()
.size_full()
.flex()
@@ -16,21 +16,18 @@ impl Story {
.bg(cx.theme().colors().background)
}
pub fn title<V: 'static>(cx: &mut ViewContext<V>, title: SharedString) -> impl Element<V> {
pub fn title(cx: &mut WindowContext, title: SharedString) -> impl Element {
div()
.text_xl()
.text_color(cx.theme().colors().text)
.child(title)
}
pub fn title_for<V: 'static, T>(cx: &mut ViewContext<V>) -> impl Element<V> {
pub fn title_for<T>(cx: &mut WindowContext) -> impl Element {
Self::title(cx, std::any::type_name::<T>().into())
}
pub fn label<V: 'static>(
cx: &mut ViewContext<V>,
label: impl Into<SharedString>,
) -> impl Element<V> {
pub fn label(cx: &mut WindowContext, label: impl Into<SharedString>) -> impl Element {
div()
.mt_4()
.mb_2()
+3 -3
View File
@@ -147,8 +147,8 @@ mod stories {
pub struct PlayerStory;
impl Render<Self> for PlayerStory {
type Element = Div<Self>;
impl Render for PlayerStory {
type Element = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx).child(
@@ -156,7 +156,7 @@ mod stories {
.flex()
.flex_col()
.gap_4()
.child(Story::title_for::<_, PlayerColors>(cx))
.child(Story::title_for::<PlayerColors>(cx))
.child(Story::label(cx, "Player Colors"))
.child(
div()
+6
View File
@@ -63,6 +63,12 @@ impl ActiveTheme for AppContext {
}
}
// impl<'a> ActiveTheme for WindowContext<'a> {
// fn theme(&self) -> &Arc<Theme> {
// &ThemeSettings::get_global(self.app()).active_theme
// }
// }
pub struct ThemeFamily {
pub id: String,
pub name: SharedString,