Macro freya::hooks::use_applied_theme  
source · macro_rules! use_applied_theme { ($cx:expr, $theme_prop:expr, $theme_name:ident) => { ... }; }
Expand description
This macro has three arguments separator by commas.
- The context (cx: Scope). Just pass incx.
- The theme property. This should be &cx.props.theme.
- The name of the theme that you want to use.
Examples
ⓘ
use freya_hooks::{ButtonTheme, ButtonThemeWith};
#[derive(Props)]
pub struct ButtonProps {
    /// Theme override.
    #[props(optional)]
    pub theme: Option<ButtonThemeWith>,
    // ...
}
pub fn Button(cx: Scope<ButtonProps>) -> Element {
    let ButtonTheme {
        padding,
        width,
        background,
        ..
    } = use_applied_theme!(cx, &cx.props.theme, button);
    // ...
}