mirror of
https://github.com/liyunze-coding/RythonDev.git
synced 2026-09-22 15:53:57 +00:00
added accessibility and improved font performance
This commit is contained in:
parent
296bbbf45a
commit
1d4061a935
3 changed files with 68 additions and 53 deletions
|
|
@ -55,12 +55,12 @@ const leftProject = position == "left";
|
||||||
class:list={leftProject
|
class:list={leftProject
|
||||||
? "left"
|
? "left"
|
||||||
: "right"}
|
: "right"}
|
||||||
width="700"
|
width={700}
|
||||||
/>
|
/>
|
||||||
<Image
|
<Image
|
||||||
src={image}
|
src={image}
|
||||||
alt={alt}
|
alt={alt}
|
||||||
width="700"
|
width={700}
|
||||||
class={`absolute max-w-full
|
class={`absolute max-w-full
|
||||||
aspect-video
|
aspect-video
|
||||||
opacity-100
|
opacity-100
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,12 @@ export const HoverNavigation = ({
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</div>
|
</div>
|
||||||
<motion.div
|
<nav
|
||||||
|
aria-label="Desktop Navigation"
|
||||||
|
className="flex items-center justify-center overflow-hidden"
|
||||||
|
>
|
||||||
|
<motion.ul
|
||||||
|
className="hidden w-0 flex-row items-center justify-center overflow-hidden lg:flex lg:w-auto"
|
||||||
animate={{
|
animate={{
|
||||||
width: navVisible ? "auto" : "0px",
|
width: navVisible ? "auto" : "0px",
|
||||||
opacity: navVisible ? "100%" : "0%",
|
opacity: navVisible ? "100%" : "0%",
|
||||||
|
|
@ -140,18 +145,18 @@ export const HoverNavigation = ({
|
||||||
transition={{
|
transition={{
|
||||||
ease: "easeInOut",
|
ease: "easeInOut",
|
||||||
}}
|
}}
|
||||||
className={cn(
|
|
||||||
"hidden w-0 flex-row items-center justify-center overflow-hidden lg:flex lg:w-auto",
|
|
||||||
className,
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{items.map((item, idx) => (
|
{items.map((item, idx) => (
|
||||||
|
<li key={item?.link}>
|
||||||
<a
|
<a
|
||||||
href={item?.link}
|
href={item?.link}
|
||||||
key={item?.link}
|
|
||||||
className="group relative block h-fit px-5 py-2"
|
className="group relative block h-fit px-5 py-2"
|
||||||
onMouseEnter={() => setHoveredIndex(idx)}
|
onMouseEnter={() =>
|
||||||
onMouseLeave={() => setHoveredIndex(null)}
|
setHoveredIndex(idx)
|
||||||
|
}
|
||||||
|
onMouseLeave={() =>
|
||||||
|
setHoveredIndex(null)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
{hoveredIndex === idx && (
|
{hoveredIndex === idx && (
|
||||||
|
|
@ -161,7 +166,9 @@ export const HoverNavigation = ({
|
||||||
initial={{ opacity: 0 }}
|
initial={{ opacity: 0 }}
|
||||||
animate={{
|
animate={{
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
transition: { duration: 0.15 },
|
transition: {
|
||||||
|
duration: 0.15,
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
exit={{
|
exit={{
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
|
|
@ -175,11 +182,14 @@ export const HoverNavigation = ({
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
<NavBarLink>{item.label}</NavBarLink>
|
<NavBarLink>{item.label}</NavBarLink>
|
||||||
</a>
|
</a>
|
||||||
|
</li>
|
||||||
))}
|
))}
|
||||||
</motion.div>
|
</motion.ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
<div className="hamburger-wrapper flex items-center justify-center lg:hidden">
|
<div className="hamburger-wrapper flex items-center justify-center lg:hidden">
|
||||||
<HamburgerCross
|
<HamburgerCross
|
||||||
|
aria-label="Hamburger"
|
||||||
toggled={hamburgerOpen}
|
toggled={hamburgerOpen}
|
||||||
toggle={setHamburgerOpen}
|
toggle={setHamburgerOpen}
|
||||||
size={20}
|
size={20}
|
||||||
|
|
@ -200,13 +210,14 @@ export const HoverNavigation = ({
|
||||||
className="h-0 overflow-hidden"
|
className="h-0 overflow-hidden"
|
||||||
>
|
>
|
||||||
{items.map((item, idx) => (
|
{items.map((item, idx) => (
|
||||||
|
<li key={item?.link}>
|
||||||
<a
|
<a
|
||||||
href={item?.link}
|
href={item?.link}
|
||||||
key={item?.link}
|
|
||||||
className="group relative block px-5 py-2 text-center lg:hidden"
|
className="group relative block px-5 py-2 text-center lg:hidden"
|
||||||
>
|
>
|
||||||
{item.label}
|
{item.label}
|
||||||
</a>
|
</a>
|
||||||
|
</li>
|
||||||
))}
|
))}
|
||||||
</motion.ul>
|
</motion.ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ import { ClientRouter } from "astro:transitions";
|
||||||
src: url("/fonts/Fredoka-Regular.ttf") format("truetype");
|
src: url("/fonts/Fredoka-Regular.ttf") format("truetype");
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
|
|
@ -55,6 +56,7 @@ import { ClientRouter } from "astro:transitions";
|
||||||
src: url("/fonts/Antonio-Bold.ttf") format("truetype");
|
src: url("/fonts/Antonio-Bold.ttf") format("truetype");
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Montserrat Fonts */
|
/* Montserrat Fonts */
|
||||||
|
|
@ -63,6 +65,7 @@ import { ClientRouter } from "astro:transitions";
|
||||||
src: url("/fonts/Montserrat-Bold.ttf") format("truetype");
|
src: url("/fonts/Montserrat-Bold.ttf") format("truetype");
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
|
|
@ -70,6 +73,7 @@ import { ClientRouter } from "astro:transitions";
|
||||||
src: url("/fonts/Montserrat-Regular.ttf") format("truetype");
|
src: url("/fonts/Montserrat-Regular.ttf") format("truetype");
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue