mirror of
https://github.com/adoyle0/thaw.git
synced 2025-02-02 08:34:15 -05:00
feat(gh-pages): add demo component
This commit is contained in:
parent
55dc1c7b38
commit
f9e9c84623
7 changed files with 137 additions and 36 deletions
|
@ -1,3 +1,7 @@
|
|||
## melt-ui
|
||||
|
||||
A Leptos UI Library
|
||||
A Leptos UI Library
|
||||
|
||||
## Resources
|
||||
|
||||
[Pigment](https://github.com/kobaltedev/pigment)
|
|
@ -6,6 +6,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Melt UI</title>
|
||||
<link data-trunk rel="css" href="./src/assets/css/index.css" />
|
||||
<link data-trunk rel="copy-file" href="./src/assets/svg/grid_dot.svg">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
|
4
gh-pages/src/assets/svg/grid_dot.svg
Normal file
4
gh-pages/src/assets/svg/grid_dot.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="50" height="50" fill="white"/>
|
||||
<rect x="23" y="23" width="4" height="4" rx="2" fill="#cbd5e1"/>
|
||||
</svg>
|
After Width: | Height: | Size: 216 B |
23
gh-pages/src/components/demo.rs
Normal file
23
gh-pages/src/components/demo.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
use leptos::*;
|
||||
use melt_ui::Code;
|
||||
|
||||
#[slot]
|
||||
pub struct DemoCode {
|
||||
children: Children,
|
||||
}
|
||||
|
||||
#[component]
|
||||
pub fn Demo(demo_code: DemoCode, children: Children) -> impl IntoView {
|
||||
view! {
|
||||
<div style="background-image: url(/melt-ui/grid_dot.svg); background-repeat: repeat; background-size: 1.5rem; margin-top: 1rem; padding: 1rem; border: 1px solid #e5e8eb; border-top-left-radius: 0.5rem; border-top-right-radius: 0.5rem;">
|
||||
{ children() }
|
||||
</div>
|
||||
<div style="font-weight: 400; font-size: 0.875em; line-height: 1.7142857;margin-bottom: 1rem; padding: 1rem; background-color: #f9fafb; border: 1px solid #e5e8eb; border-bottom-left-radius: 0.5rem; border-bottom-right-radius: 0.5rem; border-top-width: 0;">
|
||||
<Code>
|
||||
<pre style="margin: 0">
|
||||
{ (demo_code.children)() }
|
||||
</pre>
|
||||
</Code>
|
||||
</div>
|
||||
}
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
mod demo;
|
||||
mod site_header;
|
||||
|
||||
pub use demo::{Demo, DemoCode};
|
||||
pub use site_header::*;
|
||||
|
|
|
@ -1,43 +1,110 @@
|
|||
use crate::components::{Demo, DemoCode};
|
||||
use indoc::indoc;
|
||||
use leptos::*;
|
||||
use melt_ui::*;
|
||||
|
||||
#[component]
|
||||
pub fn ButtonPage() -> impl IntoView {
|
||||
view! {
|
||||
<Space>
|
||||
<Button type_=ButtonType::PRIMARY>
|
||||
"PRIMARY"
|
||||
</Button>
|
||||
<Button type_=ButtonType::SOLID>
|
||||
"SOLID"
|
||||
</Button>
|
||||
<Button type_=ButtonType::TEXT>
|
||||
"TEXT"
|
||||
</Button>
|
||||
<Button type_=ButtonType::LINK>
|
||||
"LINK"
|
||||
</Button>
|
||||
<Button color=ButtonColor::PRIMARY>
|
||||
"PRIMARY Color"
|
||||
</Button>
|
||||
<Button color=ButtonColor::SUCCESS>
|
||||
"SUCCESS Color"
|
||||
</Button>
|
||||
<Button color=ButtonColor::WARNING>
|
||||
"WARNING Color"
|
||||
</Button>
|
||||
<Button color=ButtonColor::ERROR>
|
||||
"ERROR Color"
|
||||
</Button>
|
||||
<Button color=ButtonColor::ERROR icon=icondata::AiIcon::AiCloseOutlined>
|
||||
"ERROR Color Icon"
|
||||
</Button>
|
||||
<Button color=ButtonColor::ERROR icon=icondata::AiIcon::AiCloseOutlined round=true>
|
||||
</Button>
|
||||
</Space>
|
||||
<div style="padding-top: 12px">
|
||||
<Button style="background: blue;">"style blue"</Button>
|
||||
<Button style="width: 40px; height: 20px">"size"</Button>
|
||||
<div style="width: 896px; margin: 0 auto;">
|
||||
<h1>"Button"</h1>
|
||||
<Demo>
|
||||
<Button type_=ButtonType::PRIMARY>
|
||||
"PRIMARY"
|
||||
</Button>
|
||||
<Button type_=ButtonType::SOLID>
|
||||
"SOLID"
|
||||
</Button>
|
||||
<Button type_=ButtonType::TEXT>
|
||||
"TEXT"
|
||||
</Button>
|
||||
<Button type_=ButtonType::LINK>
|
||||
"LINK"
|
||||
</Button>
|
||||
<DemoCode slot>
|
||||
{
|
||||
indoc!(r#"
|
||||
<Button type_=ButtonType::PRIMARY>
|
||||
"PRIMARY"
|
||||
</Button>
|
||||
<Button type_=ButtonType::SOLID>
|
||||
"SOLID"
|
||||
</Button>
|
||||
<Button type_=ButtonType::TEXT>
|
||||
"TEXT"
|
||||
</Button>
|
||||
<Button type_=ButtonType::LINK>
|
||||
"LINK"
|
||||
</Button>
|
||||
"#)
|
||||
}
|
||||
</DemoCode>
|
||||
</Demo>
|
||||
<h3>"color"</h3>
|
||||
<Demo>
|
||||
<Button color=ButtonColor::PRIMARY>
|
||||
"PRIMARY Color"
|
||||
</Button>
|
||||
<Button color=ButtonColor::SUCCESS>
|
||||
"SUCCESS Color"
|
||||
</Button>
|
||||
<Button color=ButtonColor::WARNING>
|
||||
"WARNING Color"
|
||||
</Button>
|
||||
<Button color=ButtonColor::ERROR>
|
||||
"ERROR Color"
|
||||
</Button>
|
||||
<DemoCode slot>
|
||||
{
|
||||
indoc!(r#"
|
||||
<Button color=ButtonColor::PRIMARY>
|
||||
"PRIMARY Color"
|
||||
</Button>
|
||||
<Button color=ButtonColor::SUCCESS>
|
||||
"SUCCESS Color"
|
||||
</Button>
|
||||
<Button color=ButtonColor::WARNING>
|
||||
"WARNING Color"
|
||||
</Button>
|
||||
<Button color=ButtonColor::ERROR>
|
||||
"ERROR Color"
|
||||
</Button>
|
||||
"#)
|
||||
}
|
||||
</DemoCode>
|
||||
</Demo>
|
||||
<h3>"icon"</h3>
|
||||
<Demo>
|
||||
<Button color=ButtonColor::ERROR icon=icondata::AiIcon::AiCloseOutlined>
|
||||
"ERROR Color Icon"
|
||||
</Button>
|
||||
<Button color=ButtonColor::ERROR icon=icondata::AiIcon::AiCloseOutlined round=true>
|
||||
</Button>
|
||||
<DemoCode slot>
|
||||
{
|
||||
indoc! {r#"
|
||||
<Button color=ButtonColor::ERROR icon=icondata::AiIcon::AiCloseOutlined>
|
||||
"ERROR Color Icon"
|
||||
</Button>
|
||||
<Button color=ButtonColor::ERROR icon=icondata::AiIcon::AiCloseOutlined round=true>
|
||||
</Button>
|
||||
"#}
|
||||
}
|
||||
</DemoCode>
|
||||
</Demo>
|
||||
<h3>"style"</h3>
|
||||
<Demo>
|
||||
<Button style="background: blue;">"style blue"</Button>
|
||||
<Button style="width: 40px; height: 20px">"size"</Button>
|
||||
<DemoCode slot>
|
||||
{
|
||||
indoc! {r#"
|
||||
<Button style="background: blue;">"style blue"</Button>
|
||||
<Button style="width: 40px; height: 20px">"size"</Button>
|
||||
"#}
|
||||
}
|
||||
</DemoCode>
|
||||
</Demo>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ pub fn ComponentsPage() -> impl IntoView {
|
|||
<MenuItem key="select" label="select" />
|
||||
</Menu>
|
||||
</LayoutSider>
|
||||
<Layout style="padding: 8px 12px 28px">
|
||||
<Layout style="padding: 8px 12px 28px; overflow-y: scroll;">
|
||||
<Outlet />
|
||||
</Layout>
|
||||
</Layout>
|
||||
|
|
Loading…
Add table
Reference in a new issue