mirror of
https://github.com/adoyle0/thaw.git
synced 2025-01-23 14:29:22 -05:00
✨ feat: add code component
This commit is contained in:
parent
317905d0f4
commit
bbcdd3e515
6 changed files with 42 additions and 9 deletions
|
@ -10,7 +10,12 @@ leptos = { git = "https://github.com/leptos-rs/leptos.git", rev = "3a570dc", fea
|
||||||
"stable",
|
"stable",
|
||||||
] }
|
] }
|
||||||
melt-ui = { path = "../" }
|
melt-ui = { path = "../" }
|
||||||
leptos_icons = { git = "https://github.com/luoxiaozero/leptos-icons.git", rev = "9d52325", features = ["AiCloseOutlined", "AiCheckOutlined"] }
|
leptos_icons = { git = "https://github.com/luoxiaozero/leptos-icons.git", rev = "9d52325", features = [
|
||||||
leptos_router = { git = "https://github.com/leptos-rs/leptos.git", rev = "3a570dc", features = ["csr"] }
|
"AiCloseOutlined",
|
||||||
|
"AiCheckOutlined",
|
||||||
|
] }
|
||||||
|
leptos_router = { git = "https://github.com/leptos-rs/leptos.git", rev = "3a570dc", features = [
|
||||||
|
"csr",
|
||||||
|
] }
|
||||||
|
indoc = "2.0.1"
|
||||||
regex = "1.8.2"
|
regex = "1.8.2"
|
|
@ -49,7 +49,7 @@ pub fn ComponentsPage(cx: Scope) -> impl IntoView {
|
||||||
<MenuItem key="tabs" label="tabs" />
|
<MenuItem key="tabs" label="tabs" />
|
||||||
</Menu>
|
</Menu>
|
||||||
</LayoutSider>
|
</LayoutSider>
|
||||||
<Layout>
|
<Layout style="padding: 8px 12px 28px">
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</Layout>
|
</Layout>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use indoc::indoc;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use melt_ui::*;
|
use melt_ui::*;
|
||||||
|
|
||||||
|
@ -5,12 +6,26 @@ use melt_ui::*;
|
||||||
pub fn MenuPage(cx: Scope) -> impl IntoView {
|
pub fn MenuPage(cx: Scope) -> impl IntoView {
|
||||||
let selected = create_rw_signal(cx, String::from("o"));
|
let selected = create_rw_signal(cx, String::from("o"));
|
||||||
view! { cx,
|
view! { cx,
|
||||||
<div>
|
<Card>
|
||||||
{ move || selected.get() }
|
{ move || selected.get() }
|
||||||
<Menu selected>
|
<Menu selected>
|
||||||
<MenuItem key="a" label="and"/>
|
<MenuItem key="a" label="and"/>
|
||||||
<MenuItem key="o" label="or"/>
|
<MenuItem key="o" label="or"/>
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
<CardFooter slot>
|
||||||
|
<Code>
|
||||||
|
<pre>
|
||||||
|
{
|
||||||
|
indoc!(r#"
|
||||||
|
<Menu selected>
|
||||||
|
<MenuItem key="a" label="and"/>
|
||||||
|
<MenuItem key="o" label="or"/>
|
||||||
|
</Menu>
|
||||||
|
"#)
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
</Code>
|
||||||
|
</CardFooter>
|
||||||
|
</Card>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ pub fn Card(
|
||||||
view! {
|
view! {
|
||||||
cx, class=class_name,
|
cx, class=class_name,
|
||||||
<div class="melt-card">
|
<div class="melt-card">
|
||||||
<If cond=MaybeSignal::derive(cx, move || is_header || title.get().is_empty()) >
|
<If cond=MaybeSignal::derive(cx, move || is_header || !title.get().is_empty()) >
|
||||||
<Then slot>
|
<Then slot>
|
||||||
<div class="melt-card__header">
|
<div class="melt-card__header">
|
||||||
<div class="melt-card__header-content">
|
<div class="melt-card__header-content">
|
||||||
|
|
10
src/code/mod.rs
Normal file
10
src/code/mod.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
use leptos::*;
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn Code(cx: Scope, children: Children) -> impl IntoView {
|
||||||
|
view! { cx,
|
||||||
|
<code class="melt-code">
|
||||||
|
{ children(cx) }
|
||||||
|
</code>
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
mod button;
|
mod button;
|
||||||
mod card;
|
mod card;
|
||||||
mod checkbox;
|
mod checkbox;
|
||||||
|
mod code;
|
||||||
mod components;
|
mod components;
|
||||||
mod image;
|
mod image;
|
||||||
mod input;
|
mod input;
|
||||||
|
@ -19,7 +20,9 @@ mod utils;
|
||||||
mod wave;
|
mod wave;
|
||||||
|
|
||||||
pub use button::*;
|
pub use button::*;
|
||||||
|
pub use card::*;
|
||||||
pub use checkbox::*;
|
pub use checkbox::*;
|
||||||
|
pub use code::*;
|
||||||
pub use image::*;
|
pub use image::*;
|
||||||
pub use input::*;
|
pub use input::*;
|
||||||
pub use layout::*;
|
pub use layout::*;
|
||||||
|
@ -28,7 +31,7 @@ pub use modal::*;
|
||||||
pub use progress::*;
|
pub use progress::*;
|
||||||
pub use slider::*;
|
pub use slider::*;
|
||||||
pub use space::*;
|
pub use space::*;
|
||||||
pub use tabs::*;
|
|
||||||
pub use table::*;
|
pub use table::*;
|
||||||
|
pub use tabs::*;
|
||||||
pub use theme::Theme;
|
pub use theme::Theme;
|
||||||
pub use wave::*;
|
pub use wave::*;
|
||||||
|
|
Loading…
Add table
Reference in a new issue