Skip to content

Commit b61ff31

Browse files
committed
rename get_theme to use_applied_theme
1 parent 7faf5bd commit b61ff31

22 files changed

+108
-107
lines changed

crates/components/src/accordion.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
use crate::theme::get_theme;
21
use dioxus::prelude::*;
32
use freya_elements::elements as dioxus_elements;
43
use freya_elements::events::MouseEvent;
4+
55
use freya_hooks::{
6-
use_animation, use_node, use_platform, AccordionTheme, AccordionThemeWith, Animation,
6+
use_animation, use_applied_theme, use_node, use_platform, AccordionTheme, AccordionThemeWith,
7+
Animation,
78
};
89
use winit::window::CursorIcon;
910

@@ -39,7 +40,7 @@ pub struct AccordionProps<'a> {
3940
///
4041
#[allow(non_snake_case)]
4142
pub fn Accordion<'a>(cx: Scope<'a, AccordionProps<'a>>) -> Element<'a> {
42-
let theme = get_theme!(cx, &cx.props.theme, accordion);
43+
let theme = use_applied_theme!(cx, &cx.props.theme, accordion);
4344
let animation = use_animation(cx, || 0.0);
4445
let open = use_state(cx, || false);
4546
let (node_ref, size) = use_node(cx);

crates/components/src/body.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use crate::theme::get_theme;
21
use dioxus::prelude::*;
32
use freya_elements::elements as dioxus_elements;
4-
use freya_hooks::{BodyTheme, BodyThemeWith};
3+
4+
use freya_hooks::{use_applied_theme, BodyTheme, BodyThemeWith};
55

66
/// [`Body`] component properties.
77
#[derive(Props)]
@@ -39,7 +39,7 @@ pub struct BodyProps<'a> {
3939
///
4040
#[allow(non_snake_case)]
4141
pub fn Body<'a>(cx: Scope<'a, BodyProps<'a>>) -> Element {
42-
let theme = get_theme!(cx, &cx.props.theme, body);
42+
let theme = use_applied_theme!(cx, &cx.props.theme, body);
4343
let BodyTheme {
4444
background,
4545
color,

crates/components/src/button.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use crate::theme::get_theme;
21
use dioxus::prelude::*;
32
use freya_elements::elements as dioxus_elements;
43
use freya_elements::events::MouseEvent;
5-
use freya_hooks::{use_focus, use_platform, ButtonTheme, ButtonThemeWith};
4+
5+
use freya_hooks::{use_applied_theme, use_focus, use_platform, ButtonTheme, ButtonThemeWith};
66
use winit::window::CursorIcon;
77

88
/// [`Button`] component properties.
@@ -69,7 +69,7 @@ pub fn Button<'a>(cx: Scope<'a, ButtonProps<'a>>) -> Element {
6969
width,
7070
height,
7171
font_theme,
72-
} = get_theme!(cx, &cx.props.theme, button);
72+
} = use_applied_theme!(cx, &cx.props.theme, button);
7373

7474
let onclick = move |ev| {
7575
focus.focus();

crates/components/src/canvas.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use crate::theme::get_theme;
21
use dioxus::prelude::{render, Element, Props, Scope};
32
use freya_elements::elements as dioxus_elements;
4-
use freya_hooks::{CanvasTheme, CanvasThemeWith, UseCanvas};
3+
4+
use freya_hooks::{use_applied_theme, CanvasTheme, CanvasThemeWith, UseCanvas};
55

66
/// [`Canvas`] component properties.
77
#[derive(Props, PartialEq)]
@@ -23,7 +23,7 @@ pub fn Canvas(cx: Scope<CanvasProps>) -> Element {
2323
width,
2424
height,
2525
background,
26-
} = get_theme!(cx, &cx.props.theme, canvas);
26+
} = use_applied_theme!(cx, &cx.props.theme, canvas);
2727

