This repository has been archived by the owner on Aug 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* return an Element instead LazyNodes * migrate props and make code more readable * migrate props * migrate props and use i18n directly as values * migrate props, use i18n directly and remove duplicated code * migrate dioxus, use i18n directly and remove duplicated code * migrate dioxus * migrate dioxus and use i18n directly as values (#77) * update dependencies (#71) * remove duplicated logger * feat: register as guest * Room interaction (#66) * feat: room interaction * resolve conflict * minor change
- Loading branch information
Showing
101 changed files
with
4,194 additions
and
4,818 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,56 @@ | ||
use dioxus::prelude::*; | ||
|
||
#[derive(PartialEq, Clone)] | ||
pub enum Variant { | ||
Primary, | ||
Secondary, | ||
Tertiary, | ||
} | ||
|
||
#[derive(Props)] | ||
pub struct ButtonProps<'a> { | ||
text: &'a str, | ||
#[props(default = &Variant::Primary)] | ||
variant: &'a Variant, | ||
#[derive(PartialEq, Props, Clone)] | ||
pub struct ButtonProps { | ||
text: String, | ||
#[props(default = Variant::Primary)] | ||
variant: Variant, | ||
#[props(default = false)] | ||
disabled: bool, | ||
on_click: EventHandler<'a, MouseEvent>, | ||
on_click: EventHandler<MouseEvent>, | ||
#[props(!optional)] | ||
status: Option<String>, | ||
} | ||
|
||
pub fn Button<'a>(cx: Scope<'a, ButtonProps<'a>>) -> Element<'a> { | ||
let variant = match cx.props.variant { | ||
pub fn Button(props: ButtonProps) -> Element { | ||
let variant = match props.variant { | ||
Variant::Primary => "button--primary", | ||
Variant::Secondary => "button--secondary", | ||
Variant::Tertiary => "button--tertiary", | ||
}; | ||
|
||
let disabled = if cx.props.disabled { | ||
let disabled = if props.disabled { | ||
"button--disabled" | ||
} else { | ||
"" | ||
}; | ||
|
||
let loading = if cx.props.status.is_some() { | ||
let loading = if props.status.is_some() { | ||
"button--loading" | ||
} else { | ||
"" | ||
}; | ||
|
||
match &cx.props.status { | ||
match &props.status { | ||
Some(s) => { | ||
render!(rsx!( | ||
button { | ||
class: "button {variant} {loading}", | ||
disabled: true, | ||
"{s}" | ||
} | ||
)) | ||
rsx!( button { class: "button {variant} {loading}", disabled: true, "{s}" } ) | ||
} | ||
None => { | ||
render!(rsx!( | ||
rsx!( | ||
button { | ||
class: "button {variant} {disabled}", | ||
disabled: cx.props.disabled, | ||
onclick: move |event| cx.props.on_click.call(event), | ||
"{cx.props.text}" | ||
} | ||
)) | ||
class: "button {variant} {disabled}", | ||
disabled: props.disabled, | ||
onclick: move |event| props.on_click.call(event), | ||
"{props.text}" | ||
} | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,24 @@ | ||
use crate::components::atoms::{Close, Icon}; | ||
use dioxus::prelude::*; | ||
|
||
#[derive(Props)] | ||
pub struct CardProps<'a> { | ||
file: &'a str, | ||
on_click: EventHandler<'a, MouseEvent>, | ||
#[derive(PartialEq, Props, Clone)] | ||
pub struct CardProps { | ||
file: String, | ||
on_click: EventHandler<MouseEvent>, | ||
} | ||
|
||
pub fn Card<'a>(cx: Scope<'a, CardProps<'a>>) -> Element<'a> { | ||
cx.render(rsx!( | ||
section { | ||
class: "card", | ||
onclick: move |event| cx.props.on_click.call(event), | ||
div { | ||
class: "card-container", | ||
img { | ||
class: "card__media", | ||
src: "{cx.props.file}" | ||
} | ||
pub fn Card(props: CardProps) -> Element { | ||
rsx!( | ||
section { class: "card", onclick: move |event| props.on_click.call(event), | ||
div { class: "card-container", | ||
img { class: "card__media", src: "{props.file}" } | ||
|
||
button { | ||
class: "card__cta", | ||
onclick: move |event| {cx.props.on_click.call(event)}, | ||
Icon { | ||
stroke: "var(--text-1)", | ||
icon: Close | ||
} | ||
onclick: move |event| { props.on_click.call(event) }, | ||
Icon { stroke: "var(--text-1)", icon: Close } | ||
} | ||
} | ||
} | ||
)) | ||
) | ||
} |
Oops, something went wrong.