mirror of
https://github.com/adoyle0/thaw.git
synced 2025-01-22 22:09:22 -05:00
✨ feat: button style
This commit is contained in:
parent
a21135ade1
commit
1978bb19d0
7 changed files with 13 additions and 6 deletions
|
@ -40,6 +40,9 @@ pub fn App(cx: Scope) -> impl IntoView {
|
||||||
<Route path="/modal" view=move |cx| view! {cx,
|
<Route path="/modal" view=move |cx| view! {cx,
|
||||||
<ModalPage />
|
<ModalPage />
|
||||||
} />
|
} />
|
||||||
|
<Route path="/button" view=move |cx| view! {cx,
|
||||||
|
<ButtonPage />
|
||||||
|
} />
|
||||||
</Route>
|
</Route>
|
||||||
</Routes>
|
</Routes>
|
||||||
<Routes base="/mobile".to_string()>
|
<Routes base="/mobile".to_string()>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
mod app;
|
mod app;
|
||||||
mod demo_button;
|
|
||||||
mod demo_checkbox;
|
mod demo_checkbox;
|
||||||
mod demo_slider;
|
mod demo_slider;
|
||||||
mod pages;
|
mod pages;
|
||||||
|
|
|
@ -2,7 +2,7 @@ use leptos::*;
|
||||||
use melt_ui::*;
|
use melt_ui::*;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn DemoButton(cx: Scope) -> impl IntoView {
|
pub fn ButtonPage(cx: Scope) -> impl IntoView {
|
||||||
view! {cx,
|
view! {cx,
|
||||||
<Space>
|
<Space>
|
||||||
<Button type_=ButtonType::PRIMARY>
|
<Button type_=ButtonType::PRIMARY>
|
||||||
|
@ -35,5 +35,9 @@ pub fn DemoButton(cx: Scope) -> impl IntoView {
|
||||||
<Button color=ButtonColor::ERROR icon=leptos_icons::AiIcon::AiCloseOutlined round=true>
|
<Button color=ButtonColor::ERROR icon=leptos_icons::AiIcon::AiCloseOutlined round=true>
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
|
<div style="padding-top: 12px">
|
||||||
|
<Button style="background: blue;">"style blue"</Button>
|
||||||
|
<Button style="width: 40px; height: 20px">"size"</Button>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -40,6 +40,7 @@ pub fn ComponentsPage(cx: Scope) -> impl IntoView {
|
||||||
<MenuItem key="image" label="image" />
|
<MenuItem key="image" label="image" />
|
||||||
<MenuItem key="modal" label="madal" />
|
<MenuItem key="modal" label="madal" />
|
||||||
<MenuItem key="nav-bar" label="nav-bar" />
|
<MenuItem key="nav-bar" label="nav-bar" />
|
||||||
|
<MenuItem key="button" label="button" />
|
||||||
</Menu>
|
</Menu>
|
||||||
</aside>
|
</aside>
|
||||||
<main>
|
<main>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use crate::demo_button::*;
|
|
||||||
use crate::demo_checkbox::*;
|
use crate::demo_checkbox::*;
|
||||||
use crate::demo_slider::*;
|
use crate::demo_slider::*;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
@ -40,8 +39,6 @@ pub fn Home(cx: Scope) -> impl IntoView {
|
||||||
<Progress percentage=count/>
|
<Progress percentage=count/>
|
||||||
</Space>
|
</Space>
|
||||||
<hr />
|
<hr />
|
||||||
<DemoButton />
|
|
||||||
<hr />
|
|
||||||
<DemoCheckout />
|
<DemoCheckout />
|
||||||
<hr />
|
<hr />
|
||||||
<DemoSlider />
|
<DemoSlider />
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
mod button;
|
||||||
mod components;
|
mod components;
|
||||||
mod home;
|
mod home;
|
||||||
mod image;
|
mod image;
|
||||||
|
@ -9,6 +10,7 @@ mod nav_bar;
|
||||||
mod slider;
|
mod slider;
|
||||||
mod tabbar;
|
mod tabbar;
|
||||||
|
|
||||||
|
pub use button::*;
|
||||||
pub use components::*;
|
pub use components::*;
|
||||||
pub use home::*;
|
pub use home::*;
|
||||||
pub use image::*;
|
pub use image::*;
|
||||||
|
|
|
@ -37,6 +37,7 @@ impl ButtonColor {
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Button(
|
pub fn Button(
|
||||||
cx: Scope,
|
cx: Scope,
|
||||||
|
#[prop(optional, into)] style: MaybeSignal<String>,
|
||||||
#[prop(optional, into)] type_: MaybeSignal<ButtonType>,
|
#[prop(optional, into)] type_: MaybeSignal<ButtonType>,
|
||||||
#[prop(optional, into)] color: MaybeSignal<ButtonColor>,
|
#[prop(optional, into)] color: MaybeSignal<ButtonColor>,
|
||||||
#[prop(optional, into)] round: MaybeSignal<bool>,
|
#[prop(optional, into)] round: MaybeSignal<bool>,
|
||||||
|
@ -75,7 +76,7 @@ pub fn Button(
|
||||||
class=("melt-button--text", move || type_.get() == ButtonType::TEXT)
|
class=("melt-button--text", move || type_.get() == ButtonType::TEXT)
|
||||||
class=("melt-button--link", move || type_.get() == ButtonType::LINK)
|
class=("melt-button--link", move || type_.get() == ButtonType::LINK)
|
||||||
class=("melt-button--round", move || round.get())
|
class=("melt-button--round", move || round.get())
|
||||||
style=move || css_vars.get()
|
style=move || format!("{}{}", css_vars.get(), style.get())
|
||||||
>
|
>
|
||||||
<OptionComp value=icon view=move |cx, icon| {
|
<OptionComp value=icon view=move |cx, icon| {
|
||||||
view!{cx,
|
view!{cx,
|
||||||
|
|
Loading…
Add table
Reference in a new issue