-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b4ad44
commit 59be817
Showing
13 changed files
with
185 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
import { DATA } from "@/data/info"; | ||
import { Dock } from "./ui/Dock"; | ||
import { Dock } from "./ui/dock"; | ||
import React from "react"; | ||
|
||
export default function Navbar() { | ||
return ( | ||
<div className="pointer-events-none fixed inset-x-0 top-5 z-30 mx-auto mb-4 flex origin-bottom h-full max-h-14"> | ||
<div className="fixed top-0 inset-x-0 h-16 w-full bg-background to-transparent backdrop-blur-lg [-webkit-mask-image:linear-gradient(to_top,transparent,transparent)] dark:bg-background"></div> | ||
<Dock | ||
navbar={DATA} | ||
className="cursor-pointer rounded-full z-50 pointer-events-auto relative mx-auto flex min-h-full h-full items-center bg-background [box-shadow:0_0_0_1px_rgba(0,0,0,.03),0_2px_4px_rgba(0,0,0,.05),0_12px_24px_rgba(0,0,0,.05)] transform-gpu dark:[border:1px_solid_rgba(255,255,255,.1)] dark:[box-shadow:0_-20px_80px_-20px_#ffffff1f_inset] " | ||
></Dock> | ||
</div> | ||
<Dock | ||
navbar={DATA} | ||
mobileClassName="rounded-full z-50 cursor-pointer md:flex items-center pointer-events-auto bg-background [box-shadow:0_0_0_1px_rgba(0,0,0,.03),0_-2px_4px_rgba(0,0,0,.05),0_-12px_24px_rgba(0,0,0,.05)] transform-gpu dark:[border:1px_solid_rgba(255,255,255,.1)] dark:[box-shadow:0_20px_80px_-20px_#ffffff1f_inset] " | ||
DesktopClassName="hidden cursor-pointer rounded-full z-50 mx-auto md:flex min-h-full h-full items-center bg-background [box-shadow:0_0_0_1px_rgba(0,0,0,.03),0_2px_4px_rgba(0,0,0,.05),0_12px_24px_rgba(0,0,0,.05)] transform-gpu dark:[border:1px_solid_rgba(255,255,255,.1)] dark:[box-shadow:0_-20px_80px_-20px_#ffffff1f_inset] " | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
"use client"; | ||
|
||
import { VariantProps, cva } from "class-variance-authority"; | ||
import React, { useState } from "react"; | ||
import { AnimatePresence, motion } from "framer-motion"; | ||
import { cn } from "@/lib/utils"; | ||
import { dataProps } from "@/data/info"; | ||
import Link from "next/link"; | ||
|
||
export interface DockProps { | ||
mobileClassName?: string; | ||
DesktopClassName?: string; | ||
navbar: dataProps; | ||
} | ||
|
||
const Dock: React.FC<DockProps> = ({ | ||
DesktopClassName, | ||
navbar, | ||
mobileClassName, | ||
}) => { | ||
return ( | ||
<> | ||
<DockMobile navbar={navbar} mobileClassName={mobileClassName} /> | ||
<DockDesktop navbar={navbar} DesktopClassName={DesktopClassName} /> | ||
</> | ||
); | ||
}; | ||
|
||
const DockMobile = React.forwardRef<HTMLDivElement, DockProps>( | ||
({ mobileClassName, navbar }) => { | ||
const [open, setOpen] = useState(false); | ||
return ( | ||
<div className="flex md:hidden pointer-events-none fixed bottom-3 right-5 z-30 mx-auto origin-bottom h-full max-h-14"> | ||
<AnimatePresence> | ||
{open && ( | ||
<motion.div className="absolute bottom-full mb-2 inset-x-0 flex flex-col gap-2 items-center"> | ||
{navbar.navbar.socials.map((social, idx) => ( | ||
<motion.div | ||
key={idx} | ||
initial={{ opacity: 0, y: 10 }} | ||
animate={{ opacity: 1, y: 0 }} | ||
exit={{ | ||
opacity: 0, | ||
y: 10, | ||
transition: { delay: idx * 0.06 }, | ||
}} | ||
transition={{ | ||
delay: (navbar.navbar.socials.length - 1 - idx) * 0.05, | ||
}} | ||
> | ||
<DockIcon | ||
key={idx} | ||
{...social} | ||
className="h-10 w-10 rounded-full bg-gray-50 dark:bg-neutral-900 flex items-center justify-center" | ||
/> | ||
</motion.div> | ||
))} | ||
</motion.div> | ||
)} | ||
</AnimatePresence> | ||
<div | ||
onClick={() => setOpen(!open)} | ||
className={cn( | ||
"flex gap-4 items-end rounded-2xl bg-gray-50 dark:bg-neutral-900 px-4", | ||
mobileClassName | ||
)} | ||
> | ||
<motion.span | ||
initial={{ rotate: 0 }} | ||
animate={open ? { rotate: 360 } : { rotate: 0 }} | ||
transition={{ duration: 0.5, ease: "easeInOut" }} | ||
> | ||
🎒 | ||
</motion.span> | ||
</div> | ||
</div> | ||
); | ||
} | ||
); | ||
|
||
const DockDesktop = React.forwardRef<HTMLDivElement, DockProps>( | ||
({ DesktopClassName, navbar }) => { | ||
const [isBlurred, setIsBlurred] = useState(false); | ||
const [isHovered, setIsHovered] = useState(false); | ||
|
||
const iconWidth = 40; | ||
const totalIcons = navbar.navbar.socials.length * iconWidth + 35; | ||
const handleMouseEnter = () => { | ||
setIsBlurred(true); | ||
setIsHovered(true); | ||
setTimeout(() => { | ||
setIsBlurred(false); | ||
}, 300); | ||
}; | ||
const handleMouseLeave = () => { | ||
setIsBlurred(true); | ||
setIsHovered(false); | ||
setTimeout(() => { | ||
setIsBlurred(false); | ||
}, 100); | ||
}; | ||
return ( | ||
<div className="pointer-events-auto` fixed inset-x-0 top-5 z-30 mx-auto mb-4 flex origin-bottom h-full max-h-14"> | ||
<AnimatePresence> | ||
<motion.div | ||
initial={{ scale: 1 }} | ||
whileHover={{ width: `${totalIcons}px` }} | ||
transition={{ | ||
type: "spring", | ||
stiffness: 90, | ||
damping: 10, | ||
}} | ||
onHoverStart={handleMouseEnter} | ||
onHoverEnd={handleMouseLeave} | ||
animate={{ scale: 1.1 }} | ||
className={cn( | ||
"flex gap-4 items-end rounded-2xl bg-gray-50 dark:bg-neutral-900 px-4", | ||
isBlurred && "blur-sm", | ||
DesktopClassName | ||
)} | ||
> | ||
<span className={cn(!isHovered ? "visible" : "hidden")}>🎒</span> | ||
{isHovered && ( | ||
<motion.div | ||
initial={{ opacity: 0 }} | ||
animate={{ opacity: 1 }} | ||
exit={{ opacity: 0 }} | ||
transition={{ | ||
type: "spring", | ||
stiffness: 90, | ||
damping: 10, | ||
delay: 0.2, | ||
}} | ||
className="flex gap-5 justify-center items-center" | ||
> | ||
{navbar.navbar.socials.map((social, idx) => ( | ||
<DockIcon key={idx} {...social} /> | ||
))} | ||
</motion.div> | ||
)} | ||
</motion.div> | ||
</AnimatePresence> | ||
</div> | ||
); | ||
} | ||
); | ||
|
||
type DockIconProps = { | ||
name: string; | ||
link: string; | ||
icon: React.ReactNode; | ||
className?: string; | ||
}; | ||
const DockIcon = React.forwardRef<HTMLDivElement, DockIconProps>( | ||
({ link, icon, className }) => { | ||
return ( | ||
<div className={cn(className)}> | ||
<Link href={link}>{icon}</Link> | ||
</div> | ||
); | ||
} | ||
); | ||
|
||
DockIcon.displayName = "DockIcon"; | ||
Dock.displayName = "Dock"; | ||
|
||
export { Dock }; |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters