-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
26 changed files
with
533 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use client'; | ||
|
||
import Markdown from 'markdown-to-jsx'; | ||
|
||
export function MDXContent({ children }: { children: string }) { | ||
return ( | ||
<Markdown | ||
options={{ | ||
overrides: { | ||
h1: { | ||
component: 'h1', | ||
props: { className: 'text-black text-4xl font-bold my-6' }, | ||
}, | ||
h2: { | ||
component: 'h2', | ||
props: { className: 'text-black text-3xl font-bold my-6' }, | ||
}, | ||
h3: { | ||
component: 'h3', | ||
props: { className: 'text-black text-2xl font-bold my-6' }, | ||
}, | ||
p: { component: 'p', props: { className: 'mb-4 text-gray-600' } }, | ||
a: { | ||
component: 'a', | ||
props: { className: 'text-primary hover:underline text-black ' }, | ||
}, | ||
ul: { component: 'ul', props: { className: 'list-disc pl-6 my-6 text-gray-600' } }, | ||
ol: { | ||
component: 'ol', | ||
props: { className: 'text-gray-600 list-decimal pl-6 my-6' }, | ||
}, | ||
code: { | ||
component: 'code', | ||
props: { className: 'text-orange-400 px-1.5 py-0.5 rounded' }, | ||
}, | ||
pre: { | ||
component: 'pre', | ||
props: { | ||
className: 'bg-zinc-800 rounded-xl p-4 rounded-lg my-6 overflow-x-auto', | ||
}, | ||
}, | ||
}, | ||
}} | ||
> | ||
{children} | ||
</Markdown> | ||
); | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,94 @@ | ||
'use client'; | ||
import { WorkPost } from '@/util/posts/work'; | ||
import { ArrowLeft, Globe } from 'lucide-react'; | ||
import Link from 'next/link'; | ||
import React, { useEffect, useRef, useState } from 'react'; | ||
|
||
type Props = { | ||
work: WorkPost; | ||
}; | ||
|
||
export const Header: React.FC<Props> = ({ work }) => { | ||
const ref = useRef<HTMLElement>(null); | ||
const [isIntersecting, setIntersecting] = useState(true); | ||
|
||
const links: { label: string; href: string }[] = []; | ||
if (work.url) { | ||
links.push({ | ||
label: 'Web', | ||
href: work.url, | ||
}); | ||
} | ||
|
||
useEffect(() => { | ||
if (!ref.current) return; | ||
const observer = new IntersectionObserver(([entry]) => | ||
setIntersecting(entry.isIntersecting) | ||
); | ||
|
||
observer.observe(ref.current); | ||
return () => observer.disconnect(); | ||
}, []); | ||
|
||
return ( | ||
<header | ||
ref={ref} | ||
className="relative isolate overflow-hidden bg-gradient-to-tl from-black via-zinc-900 to-black" | ||
> | ||
<div | ||
className={`fixed inset-x-0 top-0 z-50 backdrop-blur lg:backdrop-blur-none duration-200 border-b lg:bg-transparent ${ | ||
isIntersecting | ||
? 'bg-zinc-900/0 border-transparent' | ||
: 'bg-white/10 border-zinc-200 lg:border-transparent' | ||
}`} | ||
> | ||
<div className="max-w-5xl container flex flex-row-reverse items-center justify-between p-6 mx-auto"> | ||
<div className="flex justify-between gap-8"> | ||
{work.url && ( | ||
<Link target="_blank" href={work.url}> | ||
<Globe | ||
className={`w-6 h-6 duration-200 hover:font-medium ${ | ||
isIntersecting | ||
? ' text-zinc-400 hover:text-zinc-100' | ||
: 'text-zinc-600 hover:text-zinc-900' | ||
} `} | ||
/> | ||
</Link> | ||
)} | ||
</div> | ||
|
||
<Link | ||
href="/works" | ||
className={`duration-200 hover:font-medium ${ | ||
isIntersecting | ||
? ' text-zinc-400 hover:text-zinc-100' | ||
: 'text-zinc-600 hover:text-zinc-900' | ||
} `} | ||
> | ||
<ArrowLeft className="w-6 h-6 " /> | ||
</Link> | ||
</div> | ||
</div> | ||
<div className="container mx-auto relative isolate overflow-hidden py-24 sm:py-32"> | ||
<div className="mx-auto max-w-5xl px-6 lg:px-8 text-center flex flex-col items-center"> | ||
<div className="mx-auto max-w-2xl lg:mx-0"> | ||
<h1 className="text-4xl font-bold tracking-tight text-white sm:text-6xl font-display"> | ||
{work.title} | ||
</h1> | ||
<p className="mt-6 text-lg leading-8 text-zinc-300">{work.brief}</p> | ||
</div> | ||
|
||
<div className="mx-auto mt-10 max-w-2xl lg:mx-0 lg:max-w-none"> | ||
<div className="grid grid-cols-1 gap-y-6 gap-x-8 text-base font-semibold leading-7 text-white sm:grid-cols-2 md:flex lg:gap-x-10"> | ||
{links.map(link => ( | ||
<Link target="_blank" key={link.label} href={link.href}> | ||
{link.label} <span aria-hidden="true">→</span> | ||
</Link> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</header> | ||
); | ||
}; |
Oops, something went wrong.