Skip to content

Commit

Permalink
chore: Remove Canvas component, and move some theme options of comp…
Browse files Browse the repository at this point in the history
…onents back to their props
  • Loading branch information
marc2332 committed Jan 30, 2025
1 parent b3d4701 commit ef4da11
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 60 deletions.
35 changes: 0 additions & 35 deletions crates/components/src/canvas.rs

This file was deleted.

2 changes: 0 additions & 2 deletions crates/components/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ mod animated_position;
mod animated_router;
mod body;
mod button;
mod canvas;
mod checkbox;
mod cursor_area;
mod drag_drop;
Expand Down Expand Up @@ -49,7 +48,6 @@ pub use animated_position::*;
pub use animated_router::*;
pub use body::*;
pub use button::*;
pub use canvas::*;
pub use checkbox::*;
pub use cursor_area::*;
pub use drag_drop::*;
Expand Down
5 changes: 4 additions & 1 deletion crates/components/src/progress_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ use freya_hooks::{
/// Properties for the [`ProgressBar`] component.
#[derive(Props, Clone, PartialEq)]
pub struct ProgressBarProps {
/// Width of the progress bar. Default to `fill`.
#[props(default = "fill".into())]
pub width: String,
/// Theme override.
pub theme: Option<ProgressBarThemeWith>,
/// Show a label with the current progress. Default to false.
Expand All @@ -34,6 +37,7 @@ pub struct ProgressBarProps {
#[allow(non_snake_case)]
pub fn ProgressBar(
ProgressBarProps {
width,
theme,
show_progress,
progress,
Expand All @@ -43,7 +47,6 @@ pub fn ProgressBar(
color,
background,
progress_background,
width,
height,
} = use_applied_theme!(&theme, progress_bar);

Expand Down
5 changes: 4 additions & 1 deletion crates/components/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ pub fn TableCell(props: TableCellProps) -> Element {
/// Properties for the [`Table`] component.
#[derive(Props, Clone, PartialEq)]
pub struct TableProps {
/// Width of the table. Default to `fill`.
#[props(default = "fill".into())]
pub height: String,
/// Theme override.
pub theme: Option<TableThemeWith>,
/// Number of columns used in the table.
Expand All @@ -203,14 +206,14 @@ pub struct TableProps {
#[allow(non_snake_case)]
pub fn Table(
TableProps {
height,
theme,
columns,
children,
}: TableProps,
) -> Element {
let TableTheme {
background,
height,
corner_radius,
shadow,
font_theme: FontTheme { color },
Expand Down
5 changes: 4 additions & 1 deletion crates/elements/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ pub mod elements;
pub mod events;
mod macros;

pub use crate::elements::*;
pub use crate::{
elements::*,
events::*,
};
7 changes: 0 additions & 7 deletions crates/hooks/src/theming/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ pub(crate) const BASE_THEME: Theme = Theme {
color: cow_borrowed!("white"),
background: cow_borrowed!("key(surface)"),
progress_background: cow_borrowed!("key(primary)"),
width: cow_borrowed!("fill"),
height: cow_borrowed!("20"),
},
table: TableTheme {
Expand All @@ -166,15 +165,9 @@ pub(crate) const BASE_THEME: Theme = Theme {
row_background: cow_borrowed!("transparent"),
alternate_row_background: cow_borrowed!("key(neutral_surface)"),
divider_fill: cow_borrowed!("key(secondary_surface)"),
height: cow_borrowed!("auto"),
corner_radius: cow_borrowed!("6"),
shadow: cow_borrowed!("0 2 15 5 rgb(35, 35, 35, 70)"),
},
canvas: CanvasTheme {
width: cow_borrowed!("300"),
height: cow_borrowed!("150"),
background: cow_borrowed!("white"),
},
graph: GraphTheme {
width: cow_borrowed!("100%"),
height: cow_borrowed!("100%"),
Expand Down
13 changes: 0 additions & 13 deletions crates/hooks/src/theming/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ define_theme! {
color: str,
background: str,
progress_background: str,
width: str,
height: str,
}
}
Expand All @@ -363,24 +362,13 @@ define_theme! {
alternate_row_background: str,
row_background: str,
divider_fill: str,
height: str,
corner_radius: str,
shadow: str,
%[subthemes]
font_theme: FontTheme,
}
}

define_theme! {
%[component]
pub Canvas {
%[cows]
width: str,
height: str,
background: str,
}
}

define_theme! {
%[component]
pub Graph {
Expand Down Expand Up @@ -604,7 +592,6 @@ pub struct Theme {
pub progress_bar: ProgressBarTheme,
pub table: TableTheme,
pub input: InputTheme,
pub canvas: CanvasTheme,
pub graph: GraphTheme,
pub icon: IconTheme,
pub sidebar: SidebarTheme,
Expand Down

0 comments on commit ef4da11

Please sign in to comment.