mirror of
https://github.com/adoyle0/thaw.git
synced 2025-01-22 22:09:22 -05:00
fix: Icon inline-block
This commit is contained in:
parent
bc8c326c91
commit
983e85728a
2 changed files with 7 additions and 1 deletions
3
thaw/src/icon/icon.css
Normal file
3
thaw/src/icon/icon.css
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.thaw-icon {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
// copy https://github.com/Carlosted/leptos-icons
|
// copy https://github.com/Carlosted/leptos-icons
|
||||||
// leptos updated version causes leptos_icons error
|
// leptos updated version causes leptos_icons error
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_utils::{class_list, mount_style};
|
||||||
|
|
||||||
/// The Icon component.
|
/// The Icon component.
|
||||||
#[component]
|
#[component]
|
||||||
|
@ -24,6 +25,8 @@ pub fn Icon(
|
||||||
#[prop(optional, into)]
|
#[prop(optional, into)]
|
||||||
on_click: Option<Callback<ev::MouseEvent>>,
|
on_click: Option<Callback<ev::MouseEvent>>,
|
||||||
) -> impl IntoView {
|
) -> impl IntoView {
|
||||||
|
mount_style("icon", include_str!("./icon.css"));
|
||||||
|
|
||||||
let icon_style = RwSignal::new(None);
|
let icon_style = RwSignal::new(None);
|
||||||
let icon_x = RwSignal::new(None);
|
let icon_x = RwSignal::new(None);
|
||||||
let icon_y = RwSignal::new(None);
|
let icon_y = RwSignal::new(None);
|
||||||
|
@ -79,7 +82,7 @@ pub fn Icon(
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<svg
|
<svg
|
||||||
class=class.map(|c| c.get())
|
class=class_list!["thaw-icon", class.map(|c| move || c.get())]
|
||||||
style=move || take_signal(icon_style)
|
style=move || take_signal(icon_style)
|
||||||
x=move || take(icon_x)
|
x=move || take(icon_x)
|
||||||
y=move || take(icon_y)
|
y=move || take(icon_y)
|
||||||
|
|
Loading…
Add table
Reference in a new issue