Change modal backgrounds for light mode
This commit is contained in:
parent
0cef385623
commit
20eaf39e4d
@ -8,8 +8,8 @@ import { useRouter } from 'next/navigation';
|
|||||||
import AnimateItems from './AnimateItems';
|
import AnimateItems from './AnimateItems';
|
||||||
import { PATH_ROOT } from '@/app/paths';
|
import { PATH_ROOT } from '@/app/paths';
|
||||||
import usePrefersReducedMotion from '@/utility/usePrefersReducedMotion';
|
import usePrefersReducedMotion from '@/utility/usePrefersReducedMotion';
|
||||||
import useMetaThemeColor from '@/utility/useMetaThemeColor';
|
|
||||||
import useEscapeHandler from '@/utility/useEscapeHandler';
|
import useEscapeHandler from '@/utility/useEscapeHandler';
|
||||||
|
import { useTheme } from 'next-themes';
|
||||||
|
|
||||||
export default function Modal({
|
export default function Modal({
|
||||||
onClosePath,
|
onClosePath,
|
||||||
@ -45,7 +45,7 @@ export default function Modal({
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useMetaThemeColor({ colorLight: '#333' });
|
const { resolvedTheme } = useTheme();
|
||||||
|
|
||||||
useClickInsideOutside({
|
useClickInsideOutside({
|
||||||
htmlElements,
|
htmlElements,
|
||||||
@ -70,12 +70,16 @@ export default function Modal({
|
|||||||
anchor === 'top'
|
anchor === 'top'
|
||||||
? 'items-start pt-4 sm:pt-24'
|
? 'items-start pt-4 sm:pt-24'
|
||||||
: 'items-center',
|
: 'items-center',
|
||||||
'bg-black',
|
'bg-white dark:bg-black',
|
||||||
)}
|
)}
|
||||||
initial={!prefersReducedMotion
|
initial={!prefersReducedMotion
|
||||||
? { backgroundColor: 'rgba(0, 0, 0, 0)' }
|
? { backgroundColor: resolvedTheme === 'dark'
|
||||||
|
? 'rgba(0, 0, 0, 0)'
|
||||||
|
: 'rgba(255, 255, 255, 0)' }
|
||||||
: false}
|
: false}
|
||||||
animate={{ backgroundColor: 'rgba(0, 0, 0, 0.80)' }}
|
animate={{ backgroundColor: resolvedTheme === 'dark'
|
||||||
|
? 'rgba(0, 0, 0, 0.80)'
|
||||||
|
: 'rgba(255, 255, 255, 0.80)' }}
|
||||||
transition={{ duration: 0.3, easing: 'easeOut' }}
|
transition={{ duration: 0.3, easing: 'easeOut' }}
|
||||||
>
|
>
|
||||||
<AnimateItems
|
<AnimateItems
|
||||||
@ -87,8 +91,9 @@ export default function Modal({
|
|||||||
container && 'w-[calc(100vw-1.5rem)] sm:w-[min(540px,90vw)]',
|
container && 'w-[calc(100vw-1.5rem)] sm:w-[min(540px,90vw)]',
|
||||||
container && !noPadding && 'p-3 md:p-4',
|
container && !noPadding && 'p-3 md:p-4',
|
||||||
container && 'rounded-lg md:rounded-xl',
|
container && 'rounded-lg md:rounded-xl',
|
||||||
container && 'dark:border dark:border-gray-800',
|
container && 'border-medium',
|
||||||
'bg-white dark:bg-black',
|
'bg-white dark:bg-black',
|
||||||
|
'shadow-2xl/20 dark:shadow-2xl/100',
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -5,10 +5,10 @@ import { useTheme } from 'next-themes';
|
|||||||
import { Toaster } from 'sonner';
|
import { Toaster } from 'sonner';
|
||||||
|
|
||||||
export default function ToasterWithThemes() {
|
export default function ToasterWithThemes() {
|
||||||
const { theme } = useTheme();
|
const { resolvedTheme } = useTheme();
|
||||||
return (
|
return (
|
||||||
<Toaster
|
<Toaster
|
||||||
theme={theme as 'system' | 'light' | 'dark'}
|
theme={resolvedTheme as 'light' | 'dark' | undefined}
|
||||||
toastOptions={{
|
toastOptions={{
|
||||||
classNames: {
|
classNames: {
|
||||||
toast: clsx(
|
toast: clsx(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user