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::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
#[cfg(target_family = "wasm")]
|
#[cfg(target_family = "wasm")]
|
||||||
use dioxus_router::Link;
|
use dioxus_router::Link;
|
||||||
|
|
||||||
pub fn BackToHomePage(cx: Scope<UserPrefs>) -> Element {
|
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"))]
|
#[cfg(any(target_family = "windows", target_family = "unix"))]
|
||||||
return cx.render(rsx!{
|
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}",
|
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 {
|
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 = cx.props.title.clone();
|
||||||
let title_ref = title.as_str();
|
let title_ref = title.as_str();
|
||||||
let slug = cx.props.slug.clone();
|
let slug = cx.props.slug.clone();
|
||||||
let slug_ref = slug.as_str();
|
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"))]
|
#[cfg(any(target_family = "windows", target_family = "unix"))]
|
||||||
return cx.render(rsx!{
|
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}",
|
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}",
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
|
use crate::{
|
||||||
|
components::void_buttons::{ButtonGroup, NavigationButton},
|
||||||
|
utils::user_prefs::{ThemedComponent, UserPrefs},
|
||||||
|
};
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use crate::{components::void_buttons::{ButtonGroup, NavigationButton}, utils::user_prefs::{UserPrefs, ThemedComponent}};
|
|
||||||
|
|
||||||
pub fn Footer(cx: Scope<UserPrefs>) -> Element {
|
pub fn Footer(cx: Scope<UserPrefs>) -> Element {
|
||||||
cx.render(rsx! {
|
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}",
|
div { class: "p-4 flex flex-col space-y-4 mx-auto max-w-full justify-center ring-4 {user_theme} {user_font}",
|
||||||
ButtonGroup{
|
ButtonGroup{
|
||||||
NavigationButton { title: "⚙️ Settings".to_string(), slug: "/settings".to_string(), user_prefs: user_prefs.clone() }
|
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, override_font: "font-nerd".to_string() }
|
||||||
NavigationButton { title: " /src".to_string(), slug: "https://gitea.werefox.cafe/ada/void-werefox-cafe".to_string(), user_prefs: user_prefs }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
div { class: "flex mx-auto max-w-full justify-center text-md text-center",
|
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"
|
"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"
|
"Font"
|
||||||
}
|
}
|
||||||
ButtonGroup {
|
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() override_font: "font-nerd".to_string() }
|
||||||
NavigationButton { title: "Nerd Font".to_string(), slug: "/settings/?font=nerd".to_string(), user_prefs: user_prefs.clone() }
|
NavigationButton { title: "Open Dyslexic".to_string(), slug: "/settings/?font=open".to_string(), user_prefs: user_prefs.clone() override_font: "font-open".to_string() }
|
||||||
}
|
|
||||||
span { class: "font-open flex basis-full",
|
|
||||||
NavigationButton { title: "Open Dyslexic".to_string(), slug: "/settings/?font=open".to_string(), user_prefs: user_prefs.clone() }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ pub struct ButtonProps {
|
|||||||
pub title: String,
|
pub title: String,
|
||||||
pub slug: String,
|
pub slug: String,
|
||||||
pub user_prefs: UserPrefs,
|
pub user_prefs: UserPrefs,
|
||||||
|
pub override_font: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Props)]
|
#[derive(PartialEq, Props)]
|
||||||
|
Loading…
Reference in New Issue
Block a user