Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disabled states and getting started prompt #103

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions harbor-ui/assets/icons/arrow_left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions harbor-ui/assets/icons/clock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions harbor-ui/assets/icons/eye_closed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 16 additions & 2 deletions harbor-ui/src/components/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@ pub fn h_button(text_str: &str, icon: SvgIcon, loading: bool) -> Button<'_, Mess
Status::Pressed => darken(Color::BLACK, 0.1),
_ => theme.palette().background,
};

let text_color = match status {
Status::Disabled => gray,
_ => Color::WHITE,
};

button::Style {
background: Some(background.into()),
text_color: Color::WHITE,
text_color,
border,
shadow: Shadow::default(),
}
Expand All @@ -67,6 +73,8 @@ pub fn sidebar_button(

Button::new(content)
.style(move |theme, status| {
let gray = lighten(theme.palette().background, 0.5);

let border = Border {
color: Color::WHITE,
width: 0.,
Expand All @@ -85,9 +93,15 @@ pub fn sidebar_button(
(Status::Pressed, false) => darken(bg_color, 0.1),
_ => bg_color,
};

let text_color = match status {
Status::Disabled => gray,
_ => Color::WHITE,
};

button::Style {
background: Some(background.into()),
text_color: Color::WHITE,
text_color,
border,
shadow: Shadow::default(),
}
Expand Down
4 changes: 2 additions & 2 deletions harbor-ui/src/components/federation_item.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::Message;
use harbor_client::db_models::FederationItem;
use iced::{
widget::{column, row, text},
Alignment, Element,
};
use harbor_client::db_models::FederationItem;
use crate::Message;

use super::{bold_text, h_button, regular_text, subtitle, truncate_text};
use super::{format_amount, map_icon, SvgIcon};
Expand Down
6 changes: 6 additions & 0 deletions harbor-ui/src/components/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub enum SvgIcon {
Heart,
Home,
LeftRight,
ArrowLeft,
People,
Settings,
Squirrel,
Expand All @@ -21,6 +22,8 @@ pub enum SvgIcon {
Bolt,
Chain,
Eye,
EyeClosed,
Clock,
}

macro_rules! icon_handle {
Expand Down Expand Up @@ -51,6 +54,9 @@ pub fn map_icon<'a>(icon: SvgIcon, width: f32, height: f32) -> Svg<'a, Theme> {
SvgIcon::Bolt => icon_handle!("bolt.svg"),
SvgIcon::Chain => icon_handle!("chain.svg"),
SvgIcon::Eye => icon_handle!("eye.svg"),
SvgIcon::EyeClosed => icon_handle!("eye_closed.svg"),
SvgIcon::Clock => icon_handle!("clock.svg"),
SvgIcon::ArrowLeft => icon_handle!("arrow_left.svg"),
}
.width(width)
.height(height)
Expand Down
Loading