mirror of
https://github.com/adoyle0/thaw.git
synced 2025-02-02 08:34:15 -05:00
feat: modified button and avatar properties
This commit is contained in:
parent
365a6686cd
commit
3fd3e1a7ac
2 changed files with 6 additions and 6 deletions
|
@ -7,7 +7,7 @@ pub use theme::AvatarTheme;
|
|||
#[component]
|
||||
pub fn Avatar(
|
||||
#[prop(optional, into)] src: MaybeSignal<String>,
|
||||
#[prop(optional, into)] circle: MaybeSignal<bool>,
|
||||
#[prop(optional, into)] round: MaybeSignal<bool>,
|
||||
#[prop(default = MaybeSignal::Static(30), into)] size: MaybeSignal<u16>,
|
||||
) -> impl IntoView {
|
||||
let theme = use_theme(Theme::light);
|
||||
|
@ -16,7 +16,7 @@ pub fn Avatar(
|
|||
css_vars.push_str(&format!("--thaw-size: {}px;", size.get()));
|
||||
css_vars.push_str(&format!(
|
||||
"--thaw-border-radius: {};",
|
||||
if circle.get() { "50%" } else { "3px" }
|
||||
if round.get() { "50%" } else { "3px" }
|
||||
));
|
||||
theme.with(|theme| {
|
||||
css_vars.push_str(&format!(
|
||||
|
|
|
@ -28,7 +28,7 @@ pub enum ButtonColor {
|
|||
}
|
||||
|
||||
impl ButtonColor {
|
||||
pub fn theme_color(&self, theme: &Theme) -> String {
|
||||
fn theme_color(&self, theme: &Theme) -> String {
|
||||
match self {
|
||||
ButtonColor::Primary => theme.common.color_primary.clone(),
|
||||
ButtonColor::Success => theme.common.color_success.clone(),
|
||||
|
@ -36,7 +36,7 @@ impl ButtonColor {
|
|||
ButtonColor::Error => theme.common.color_error.clone(),
|
||||
}
|
||||
}
|
||||
pub fn theme_color_hover(&self, theme: &Theme) -> String {
|
||||
fn theme_color_hover(&self, theme: &Theme) -> String {
|
||||
match self {
|
||||
ButtonColor::Primary => theme.common.color_primary_hover.clone(),
|
||||
ButtonColor::Success => theme.common.color_success_hover.clone(),
|
||||
|
@ -45,7 +45,7 @@ impl ButtonColor {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn theme_color_active(&self, theme: &Theme) -> String {
|
||||
fn theme_color_active(&self, theme: &Theme) -> String {
|
||||
match self {
|
||||
ButtonColor::Primary => theme.common.color_primary_active.clone(),
|
||||
ButtonColor::Success => theme.common.color_success_active.clone(),
|
||||
|
@ -65,7 +65,7 @@ pub fn Button(
|
|||
#[prop(optional, into)] loading: MaybeSignal<bool>,
|
||||
#[prop(optional, into)] disabled: MaybeSignal<bool>,
|
||||
#[prop(optional, into)] on_click: Option<Callback<ev::MouseEvent>>,
|
||||
#[prop(optional)] children: Option<ChildrenFn>,
|
||||
#[prop(optional)] children: Option<Children>,
|
||||
) -> impl IntoView {
|
||||
let theme = use_theme(Theme::light);
|
||||
let css_vars = create_memo(move |_| {
|
||||
|
|
Loading…
Add table
Reference in a new issue