diff --git a/demo/src/components/site_header.rs b/demo/src/components/site_header.rs index efaa7e0..17d6a7e 100644 --- a/demo/src/components/site_header.rs +++ b/demo/src/components/site_header.rs @@ -23,9 +23,7 @@ pub fn SiteHeader() -> impl IntoView { theme.set(Theme::dark()); } }); - let style = create_memo(move |_| { - theme.with(|theme| format!("border-bottom: 1px solid {}", theme.common.border_color)) - }); + let search_value = create_rw_signal(String::new()); let search_all_options = store_value(gen_search_all_options()); let search_options = create_memo(move |_| { @@ -88,6 +86,9 @@ pub fn SiteHeader() -> impl IntoView { align-items: center; justify-content: space-between; padding: 0 20px; + z-index: 1000; + position: relative; + border-bottom: 1px solid var(--colorNeutralStroke2); } .demo-name { cursor: pointer; @@ -124,7 +125,7 @@ pub fn SiteHeader() -> impl IntoView { } " - + impl IntoView { {gen_menu_data().into_view()} - - + navigate("/components/button", Default::default()); + } + > + "Read the docs" + + + "content" diff --git a/thaw/src/card/card-header.css b/thaw/src/card/card-header.css new file mode 100644 index 0000000..69d477d --- /dev/null +++ b/thaw/src/card/card-header.css @@ -0,0 +1,25 @@ +.thaw-card-header { + display: grid; + grid-auto-columns: min-content 1fr min-content; + align-items: center; + --thaw-card-header--gap: 12px; +} + +.thaw-card-header__header { + grid-row-start: 1; + grid-column-start: 2; + display: flex; +} + +.thaw-card-header__description { + grid-row-start: 2; + grid-column-start: 2; + display: flex; +} + +.thaw-card-header__action { + grid-column-start: 3; + grid-row-start: span 2; + display: flex; + margin-left: var(--thaw-card-header--gap); +} \ No newline at end of file diff --git a/thaw/src/card/card.css b/thaw/src/card/card.css index c461ef2..75bc809 100644 --- a/thaw/src/card/card.css +++ b/thaw/src/card/card.css @@ -1,11 +1,24 @@ .thaw-card { + position: relative; display: flex; flex-direction: column; - border: 1px solid var(--thaw-border-color); - border-radius: 3px; overflow: hidden; - background-color: var(--thaw-background-color); /* moving here so that applying padding to card element works correctly */ + box-sizing: border-box; + max-width: 100%; + width: 720px; + margin: auto; + padding: var(--thaw-card--size); + row-gap: var(--thaw-card--size); + column-gap: var(--thaw-card--size); + + background-color: var(--colorNeutralBackground1); + color: var(--colorNeutralForeground1); + box-shadow: var(--shadow4); + border-radius: var(--borderRadiusMedium); + + --thaw-card--size: 12px; } + .thaw-card__header { font-weight: 600; display: flex; @@ -29,4 +42,4 @@ .thaw-card__header + .thaw-card__content, .thaw-card__footer { padding: 0 28px 20px; -} +} \ No newline at end of file diff --git a/thaw/src/card/card_header.rs b/thaw/src/card/card_header.rs new file mode 100644 index 0000000..f78b8b7 --- /dev/null +++ b/thaw/src/card/card_header.rs @@ -0,0 +1,39 @@ +use leptos::*; +use thaw_components::OptionComp; +use thaw_utils::mount_style; + +#[component] +pub fn CardHeader( + #[prop(optional)] card_header_description: Option, + #[prop(optional)] card_header_action: Option, + children: Children, +) -> impl IntoView { + mount_style("card-header", include_str!("./card-header.css")); + view! { +
+
+ {children()} +
+ +
+ {(description.children)()} +
+
+ +
+ {(action.children)()} +
+
+
+ } +} + +#[slot] +pub struct CardHeaderDescription { + children: Children, +} + +#[slot] +pub struct CardHeaderAction { + children: Children, +} diff --git a/thaw/src/card/mod.rs b/thaw/src/card/mod.rs index 5468546..97d1e94 100644 --- a/thaw/src/card/mod.rs +++ b/thaw/src/card/mod.rs @@ -1,12 +1,15 @@ +mod card_header; + +pub use card_header::*; + use crate::{use_theme, Theme}; use leptos::*; use thaw_components::*; use thaw_utils::{class_list, mount_style, OptionalProp}; - -#[slot] -pub struct CardHeader { - children: Children, -} +// #[slot] +// pub struct CardHeader { +// children: Children, +// } #[slot] pub struct CardHeaderExtra { @@ -23,7 +26,7 @@ pub struct CardFooter { #[component] pub fn Card( #[prop(optional, into)] title: OptionalProp>, - #[prop(optional)] card_header: Option, + // #[prop(optional)] card_header: Option, #[prop(optional)] card_header_extra: Option, #[prop(optional, into)] class: OptionalProp>, children: Children, @@ -51,31 +54,32 @@ pub fn Card(
- {if card_header.is_some() || title.is_some() { - view! { -
-
+ // {if card_header.is_some() || title.is_some() { + // view! { + //
+ //
- {if let Some(header) = card_header { - (header.children)().into_view() - } else if let Some(title) = title.into_option() { - (move || title.get()).into_view() - } else { - unreachable!() - }} + // {if let Some(header) = card_header { + // (header.children)().into_view() + // } else if let Some(title) = title.into_option() { + // (move || title.get()).into_view() + // } else { + // unreachable!() + // }} -
- -
{(header_extra.children)()}
-
-
- } - .into() - } else { - None - }} + //
+ // + //
{(header_extra.children)()}
+ //
+ //
+ // } + // .into() + // } else { + // None + // }}
{children()}
diff --git a/thaw/src/modal/mod.rs b/thaw/src/modal/mod.rs index 396ad7d..d25535d 100644 --- a/thaw/src/modal/mod.rs +++ b/thaw/src/modal/mod.rs @@ -113,7 +113,7 @@ pub fn Modal( style=move || display.get() > - + {move || title.get()} diff --git a/thaw/src/nav/nav-drawer.css b/thaw/src/nav/nav-drawer.css index f43564d..fe931b8 100644 --- a/thaw/src/nav/nav-drawer.css +++ b/thaw/src/nav/nav-drawer.css @@ -2,7 +2,7 @@ overflow: hidden; width: 260px; max-width: 100vw; - height: auto; + height: 100%; /* max-height: 100vh; */ box-sizing: border-box; display: flex; @@ -15,12 +15,18 @@ } .thaw-nav-drawer__body { - padding: 0 var(--spacingVerticalMNudge); - flex: 1 1 0%; + flex: 1; align-self: stretch; position: relative; z-index: 1; - /* overflow: auto; */ + overflow: auto; +} + +.thaw-nav-drawer__body + > .thaw-scrollbar + > .thaw-scrollbar__container + > .thaw-scrollbar__content { + padding: 0 var(--spacingVerticalMNudge); } .thaw-nav-drawer__footer { @@ -67,4 +73,4 @@ background-color: var(--colorNeutralForeground2BrandSelected); border-radius: var(--borderRadiusCircular); margin-inline-start: -18px; -} \ No newline at end of file +} diff --git a/thaw/src/theme/color.rs b/thaw/src/theme/color.rs index bf2cb6d..ea3450b 100644 --- a/thaw/src/theme/color.rs +++ b/thaw/src/theme/color.rs @@ -45,6 +45,8 @@ pub struct ColorTheme { pub color_transparent_background: String, pub color_transparent_background_hover: String, pub color_transparent_background_pressed: String, + + pub shadow4: String, } impl ColorTheme { @@ -93,6 +95,8 @@ impl ColorTheme { color_transparent_background: "transparent".into(), color_transparent_background_hover: "transparent".into(), color_transparent_background_pressed: "transparent".into(), + + shadow4: "0 0 2px rgba(0,0,0,0.12), 0 2px 4px rgba(0,0,0,0.14)".into(), } } @@ -141,6 +145,8 @@ impl ColorTheme { color_transparent_background: "transparent".into(), color_transparent_background_hover: "transparent".into(), color_transparent_background_pressed: "transparent".into(), + + shadow4: "0 0 2px rgba(0,0,0,0.24), 0 2px 4px rgba(0,0,0,0.28)".into(), } } } \ No newline at end of file