fix/ deep-dark theme name issue (#28282)
* init fix * more * more * change storageKey * added deep-dark css selectors as a workaround * update css
This commit is contained in:
committed by
GitHub
parent
0c98f1db67
commit
cff565ceda
@@ -21,7 +21,11 @@ export default async function Layout({ children }: RootLayoutProps) {
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<head />
|
||||
<body className={inter.className}>
|
||||
<ThemeProvider themes={['dark', 'light', 'deep-dark']} defaultTheme="system" enableSystem>
|
||||
<ThemeProvider
|
||||
themes={['dark', 'light', 'classic-dark']}
|
||||
defaultTheme="system"
|
||||
enableSystem
|
||||
>
|
||||
<div vaul-drawer-wrapper="">
|
||||
<div className="relative flex min-h-screen flex-col bg-background">{children}</div>
|
||||
</div>
|
||||
|
||||
@@ -116,9 +116,9 @@ export function CommandMenu({ ...props }: DialogProps) {
|
||||
<MoonIcon className="mr-2 h-4 w-4" strokeWidth={1} />
|
||||
Dark
|
||||
</CommandItem_Shadcn_>
|
||||
<CommandItem_Shadcn_ onSelect={() => runCommand(() => setTheme('deep-dark'))}>
|
||||
<CommandItem_Shadcn_ onSelect={() => runCommand(() => setTheme('classic-dark'))}>
|
||||
<MoonIcon className="mr-2 h-4 w-4" strokeWidth={1} />
|
||||
Deep Dark
|
||||
Classic dark
|
||||
</CommandItem_Shadcn_>
|
||||
<CommandItem_Shadcn_ onSelect={() => runCommand(() => setTheme('system'))}>
|
||||
<LaptopIcon className="mr-2 h-4 w-4" strokeWidth={1} />
|
||||
|
||||
@@ -4,7 +4,7 @@ import SVG from 'react-inlinesvg'
|
||||
export default function RadioGroupDemo() {
|
||||
const singleThemes = [
|
||||
{ name: 'Dark', value: 'dark' }, // Classic Supabase dark
|
||||
{ name: 'Deep Dark', value: 'deep-dark' }, // Deep Dark Supabase dark
|
||||
{ name: 'Classic dark', value: 'classic-dark' }, // Deep Dark Supabase dark
|
||||
{ name: 'Light', value: 'light' }, // Classic Supabase light
|
||||
{ name: 'System', value: 'system' }, // Classic Supabase light
|
||||
] as const
|
||||
|
||||
@@ -167,7 +167,12 @@ function CustomApp({ Component, pageProps }: AppPropsWithLayout) {
|
||||
<PageTelemetry>
|
||||
<TooltipProvider>
|
||||
<RouteValidationWrapper>
|
||||
<ThemeProvider defaultTheme="system" enableSystem disableTransitionOnChange>
|
||||
<ThemeProvider
|
||||
defaultTheme="system"
|
||||
themes={['dark', 'light', 'classic-dark']}
|
||||
enableSystem
|
||||
disableTransitionOnChange
|
||||
>
|
||||
<AppBannerContextProvider>
|
||||
<CommandMenuWrapper>
|
||||
<AppBannerWrapper>
|
||||
|
||||
@@ -13,7 +13,7 @@ export function useForceDeepDark() {
|
||||
useEffect(() => {
|
||||
const handleDocumentLoad = () => {
|
||||
// Update the HTML element attributes
|
||||
const theme = forceDarkMode || isDarkTheme ? (isGaSection ? 'deep-dark' : 'dark') : 'light'
|
||||
const theme = forceDarkMode || isDarkTheme ? 'dark' : 'light'
|
||||
|
||||
document.documentElement.setAttribute('data-theme', theme)
|
||||
document.documentElement.style.colorScheme = theme
|
||||
|
||||
@@ -118,7 +118,6 @@ export default function App({ Component, pageProps }: AppProps) {
|
||||
<AuthProvider>
|
||||
<ThemeProvider
|
||||
themes={themes.map((theme) => theme.value)}
|
||||
defaultTheme="system"
|
||||
enableSystem
|
||||
disableTransitionOnChange
|
||||
forcedTheme={forceDarkMode ? 'dark' : undefined}
|
||||
|
||||
@@ -46,15 +46,15 @@ export default function UsernamePage({ user, ogImageUrl }: Props) {
|
||||
const isDark = resolvedTheme?.includes('dark')
|
||||
const isDarkTheme = resolvedTheme === 'dark'
|
||||
|
||||
useEffect(() => {
|
||||
isDarkTheme && setTheme('deep-dark')
|
||||
}, [isDarkTheme])
|
||||
// useEffect(() => {
|
||||
// isDarkTheme && setTheme('deep-dark')
|
||||
// }, [isDarkTheme])
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
isDark && setTheme('dark')
|
||||
}
|
||||
}, [])
|
||||
// useEffect(() => {
|
||||
// return () => {
|
||||
// isDark && setTheme('dark')
|
||||
// }
|
||||
// }, [])
|
||||
|
||||
if (!ticketNumber) {
|
||||
return <Error statusCode={404} />
|
||||
|
||||
@@ -7,7 +7,7 @@ export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
|
||||
// @ts-ignore next-themes is old :/
|
||||
|
||||
return (
|
||||
<NextThemesProvider {...props} themes={['dark', 'light', 'deep-dark']}>
|
||||
<NextThemesProvider {...props} themes={['dark', 'light']} defaultTheme="dark">
|
||||
{children}
|
||||
</NextThemesProvider>
|
||||
)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
[data-theme='deep-dark'],
|
||||
.deep-dark,
|
||||
[data-theme='classic-dark'],
|
||||
.classic-dark,
|
||||
[data-theme='dark'],
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
[data-theme='deep-dark'],
|
||||
.deep-dark,
|
||||
[data-theme='dark'],
|
||||
.dark {
|
||||
--helpers-os-appearance: Dark;
|
||||
|
||||
@@ -6,6 +6,6 @@ export interface Theme {
|
||||
export const themes = [
|
||||
{ name: 'System', value: 'system' }, // Switches between dark and light
|
||||
{ name: 'Dark', value: 'dark' }, // Classic Supabase dark
|
||||
{ name: 'Deep Dark', value: 'deep-dark' }, // Deep Dark Supabase dark
|
||||
{ name: 'Classic dark', value: 'classic-dark' }, // Deep Dark Supabase dark
|
||||
{ name: 'Light', value: 'light' }, // Classic Supabase light
|
||||
]
|
||||
|
||||
@@ -236,11 +236,18 @@ themeFiles.map(function (filePath, i) {
|
||||
fileName = fileName === 'concept-one' ? 'dark' : fileName
|
||||
|
||||
const selector = isCombinedDark
|
||||
? `[data-theme='classic-dark'],
|
||||
? `[data-theme='deep-dark'],
|
||||
.deep-dark,
|
||||
[data-theme='classic-dark'],
|
||||
.classic-dark,
|
||||
[data-theme='dark'],
|
||||
.dark`
|
||||
: `[data-theme='${fileName}'],
|
||||
: fileName === 'dark'
|
||||
? `[data-theme='deep-dark'],
|
||||
.deep-dark,
|
||||
[data-theme='${fileName}'],
|
||||
.${fileName}`
|
||||
: `[data-theme='${fileName}'],
|
||||
.${fileName}`
|
||||
|
||||
let configTailwindFilesByType = []
|
||||
|
||||
Reference in New Issue
Block a user