2828
render!(rect {
2929
overflow: "clip",

crates/components/src/dropdown.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use std::fmt::Display;
22

33
use crate::icons::ArrowIcon;
4-
use crate::theme::get_theme;
54
use dioxus::prelude::*;
65
use freya_elements::elements as dioxus_elements;
76
use freya_elements::events::keyboard::Key;
87
use freya_elements::events::{KeyboardEvent, MouseEvent};
8+
99
use freya_hooks::{
10-
theme_with, use_focus, use_platform, ArrowIconThemeWith, DropdownItemThemeWith, DropdownTheme,
11-
DropdownThemeWith,
10+
theme_with, use_applied_theme, use_focus, use_platform, ArrowIconThemeWith,
11+
DropdownItemThemeWith, DropdownTheme, DropdownThemeWith,
1212
};
1313
use winit::window::CursorIcon;
1414

@@ -49,7 +49,7 @@ where
4949
T: PartialEq + 'static,
5050
{
5151
let selected = use_shared_state::<T>(cx).unwrap();
52-
let theme = get_theme!(cx, &cx.props.theme, dropdown_item);
52+
let theme = use_applied_theme!(cx, &cx.props.theme, dropdown_item);
5353
let focus = use_focus(cx);
5454
let status = use_state(cx, DropdownItemStatus::default);
5555
let platform = use_platform(cx);
@@ -180,7 +180,7 @@ where
180180
{
181181
use_shared_state_provider(cx, || cx.props.value.clone());
182182
let selected = use_shared_state::<T>(cx).unwrap();
183-
let theme = get_theme!(cx, &cx.props.theme, dropdown);
183+
let theme = use_applied_theme!(cx, &cx.props.theme, dropdown);
184184
let focus = use_focus(cx);
185185
let status = use_state(cx, DropdownStatus::default);
186186
let opened = use_state(cx, || false);

crates/components/src/external_link.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use crate::theme::get_theme;
21
use dioxus::prelude::*;
32
use freya_elements::elements as dioxus_elements;
43
use freya_elements::events::MouseEvent;
5-
use freya_hooks::ExternalLinkThemeWith;
4+
5+
use freya_hooks::{use_applied_theme, ExternalLinkThemeWith};
66

77
use crate::Tooltip;
88

@@ -50,7 +50,7 @@ pub struct ExternalLinkProps<'a> {
5050
///
5151
#[allow(non_snake_case)]
5252
pub fn ExternalLink<'a>(cx: Scope<'a, ExternalLinkProps<'a>>) -> Element {
53-
let theme = get_theme!(cx, &cx.props.theme, external_link);
53+
let theme = use_applied_theme!(cx, &cx.props.theme, external_link);
5454
let is_hovering = use_state(cx, || false);
5555
let show_tooltip = cx.props.show_tooltip.unwrap_or(true);
5656

crates/components/src/graph.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use crate::theme::get_theme;
21
use dioxus::prelude::*;
32
use freya_common::EventMessage;
43
use freya_elements::elements as dioxus_elements;
54
use freya_engine::prelude::*;
6-
use freya_hooks::{use_canvas, use_platform, GraphTheme, GraphThemeWith};
5+
6+
use freya_hooks::{use_applied_theme, use_canvas, use_platform, GraphTheme, GraphThemeWith};
77
use freya_node_state::Parse;
88

99
/// Data line for the [`Graph`] component.
@@ -152,7 +152,7 @@ pub fn Graph(cx: Scope<GraphProps>) -> Element {
152152
})
153153
});
154154

155-
let GraphTheme { width, height } = get_theme!(cx, &cx.props.theme, graph);
155+
let GraphTheme { width, height } = use_applied_theme!(cx, &cx.props.theme, graph);
156156

157157
render!(
158158
rect {

crates/components/src/icons/arrow.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use crate::theme::get_theme;
21
use dioxus::prelude::*;
32
use freya_elements::elements as dioxus_elements;
4-
use freya_hooks::{ArrowIconTheme, ArrowIconThemeWith};
3+
4+
use freya_hooks::{use_applied_theme, ArrowIconTheme, ArrowIconThemeWith};
55

66
#[derive(Props, PartialEq)]
77
pub struct ArrowIcon {
@@ -25,7 +25,7 @@ pub fn ArrowIcon(cx: Scope<ArrowIcon>) -> Element {
2525
height,
2626
width,
2727
margin,
28-
} = get_theme!(cx, theme, arrow_icon);
28+
} = use_applied_theme!(cx, theme, arrow_icon);
2929

3030
render!(svg {
3131
height: "{height}",

crates/components/src/input.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ use freya_elements::events::keyboard::Key;
44
use freya_elements::events::{KeyboardData, MouseEvent};
55
use freya_hooks::use_platform;
66
use freya_hooks::{
7-
use_editable, use_focus, EditableConfig, EditableEvent, EditableMode, TextEditor,
7+
use_applied_theme, use_editable, use_focus, EditableConfig, EditableEvent, EditableMode,
8+
FontTheme, InputTheme, InputThemeWith, TextEditor,
89
};
9-
use freya_hooks::{FontTheme, InputTheme, InputThemeWith};
1010

11-
use crate::theme::get_theme;
1211
use winit::window::CursorIcon;
1312

1413
/// Enum to declare is [`Input`] hidden.
@@ -90,7 +89,7 @@ pub fn Input<'a>(cx: Scope<'a, InputProps<'a>>) -> Element {
9089
|| EditableConfig::new(cx.props.value.to_string()),
9190
EditableMode::MultipleLinesSingleEditor,
9291
);
93-
let theme = get_theme!(cx, &cx.props.theme, input);
92+
let theme = use_applied_theme!(cx, &cx.props.theme, input);
9493
let focus_manager = use_focus(cx);
9594

9695
if &cx.props.value != editable.editor().current().rope() {

crates/components/src/loader.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::time::Duration;
22

3-
use crate::theme::get_theme;
43
use dioxus::prelude::*;
54
use freya_elements::elements as dioxus_elements;
6-
use freya_hooks::{LoaderTheme, LoaderThemeWith};
5+
6+
use freya_hooks::{use_applied_theme, LoaderTheme, LoaderThemeWith};
77
use tokio::time::interval;
88

99
/// [`Loader`] component properties.
@@ -23,7 +23,7 @@ pub struct LoaderProps {
2323
///
2424
#[allow(non_snake_case)]
2525
pub fn Loader(cx: Scope<LoaderProps>) -> Element {
26-
let theme = get_theme!(cx, &cx.props.theme, loader);
26+
let theme = use_applied_theme!(cx, &cx.props.theme, loader);
2727
let degrees = use_state(cx, || 0);
2828

2929
let LoaderTheme {

0 commit comments

Comments
 (0)