Added optional override for font-family on navigation buttons.
This commit is contained in:
parent
e593f46a35
commit
f603b6d7d3
2
public/styles/tailwind.min.css
vendored
2
public/styles/tailwind.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1,11 +1,14 @@
|
||||
use super::super::utils::{prop_structs::{ButtonProps, ContentChildren}, user_prefs::{UserPrefs, ThemedComponent}};
|
||||
use super::super::utils::{
|
||||
prop_structs::{ButtonProps, ContentChildren},
|
||||
user_prefs::{ThemedComponent, UserPrefs},
|
||||
};
|
||||
use dioxus::prelude::*;
|
||||
|
||||
#[cfg(target_family = "wasm")]
|
||||
use dioxus_router::Link;
|
||||
|
||||
pub fn BackToHomePage(cx: Scope<UserPrefs>) -> Element {
|
||||
let (user_theme, user_font)= cx.props.clone().get_pref_classes(ThemedComponent::Button);
|
||||
let (user_theme, user_font) = cx.props.clone().get_pref_classes(ThemedComponent::Button);
|
||||
#[cfg(any(target_family = "windows", target_family = "unix"))]
|
||||
return cx.render(rsx!{
|
||||
a { class: "flex justify-center p-4 text-xl text-center ring-2 hover:animate-yip transition {user_theme} {user_font}",
|
||||
@ -27,11 +30,21 @@ pub fn BackToHomePage(cx: Scope<UserPrefs>) -> Element {
|
||||
}
|
||||
|
||||
pub fn NavigationButton(cx: Scope<ButtonProps>) -> Element {
|
||||
let (user_theme, user_font)= cx.props.user_prefs.clone().get_pref_classes(ThemedComponent::Button);
|
||||
let (user_theme, mut user_font) = cx
|
||||
.props
|
||||
.user_prefs
|
||||
.clone()
|
||||
.get_pref_classes(ThemedComponent::Button);
|
||||
let title = cx.props.title.clone();
|
||||
let title_ref = title.as_str();
|
||||
let slug = cx.props.slug.clone();
|
||||
let slug_ref = slug.as_str();
|
||||
|
||||
match &cx.props.override_font {
|
||||
Some(font) => user_font = font.clone(),
|
||||
None => (),
|
||||
}
|
||||
|
||||
#[cfg(any(target_family = "windows", target_family = "unix"))]
|
||||
return cx.render(rsx!{
|
||||
a { class: "flex basis-full justify-center p-4 ml-2 mr-2 text-xl text-center ring-2 hover:animate-yip transition {user_theme} {user_font}",
|
||||
@ -56,4 +69,4 @@ pub fn ButtonGroup<'a>(cx: Scope<'a, ContentChildren<'a>>) -> Element {
|
||||
&cx.props.children
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
use crate::{
|
||||
components::void_buttons::{ButtonGroup, NavigationButton},
|
||||
utils::user_prefs::{ThemedComponent, UserPrefs},
|
||||
};
|
||||
use dioxus::prelude::*;
|
||||
use crate::{components::void_buttons::{ButtonGroup, NavigationButton}, utils::user_prefs::{UserPrefs, ThemedComponent}};
|
||||
|
||||
pub fn Footer(cx: Scope<UserPrefs>) -> Element {
|
||||
cx.render(rsx! {
|
||||
@ -15,9 +18,7 @@ fn MutantStandardFooter(cx: Scope<UserPrefs>) -> Element {
|
||||
div { class: "p-4 flex flex-col space-y-4 mx-auto max-w-full justify-center ring-4 {user_theme} {user_font}",
|
||||
ButtonGroup{
|
||||
NavigationButton { title: "⚙️ Settings".to_string(), slug: "/settings".to_string(), user_prefs: user_prefs.clone() }
|
||||
span { class: "font-nerd contents",
|
||||
NavigationButton { title: " /src".to_string(), slug: "https://gitea.werefox.cafe/ada/void-werefox-cafe".to_string(), user_prefs: user_prefs }
|
||||
}
|
||||
NavigationButton { title: " /src".to_string(), slug: "https://gitea.werefox.cafe/ada/void-werefox-cafe".to_string(), user_prefs: user_prefs, override_font: "font-nerd".to_string() }
|
||||
}
|
||||
div { class: "flex mx-auto max-w-full justify-center text-md text-center",
|
||||
"This site uses Mutant Standard emoji, which are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License"
|
||||
|
@ -159,12 +159,8 @@ pub mod void_app {
|
||||
"Font"
|
||||
}
|
||||
ButtonGroup {
|
||||
span { class: "font-nerd flex basis-full",
|
||||
NavigationButton { title: "Nerd Font".to_string(), slug: "/settings/?font=nerd".to_string(), user_prefs: user_prefs.clone() }
|
||||
}
|
||||
span { class: "font-open flex basis-full",
|
||||
NavigationButton { title: "Open Dyslexic".to_string(), slug: "/settings/?font=open".to_string(), user_prefs: user_prefs.clone() }
|
||||
}
|
||||
NavigationButton { title: "Nerd Font".to_string(), slug: "/settings/?font=nerd".to_string(), user_prefs: user_prefs.clone() override_font: "font-nerd".to_string() }
|
||||
NavigationButton { title: "Open Dyslexic".to_string(), slug: "/settings/?font=open".to_string(), user_prefs: user_prefs.clone() override_font: "font-open".to_string() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ pub struct ButtonProps {
|
||||
pub title: String,
|
||||
pub slug: String,
|
||||
pub user_prefs: UserPrefs,
|
||||
pub override_font: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Props)]
|
||||
|
Loading…
Reference in New Issue
Block a user