Merge branch 'experimental-floating-navbar'

This commit is contained in:
Chuck Dries 2021-07-17 12:51:55 -07:00
commit 33de9f4340

View File

@ -24,56 +24,63 @@ const getDifferentRand = (range, lastNs, iterations = 0) => {
return n; return n;
}; };
const NavLink = ({ href, children, isClient }) => ( const getButtonClasses = (isClient, colorMode = 'vibrant') =>
<a classnames(
className={classnames( "z-20 rounded-md text-md inline-block px-3 py-2 my-1 mr-2 text-md hover:underline",
"mx-3 ", isClient &&
isClient && "text-muted-light hover:text-vibrant-light" `text-muted-light bg-${colorMode}-dark blurred-or-opaque-bg-2`,
)} isClient && colorMode === 'muted' ? `hover:bg-muted` : ''
href={href} );
>
{children}
</a>
);
const Nav = ({ isClient, ar }) => ( const Nav = ({ ar, isClient }) => (
<nav <nav
className={classnames( className={classnames(
isClient && "text-vibrant-dark bg-vibrant-dark blurred-or-opaque-bg-2", ar > 1 || !isClient ? "landscape:w-screen" : "portrait:w-screen",
"px-6 p-2", "p-2 flex justify-center"
ar > 1 || !isClient ? "landscape:w-screen" : "portrait:w-screen"
)} )}
style={{ zIndex: 100 }} style={{ zIndex: 100 }}
> >
<ul className="flex flex-wrap justify-center"> {/* <ul className="text-vibrant-dark px-6 p-2 bg-vibrant-dark blurred-or-opaque-bg-2 inline-flex flex-wrap justify-center"> */}
<ul className="inline-flex flex-wrap">
<li> <li>
<NavLink href="/CharlesDriesResumeCurrent.pdf" isClient={isClient}> <a
className={getButtonClasses(isClient)}
href="/CharlesDriesResumeCurrent.pdf"
>
Resume Resume
</NavLink> </a>
</li> </li>
<li> <li>
{" "} <a
<NavLink href="https://github.com/chuckdries" isClient={isClient}> className={getButtonClasses(isClient)}
href="https://github.com/chuckdries"
>
Github Github
</NavLink> </a>
</li> </li>
<li> <li>
<NavLink <a
className={getButtonClasses(isClient)}
href="https://www.linkedin.com/in/chuckdries/" href="https://www.linkedin.com/in/chuckdries/"
isClient={isClient}
> >
LinkedIn LinkedIn
</NavLink> </a>
</li> </li>
<li> <li>
<NavLink href="https://devpost.com/chuckdries" isClient={isClient}> <a
className={getButtonClasses(isClient)}
href="https://devpost.com/chuckdries"
>
Devpost Devpost
</NavLink> </a>
</li> </li>
<li> <li>
<NavLink href="https://medium.com/@chuckdries" isClient={isClient}> <a
className={getButtonClasses(isClient)}
href="https://medium.com/@chuckdries"
>
Medium (blog) Medium (blog)
</NavLink> </a>
</li> </li>
</ul> </ul>
</nav> </nav>
@ -82,11 +89,7 @@ const Nav = ({ isClient, ar }) => (
const ImageButtons = ({ isClient, image, shuffleImage }) => ( const ImageButtons = ({ isClient, image, shuffleImage }) => (
<div className="flex mx-6 mb-6"> <div className="flex mx-6 mb-6">
<Link <Link
className={classnames( className={getButtonClasses(isClient, 'muted')}
"z-20 rounded-md text-md inline-block px-3 py-2 my-1 mr-2 text-md",
isClient &&
"text-muted-light bg-muted-dark hover:bg-muted blurred-or-opaque-bg-2"
)}
id="image-link" id="image-link"
title="view image details" title="view image details"
to={`/photogallery/${image.base}/`} to={`/photogallery/${image.base}/`}
@ -96,11 +99,7 @@ const ImageButtons = ({ isClient, image, shuffleImage }) => (
</span> </span>
</Link> </Link>
<button <button
className={classnames( className={getButtonClasses(isClient, 'muted')}
"z-20 rounded-md text-md inline-block px-3 py-2 my-1 mr-2 text-md",
isClient &&
"text-muted-light bg-muted-dark hover:bg-muted blurred-or-opaque-bg-2"
)}
id="shuffle-button" id="shuffle-button"
onClick={() => { onClick={() => {
shuffleImage(image); shuffleImage(image);
@ -113,11 +112,7 @@ const ImageButtons = ({ isClient, image, shuffleImage }) => (
</span> </span>
</button> </button>
<Link <Link
className={classnames( className={getButtonClasses(isClient, 'muted')}
"self-center z-20 hover:underline rounded-md px-4 py-2 text-md font-bold font-serif",
isClient &&
"text-muted-light bg-muted-dark hover:bg-muted blurred-or-opaque-bg-2"
)}
id="photogallery-link" id="photogallery-link"
to="/photogallery/" to="/photogallery/"
> >
@ -208,6 +203,7 @@ const IndexPage = ({
const vibrant = getVibrant(image); const vibrant = getVibrant(image);
const ar = getAspectRatio(image); const ar = getAspectRatio(image);
console.log("bg", image.base); console.log("bg", image.base);
return ( return (
<> <>
<Helmet> <Helmet>
@ -217,7 +213,6 @@ const IndexPage = ({
style={getVibrantToHelmetSafeBodyStyle(vibrant)} style={getVibrantToHelmetSafeBodyStyle(vibrant)}
/> />
</Helmet> </Helmet>
{/* WIP: ipad portrait hits md breakpoint, looks bad */}
<main <main
className={classnames( className={classnames(
"font-serif hero", "font-serif hero",
@ -256,7 +251,6 @@ const IndexPage = ({
style={{ gridArea: "1/1" }} style={{ gridArea: "1/1" }}
> >
<Nav ar={ar} isClient={isClient} /> <Nav ar={ar} isClient={isClient} />
<div className="flex flex-col items-center"> <div className="flex flex-col items-center">
<h1 <h1
className={classnames( className={classnames(