diff --git a/src/components/CommandKClient.tsx b/src/components/CommandKClient.tsx index 7c566112..0f538e3d 100644 --- a/src/components/CommandKClient.tsx +++ b/src/components/CommandKClient.tsx @@ -70,6 +70,8 @@ export default function CommandKClient({ isUserSignedIn, setUserEmail, isCommandKOpen: isOpen, + matteSetting, + setMatteSetting, shouldShowBaselineGrid, shouldDebugBlur, setIsCommandKOpen: setIsOpen, @@ -197,6 +199,16 @@ export default function CommandKClient({ heading: 'Debug Tools', accessory: , items: [{ + label: 'Toggle Matte Setting', + action: () => setMatteSetting?.(prev => { + if (!prev) { + return 'light'; + } else if (prev === 'light') { + return 'dark'; + } + }), + annotation: Boolean(matteSetting) ? : undefined, + }, { label: 'Toggle Blur Debug', action: () => setShouldDebugBlur?.(prev => !prev), annotation: shouldDebugBlur ? : undefined, diff --git a/src/components/ImageBlurFallback.tsx b/src/components/ImageBlurFallback.tsx index acdd58fc..9007309c 100644 --- a/src/components/ImageBlurFallback.tsx +++ b/src/components/ImageBlurFallback.tsx @@ -8,13 +8,15 @@ import Image, { ImageProps } from 'next/image'; import { useCallback, useEffect, useRef, useState } from 'react'; export default function ImageBlurFallback(props: ImageProps & { - blurCompatibilityLevel?: 'none' | 'low' | 'high'; + blurCompatibilityLevel?: 'none' | 'low' | 'high' + imgClassName?: string }) { const { className, priority, blurDataURL, blurCompatibilityLevel = 'low', + imgClassName = 'object-cover h-full', ...rest } = props; @@ -29,8 +31,6 @@ export default function ImageBlurFallback(props: ImageProps & { const [hideBlurPlaceholder, setHideBlurPlaceholder] = useState(false); - const imageClassName = 'object-cover h-full'; - const imgRef = useRef(null); useEffect(() => { @@ -84,7 +84,7 @@ export default function ImageBlurFallback(props: ImageProps & { ...rest, src: blurDataURL, className: clsx( - imageClassName, + imgClassName, getBlurClass(), ), }} /> @@ -97,7 +97,7 @@ export default function ImageBlurFallback(props: ImageProps & { ...rest, ref: imgRef, priority, - className: imageClassName, + className: imgClassName, onLoad, onError, }} /> diff --git a/src/components/ImageLarge.tsx b/src/components/ImageLarge.tsx index 4740e7c5..cffdcb6c 100644 --- a/src/components/ImageLarge.tsx +++ b/src/components/ImageLarge.tsx @@ -3,6 +3,7 @@ import ImageBlurFallback from './ImageBlurFallback'; export default function ImageLarge({ className, + imgClassName, src, alt, aspectRatio, @@ -11,6 +12,7 @@ export default function ImageLarge({ priority, }: { className?: string + imgClassName?: string src: string alt: string aspectRatio: number @@ -21,6 +23,7 @@ export default function ImageLarge({ return ( = 1 ? 'max-h-[80%]' : 'max-h-[90%]' + )} alt={altTextForPhoto(photo)} src={photo.url} aspectRatio={photo.aspectRatio} diff --git a/src/site/globals.css b/src/site/globals.css index c4b8cf43..4ab0d2a9 100644 --- a/src/site/globals.css +++ b/src/site/globals.css @@ -162,6 +162,10 @@ @apply bg-gray-900 dark:bg-gray-100 } + .bg-dim { + @apply + bg-gray-200/40 dark:bg-gray-800/40 + } /* Utilities: Baseline Grid */ .space-y-baseline { @apply diff --git a/src/state/AppState.ts b/src/state/AppState.ts index 83f3ceb4..5e9c8f95 100644 --- a/src/state/AppState.ts +++ b/src/state/AppState.ts @@ -1,9 +1,13 @@ import { Dispatch, SetStateAction, createContext, useContext } from 'react'; import { AnimationConfig } from '@/components/AnimateItems'; +export type MatteSetting = 'light' | 'dark' | undefined; + export interface AppStateContext { previousPathname?: string hasLoaded?: boolean + matteSetting?: MatteSetting + setMatteSetting?: Dispatch> swrTimestamp?: number invalidateSwr?: () => void userEmail?: string diff --git a/src/state/AppStateProvider.tsx b/src/state/AppStateProvider.tsx index 3504c89d..69607565 100644 --- a/src/state/AppStateProvider.tsx +++ b/src/state/AppStateProvider.tsx @@ -1,7 +1,7 @@ 'use client'; import { useState, useEffect, ReactNode, useCallback } from 'react'; -import { AppStateContext } from './AppState'; +import { AppStateContext, MatteSetting } from './AppState'; import { AnimationConfig } from '@/components/AnimateItems'; import usePathnames from '@/utility/usePathnames'; import { getAuthAction } from '@/auth/actions'; @@ -16,6 +16,8 @@ export default function AppStateProvider({ const [hasLoaded, setHasLoaded] = useState(false); + const [matteSetting, setMatteSetting] = + useState(); const [swrTimestamp, setSwrTimestamp] = useState(Date.now()); const [userEmail, setUserEmail] = @@ -50,6 +52,8 @@ export default function AppStateProvider({ value={{ previousPathname, hasLoaded, + matteSetting, + setMatteSetting, swrTimestamp, invalidateSwr, setHasLoaded,