Migrate link and tag components

This commit is contained in:
Florian RICHER 2023-10-08 21:36:00 +02:00
parent 79daad993e
commit d420097a88
11 changed files with 93 additions and 54 deletions

View file

@ -0,0 +1,17 @@
use leptos::*;
use leptos_icons::FiIcon::FiExternalLink;
use leptos_icons::*;
#[component]
pub fn Link(
#[prop[optional]]
url: String,
children: Children
) -> impl IntoView {
view! {
<a class="flex gap-1 font-semibold italic" href={url} target="_blank">
{ children() }
<i class="flex items-center"><Icon icon=Icon::from(FiExternalLink) class="scale-75" /></i>
</a>
}
}

View file

@ -0,0 +1,5 @@
mod tag;
pub use tag::Tag;
mod link;
pub use link::Link;

14
src/app/components/tag.rs Normal file
View file

@ -0,0 +1,14 @@
use leptos::*;
#[component]
pub fn Tag(
#[prop[optional]]
url: String,
children: Children
) -> impl IntoView {
view! {
<a class="rounded-lg px-3 py-1 font-normal text-sm bg-primary dark:bg-dark_primary text-on_primary dark:text-dark_on_primary" href=url target="_blank">
{children()}
</a>
}
}