Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion components/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ function ThemeToggle() {
const next = !dark
setDark(next)
document.documentElement.classList.toggle('dark', next)
const v = next ? 'dark' : 'light'
try {
localStorage.setItem('theme', next ? 'dark' : 'light')
// shared across every *.hovanhoa.net subdomain
document.cookie = `theme=${v}; path=/; max-age=31536000; samesite=lax`
document.cookie = `theme=${v}; path=/; max-age=31536000; samesite=lax; domain=.hovanhoa.net`
} catch {}
}

Expand Down
2 changes: 1 addition & 1 deletion pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MyDocument extends Document {
<meta name="twitter:image" content="https://gallery.hovanhoa.net/avatar.png" />
<script
dangerouslySetInnerHTML={{
__html: `(function(){try{var t=localStorage.getItem('theme');var d=t?t==='dark':window.matchMedia('(prefers-color-scheme:dark)').matches;if(d)document.documentElement.classList.add('dark')}catch(e){}})()`,
__html: `(function(){try{var m=document.cookie.match(/(?:^|; )theme=(dark|light)/);if(m&&m[1]==='dark')document.documentElement.classList.add('dark')}catch(e){}})()`,
}}
/>
</Head>
Expand Down
4 changes: 2 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const Home: NextPage = ({ images }: { images: ImageProps[] }) => {
'radial-gradient(100% 140% at 0% 0%, var(--rd-accent-bg), transparent 55%), var(--rd-surface-2)',
}}
>
<div className="px-[var(--rd-pad)] pt-12 pb-12">
<div className="mx-auto max-w-[var(--rd-maxw)] px-[var(--rd-pad)] pt-12 pb-12">
<Eyebrow>hovanhoa · gallery</Eyebrow>
<h1 className="mt-[18px] text-[clamp(2rem,4.6vw,3.4rem)] font-semibold tracking-[-0.04em] text-[var(--rd-text)]">
photographs
Expand All @@ -94,7 +94,7 @@ const Home: NextPage = ({ images }: { images: ImageProps[] }) => {
onClose={closeModal}
/>
)}
<div className="mt-12 columns-1 gap-4 px-[var(--rd-pad)] sm:columns-2 lg:columns-3 xl:columns-4 2xl:columns-5">
<div className="mx-auto mt-12 max-w-[var(--rd-maxw)] columns-1 gap-4 px-[var(--rd-pad)] sm:columns-2 lg:columns-3 xl:columns-4">
{images.map(({id, public_id, format, blurDataUrl}) => (
<Link
key={id}
Expand Down
Loading