tweak user pills
This commit is contained in:
+21
-12
@@ -125,7 +125,7 @@ impl UserIcon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn UserPill(name: String, icon: UserIcon) -> Element {
|
pub fn UserPill(name: String, icon: UserIcon, isself: bool) -> Element {
|
||||||
let pill = css!(
|
let pill = css!(
|
||||||
"
|
"
|
||||||
border-radius: 100px;
|
border-radius: 100px;
|
||||||
@@ -139,16 +139,22 @@ pub fn UserPill(name: String, icon: UserIcon) -> Element {
|
|||||||
"
|
"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let pill_self = css!(
|
||||||
|
"
|
||||||
|
font-weight: bolder;
|
||||||
|
"
|
||||||
|
);
|
||||||
|
|
||||||
let color = match icon {
|
let color = match icon {
|
||||||
UserIcon::Normal => "var(--accent-a)",
|
UserIcon::Normal => "var(--accent-normal)",
|
||||||
UserIcon::Muted => "var(--accent-b)",
|
UserIcon::Muted => "var(--accent-muted)",
|
||||||
UserIcon::Deafened => "var(--accent-c)",
|
UserIcon::Deafened => "var(--accent-deafened)",
|
||||||
UserIcon::None => "var(--accent-a)",
|
UserIcon::None => "var(--accent-normal)",
|
||||||
};
|
};
|
||||||
|
|
||||||
rsx!(
|
rsx!(
|
||||||
div {
|
div {
|
||||||
class: "{pill}",
|
class: match isself { true => format!("{pill} {pill_self}"), false => format!("{pill}") },
|
||||||
style: "background-color: {color}",
|
style: "background-color: {color}",
|
||||||
{ icon.url().map(|url| rsx!(img { src: url })) }
|
{ icon.url().map(|url| rsx!(img { src: url })) }
|
||||||
"\u{00A0}{name}\u{00A0}"
|
"\u{00A0}{name}\u{00A0}"
|
||||||
@@ -163,10 +169,12 @@ pub fn User(id: UserId) -> Element {
|
|||||||
Some(state) => rsx!(UserPill {
|
Some(state) => rsx!(UserPill {
|
||||||
name: state.name.clone(),
|
name: state.name.clone(),
|
||||||
icon: state.icon(),
|
icon: state.icon(),
|
||||||
|
isself: server.session.unwrap() == id,
|
||||||
}),
|
}),
|
||||||
None => rsx!(UserPill {
|
None => rsx!(UserPill {
|
||||||
name: format!("unknown user ({id})"),
|
name: format!("unknown user ({id})"),
|
||||||
icon: UserIcon::None,
|
icon: UserIcon::None,
|
||||||
|
isself: false,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -292,6 +300,7 @@ pub fn ChatView() -> Element {
|
|||||||
UserPill {
|
UserPill {
|
||||||
name: sender.name.clone(),
|
name: sender.name.clone(),
|
||||||
icon: UserIcon::None,
|
icon: UserIcon::None,
|
||||||
|
isself: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
span {
|
span {
|
||||||
@@ -574,9 +583,9 @@ pub fn app() -> Element {
|
|||||||
--bg-color: #372f3a;
|
--bg-color: #372f3a;
|
||||||
--login-bg-color: #5d7680;
|
--login-bg-color: #5d7680;
|
||||||
--primary-btn-color: #7bad9f;
|
--primary-btn-color: #7bad9f;
|
||||||
--accent-a: #8eb29a;
|
--accent-normal: #7bad9f;
|
||||||
--accent-b: #6a9395;
|
--accent-muted: #ff746c;
|
||||||
--accent-c: #464459;
|
--accent-deafened: #464459;
|
||||||
--line-width: 2px;
|
--line-width: 2px;
|
||||||
--line-color: white;
|
--line-color: white;
|
||||||
}
|
}
|
||||||
@@ -617,16 +626,16 @@ pub fn app() -> Element {
|
|||||||
|
|
||||||
input:focus,input:focus-visible {
|
input:focus,input:focus-visible {
|
||||||
border: none;
|
border: none;
|
||||||
outline: solid var(--line-width) var(--accent-a);
|
outline: solid var(--line-width) var(--accent-normal);
|
||||||
outline-offset: -3px;
|
outline-offset: -3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:link {
|
a:link {
|
||||||
color: var(--accent-a);
|
color: var(--accent-normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
a:visited {
|
a:visited {
|
||||||
color: var(--accent-b);
|
color: var(--accent-muted);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user