Skip to content

Commit

Permalink
feat: Add support to customize text color inside progress bar component
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Oct 15, 2023
1 parent d7d6896 commit 7f1f98c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/components/src/progress_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub fn ProgressBar(cx: Scope<ProgressBarProps>) -> Element {
let theme = use_get_theme(cx);

let ProgressBarTheme {
color,
background,
progress_background,
} = theme.progress_bar;
Expand Down Expand Up @@ -79,7 +80,7 @@ pub fn ProgressBar(cx: Scope<ProgressBarProps>) -> Element {
label {
align: "center",
width: "100%",
color: "white",
color: "{color}",
max_lines: "1",
"{progress.floor()}%"
}
Expand Down
3 changes: 3 additions & 0 deletions crates/hooks/src/use_theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ pub struct LoaderTheme {
/// Theming properties for ProgressBar component.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ProgressBarTheme {
pub color: &'static str,
pub background: &'static str,
pub progress_background: &'static str,
}
Expand Down Expand Up @@ -207,6 +208,7 @@ pub const LIGHT_THEME: Theme = Theme {
secondary_color: "rgb(150, 150, 150)",
},
progress_bar: ProgressBarTheme {
color: "black",
background: "rgb(210, 210, 210)",
progress_background: "rgb(103, 80, 164)",
},
Expand Down Expand Up @@ -267,6 +269,7 @@ pub const DARK_THEME: Theme = Theme {
secondary_color: "rgb(255, 255, 255)",
},
progress_bar: ProgressBarTheme {
color: "white",
background: "rgb(60, 60, 60)",
progress_background: "rgb(255, 95, 0)",
},
Expand Down

0 comments on commit 7f1f98c

Please sign in to comment.