mirror of
https://github.com/supabase/supabase.git
synced 2026-10-19 08:09:11 +03:00
restore dark theme on unmount
This commit is contained in:
1 parent
c94513b1db
commit
7bfb31ea2f
3 files changed
+23
-9
No files matched your search
@@ -65,14 +65,19 @@ export default function GAWeekIndex({ meetups }: Props) {
|
||||
}
|
||||
}, [supabase])
|
||||
|
||||
const isDark = resolvedTheme?.includes('dark')
|
||||
const isDarkTheme = resolvedTheme === 'dark'
|
||||
|
||||
useEffect(() => {
|
||||
if (isDarkTheme) {
|
||||
setTheme('deep-dark')
|
||||
}
|
||||
isDarkTheme && setTheme('deep-dark')
|
||||
}, [isDarkTheme])
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
isDark && setTheme('dark')
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (session?.user) {
|
||||
if (userData?.id) {
|
||||
|
||||
@@ -43,14 +43,19 @@ export default function UsernamePage({ user, ogImageUrl }: Props) {
|
||||
const [ticketState, setTicketState] = useState<TicketState>('ticket')
|
||||
const { resolvedTheme, setTheme } = useTheme()
|
||||
|
||||
const isDark = resolvedTheme?.includes('dark')
|
||||
const isDarkTheme = resolvedTheme === 'dark'
|
||||
|
||||
useEffect(() => {
|
||||
if (isDarkTheme) {
|
||||
setTheme('deep-dark')
|
||||
}
|
||||
isDarkTheme && setTheme('deep-dark')
|
||||
}, [isDarkTheme])
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
isDark && setTheme('dark')
|
||||
}
|
||||
}, [])
|
||||
|
||||
if (!ticketNumber) {
|
||||
return <Error statusCode={404} />
|
||||
}
|
||||
|
||||
@@ -30,11 +30,15 @@ export default function IndexPage() {
|
||||
const isDarkTheme = resolvedTheme === 'dark'
|
||||
|
||||
useEffect(() => {
|
||||
if (isDarkTheme) {
|
||||
setTheme('deep-dark')
|
||||
}
|
||||
isDarkTheme && setTheme('deep-dark')
|
||||
}, [isDarkTheme])
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
isDark && setTheme('dark')
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<DefaultLayout>
|
||||
<NextSeo
|
||||
|
||||
Reference in new issue
Block a user