feat: replace in-footer scroll-to-top link with fixed floating button
This commit is contained in:
parent
0dbd07198b
commit
245fd83ec8
@ -66,8 +66,8 @@ pub fn Footer() -> Element {
|
||||
}
|
||||
});
|
||||
|
||||
let link_class = use_memo(move || {
|
||||
let base = "p-2 rounded-full cursor-pointer hover:opacity-80 transition-all duration-300 text-gray-600 dark:text-gray-300";
|
||||
let btn_class = use_memo(move || {
|
||||
let base = "fixed bottom-16 right-8 z-50 w-10 h-10 rounded-full bg-gray-100 dark:bg-[#2d2e30] shadow-md flex items-center justify-center cursor-pointer transition-all duration-300 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white";
|
||||
if visible() {
|
||||
format!("{} opacity-100 translate-y-0", base)
|
||||
} else {
|
||||
@ -79,8 +79,10 @@ pub fn Footer() -> Element {
|
||||
footer { class: "w-full border-t border-gray-200 dark:border-[#333] mt-auto",
|
||||
div { class: "max-w-3xl mx-auto px-6 py-5 flex items-center justify-between text-sm text-gray-400 dark:text-[#9b9c9d]",
|
||||
span { "© 2026 Yggdrasil Blog" }
|
||||
}
|
||||
}
|
||||
a {
|
||||
class: "{link_class}",
|
||||
class: "{btn_class}",
|
||||
href: "#top",
|
||||
aria_label: "go to top",
|
||||
title: "Go to Top (Alt + G)",
|
||||
@ -101,8 +103,6 @@ pub fn Footer() -> Element {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn scroll_to_top() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user