Skip to content

Commit

Permalink
feat: added extra_class to page wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbchron committed Feb 28, 2024
1 parent 5812a5b commit d934058
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crates/site-app/src/pages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ use leptos::*;
use crate::components::basic::Link;

#[component]
pub fn SmallPageWrapper(children: Children) -> impl IntoView {
pub fn SmallPageWrapper(
children: Children,
#[prop(default = "")] extra_class: &'static str,
) -> impl IntoView {
view! {
<div class="flex-1 flex flex-col justify-center items-center h-full">
<div class={format!("flex-1 flex flex-col justify-center items-center h-full {extra_class}")}>
<div class="d-card w-full max-w-sm bg-base-100 rounded-lg shadow-xl">
{children()}
</div>
Expand All @@ -29,11 +32,12 @@ pub fn PageWrapper(
/// Whether the wrapper should appear "backed" like a card.
#[prop(default = true)]
backed: bool,
#[prop(default = "")] extra_class: &'static str,
) -> impl IntoView {
view! {
<div class={format!(
"flex-1 flex flex-col gap-4 md:container md:mx-auto my-8 {rounded}
{shadow} p-4 md:px-6 {bg_color} overflow-x-auto",
{shadow} p-4 md:px-6 {bg_color} overflow-x-auto {extra_class}",
rounded = if backed { "md:rounded-xl" } else { "" },
shadow = if backed { "shadow" } else { "" },
bg_color = if backed { "bg-base-100" } else { "" },
Expand Down

0 comments on commit d934058

Please sign in to comment.