Add current page logic to navbar, increase text size

This commit is contained in:
Xevion
2022-12-30 20:50:01 -06:00
parent 55fc7168b1
commit 7426450ce9
4 changed files with 15 additions and 14 deletions

View File

@@ -4,17 +4,18 @@ import {HiBars3, HiXMark} from "react-icons/hi2";
import {classNames} from "../utils/helpers"; import {classNames} from "../utils/helpers";
import Link from "next/link"; import Link from "next/link";
const navigation = [ const navigation: { id: string, name: string, href: string }[] = [
{name: 'Home', href: '/', current: true}, {id: 'home', name: 'Home', href: '/',},
{name: 'Projects', href: '/projects', current: false}, {id: 'projects', name: 'Projects', href: '/projects'},
{name: 'Contact', href: '/contact', current: false}, {id: 'contact', name: 'Contact', href: '/contact'},
] ]
type WrapperProps = { type WrapperProps = {
current?: string;
children?: ReactNode | ReactNode[] | null; children?: ReactNode | ReactNode[] | null;
}; };
const AppWrapper: FunctionComponent<WrapperProps> = ({children}: WrapperProps) => { const AppWrapper: FunctionComponent<WrapperProps> = ({current, children}: WrapperProps) => {
return <div className="min-h-screen bg-zinc-800 text-zinc-50"> return <div className="min-h-screen bg-zinc-800 text-zinc-50">
<Disclosure as="nav" className="bg-zinc-900"> <Disclosure as="nav" className="bg-zinc-900">
{({open}) => ( {({open}) => (
@@ -41,10 +42,10 @@ const AppWrapper: FunctionComponent<WrapperProps> = ({children}: WrapperProps) =
key={item.name} key={item.name}
href={item.href} href={item.href}
className={classNames( className={classNames(
item.current ? 'bg-zinc-900 text-white' : 'text-gray-300 hover:bg-zinc-700 hover:text-white', item.id == current ? 'bg-zinc-900 text-white' : 'text-gray-300 hover:bg-zinc-700 hover:text-white',
'px-3 py-2 rounded-md text-sm font-medium' 'px-3 py-2 rounded-md text-sm font-medium text-lg'
)} )}
aria-current={item.current ? 'page' : undefined} aria-current={item.id == current ? 'page' : undefined}
> >
{item.name} {item.name}
</Link> </Link>
@@ -63,10 +64,10 @@ const AppWrapper: FunctionComponent<WrapperProps> = ({children}: WrapperProps) =
as="a" as="a"
className={classNames( className={classNames(
item.current ? 'bg-zinc-900 text-white' : 'text-gray-300 hover:bg-zinc-700 hover:text-white', item.id == current ? 'bg-zinc-900 text-white' : 'text-gray-300 hover:bg-zinc-700 hover:text-white',
'block px-3 py-2 rounded-md text-base font-medium' 'block px-3 py-2 rounded-md text-base font-medium'
)} )}
aria-current={item.current ? 'page' : undefined} aria-current={item.id == current ? 'page' : undefined}
> >
{item.name} {item.name}
</Disclosure.Button> </Disclosure.Button>

View File

@@ -3,8 +3,8 @@ import AppWrapper from "../components/AppWrapper";
import WorkInProgress from "../components/WorkInProgress"; import WorkInProgress from "../components/WorkInProgress";
const ContactPage: NextPage = () => { const ContactPage: NextPage = () => {
return <AppWrapper> return <AppWrapper current='contact'>
<WorkInProgress /> <WorkInProgress/>
</AppWrapper> </AppWrapper>
} }

View File

@@ -59,7 +59,7 @@ const PhototagPage: NextPage = () => {
<li>Cutting Edge - the latest technology</li> <li>Cutting Edge - the latest technology</li>
</ul> </ul>
<h3>Screenshots</h3> <h3>Screenshots</h3>
<div className="relative space-y-3"> <div className="relative space-y-8">
{images.map(([src, description]) => { {images.map(([src, description]) => {
return <div key={src} className="flex flex-col justify-center w-full"> return <div key={src} className="flex flex-col justify-center w-full">
<Image fill sizes="100vw" src={src} alt="" <Image fill sizes="100vw" src={src} alt=""

View File

@@ -3,7 +3,7 @@ import AppWrapper from "../components/AppWrapper";
import WorkInProgress from "../components/WorkInProgress"; import WorkInProgress from "../components/WorkInProgress";
const ProjectsPage: NextPage = () => { const ProjectsPage: NextPage = () => {
return <AppWrapper> return <AppWrapper current='projects'>
<WorkInProgress/> <WorkInProgress/>
</AppWrapper>; </AppWrapper>;
} }