mirror of
https://github.com/librekeys/picoforge.git
synced 2026-07-28 08:01:19 -07:00
feat(ui): add font color customization to button component
This commit is contained in:
Generated
+15
-41
@@ -1114,19 +1114,6 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"core-foundation 0.10.0",
|
||||
"core-graphics-types 0.2.0",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics-helmer-fork"
|
||||
version = "0.24.0"
|
||||
@@ -1177,13 +1164,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "core-text"
|
||||
version = "21.1.0"
|
||||
version = "21.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fce32d657e17d6e4a8e70fe2ae6875218015f320620a78e5949d228bc76622bd"
|
||||
checksum = "a593227b66cbd4007b2a050dfdd9e1d1318311409c8d600dc82ba1b15ca9c130"
|
||||
dependencies = [
|
||||
"core-foundation 0.10.0",
|
||||
"core-graphics 0.25.0",
|
||||
"core-graphics 0.24.0",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2370,13 +2358,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gpui-component"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dda822a7bab4e0a08a4276ba68e2f82cc5855bf0b377d7b195c58c8061dc7d1"
|
||||
checksum = "d021d46b4088d3d93a57ccdf443da85695a77272108caca2f6fe5369f584966a"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"core-text",
|
||||
"enum-iterator",
|
||||
"gpui",
|
||||
"gpui-component-macros",
|
||||
@@ -2409,9 +2398,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gpui-component-macros"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "581a8cd1e38b2fd86d1029dd56a3296ffd1388fda295054104d89923755de902"
|
||||
checksum = "86fbc2d84bf91717b171320e6adc600d91ccb3ed259448f3b006787633c1c615"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -4295,7 +4284,6 @@ dependencies = [
|
||||
"serde_cbor_2",
|
||||
"serde_json",
|
||||
"thiserror 2.0.18",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6069,9 +6057,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.46"
|
||||
version = "0.3.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9da98b7d9b7dad93488a84b8248efc35352b0b2657397d4167e7ad67e5d535e5"
|
||||
checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c"
|
||||
dependencies = [
|
||||
"deranged",
|
||||
"itoa",
|
||||
@@ -6090,9 +6078,9 @@ checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca"
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.26"
|
||||
version = "0.2.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78cc610bac2dcee56805c99642447d4c5dbde4d01f752ffea0199aee1f601dc4"
|
||||
checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215"
|
||||
dependencies = [
|
||||
"num-conv",
|
||||
"time-core",
|
||||
@@ -6167,25 +6155,11 @@ dependencies = [
|
||||
"bytes",
|
||||
"libc",
|
||||
"mio",
|
||||
"parking_lot",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-rustls"
|
||||
version = "0.26.4"
|
||||
@@ -7574,9 +7548,9 @@ checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd"
|
||||
|
||||
[[package]]
|
||||
name = "x509-parser"
|
||||
version = "0.18.0"
|
||||
version = "0.18.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb3e137310115a65136898d2079f003ce33331a6c4b0d51f1531d1be082b6425"
|
||||
checksum = "d43b0f71ce057da06bc0851b23ee24f3f86190b07203dd8f567d0b706a185202"
|
||||
dependencies = [
|
||||
"asn1-rs",
|
||||
"data-encoding",
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ license = "AGPL-3.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
tokio = { version = "1.49", features = ["full"] }
|
||||
# tokio = { version = "1.49", features = ["full"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
log = "0.4" # Logging facade
|
||||
@@ -29,7 +29,7 @@ ring = "0.17" # For signing fido2 messages with pin token
|
||||
|
||||
# For Application UI:
|
||||
gpui = { version = "0.2.2", features = [] }
|
||||
gpui-component = "0.5.0"
|
||||
gpui-component = "0.5.1"
|
||||
rust-embed = "8.11.0"
|
||||
|
||||
[profile.dev]
|
||||
|
||||
@@ -24,6 +24,7 @@ pub struct PFButton {
|
||||
disabled: bool,
|
||||
small: bool,
|
||||
loading: bool,
|
||||
text_color: Option<Rgba>,
|
||||
}
|
||||
|
||||
impl PFButton {
|
||||
@@ -41,6 +42,7 @@ impl PFButton {
|
||||
disabled: false,
|
||||
small: false,
|
||||
loading: false,
|
||||
text_color: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +67,11 @@ impl PFButton {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_text_color(mut self, color: Rgba) -> Self {
|
||||
self.text_color = Some(color);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn section_header(mut self) -> Self {
|
||||
self.width_full = true;
|
||||
self.centered = false;
|
||||
@@ -133,6 +140,12 @@ impl RenderOnce for PFButton {
|
||||
h_flex().child(text)
|
||||
};
|
||||
|
||||
let content = if let Some(color) = self.text_color {
|
||||
content.text_color(color)
|
||||
} else {
|
||||
content
|
||||
};
|
||||
|
||||
if let Some(handler) = self.on_click {
|
||||
btn = btn.on_click(move |e, w, c| handler(e, w, c));
|
||||
}
|
||||
@@ -154,6 +167,7 @@ pub struct PFIconButton {
|
||||
small: bool,
|
||||
width_full: bool,
|
||||
loading: bool,
|
||||
text_color: Option<Rgba>,
|
||||
}
|
||||
|
||||
impl PFIconButton {
|
||||
@@ -169,6 +183,7 @@ impl PFIconButton {
|
||||
small: false,
|
||||
width_full: false,
|
||||
loading: false,
|
||||
text_color: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,6 +202,11 @@ impl PFIconButton {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_text_color(mut self, color: Rgba) -> Self {
|
||||
self.text_color = Some(color);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn disabled(mut self, disabled: bool) -> Self {
|
||||
self.disabled = disabled;
|
||||
self
|
||||
@@ -243,6 +263,13 @@ impl RenderOnce for PFIconButton {
|
||||
btn = btn.on_click(move |e, w, c| handler(e, w, c));
|
||||
}
|
||||
|
||||
btn.child(h_flex().gap_2().justify_center().child(icon).child(text))
|
||||
let content = h_flex().gap_2().justify_center().child(icon).child(text);
|
||||
let content = if let Some(color) = self.text_color {
|
||||
content.text_color(color)
|
||||
} else {
|
||||
content
|
||||
};
|
||||
|
||||
btn.child(content)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -722,13 +722,13 @@ impl PasskeysView {
|
||||
v_flex()
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.gap_4()
|
||||
.py_8()
|
||||
.gap_3()
|
||||
.py_3()
|
||||
.child(
|
||||
div().rounded_full().bg(theme.muted).p_4().child(
|
||||
Icon::default()
|
||||
.path("icons/shield.svg")
|
||||
.size_8()
|
||||
.size_12()
|
||||
.text_color(theme.muted_foreground),
|
||||
),
|
||||
)
|
||||
@@ -749,7 +749,9 @@ impl PasskeysView {
|
||||
Icon::default().path("icons/lock-open.svg"),
|
||||
"Unlock Storage",
|
||||
)
|
||||
.on_click(listener),
|
||||
.on_click(listener)
|
||||
.with_colors(rgb(0xe4e4e7), rgb(0xd0d0d3), rgb(0xe4e4e7))
|
||||
.with_text_color(rgb(0x18181b)),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user