fix: appearance fix
This commit is contained in:
@@ -16,7 +16,7 @@ class HandleAppearance
|
|||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): Response
|
public function handle(Request $request, Closure $next): Response
|
||||||
{
|
{
|
||||||
View::share('appearance', $request->cookie('appearance') ?? 'system');
|
View::share('appearance', $request->cookie('appearance') ?? 'light');
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Appearance, useAppearance } from '@/hooks/use-appearance';
|
import { Appearance, useAppearance } from '@/hooks/use-appearance';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { LucideIcon, Monitor, Moon, Sun } from 'lucide-react';
|
import { LucideIcon, Sun } from 'lucide-react';
|
||||||
import { HTMLAttributes } from 'react';
|
import { HTMLAttributes } from 'react';
|
||||||
|
|
||||||
export default function AppearanceToggleTab({
|
export default function AppearanceToggleTab({
|
||||||
@@ -11,8 +11,8 @@ export default function AppearanceToggleTab({
|
|||||||
|
|
||||||
const tabs: { value: Appearance; icon: LucideIcon; label: string }[] = [
|
const tabs: { value: Appearance; icon: LucideIcon; label: string }[] = [
|
||||||
{ value: 'light', icon: Sun, label: 'Light' },
|
{ value: 'light', icon: Sun, label: 'Light' },
|
||||||
{ value: 'dark', icon: Moon, label: 'Dark' },
|
// { value: 'dark', icon: Moon, label: 'Dark' },
|
||||||
{ value: 'system', icon: Monitor, label: 'System' },
|
// { value: 'system', icon: Monitor, label: 'System' },
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const handleSystemThemeChange = () => {
|
|||||||
|
|
||||||
export function initializeTheme() {
|
export function initializeTheme() {
|
||||||
const savedAppearance =
|
const savedAppearance =
|
||||||
(localStorage.getItem('appearance') as Appearance) || 'system';
|
(localStorage.getItem('appearance') as Appearance) || 'light';
|
||||||
|
|
||||||
applyTheme(savedAppearance);
|
applyTheme(savedAppearance);
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ export function initializeTheme() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function useAppearance() {
|
export function useAppearance() {
|
||||||
const [appearance, setAppearance] = useState<Appearance>('system');
|
const [appearance, setAppearance] = useState<Appearance>('light');
|
||||||
|
|
||||||
const updateAppearance = useCallback((mode: Appearance) => {
|
const updateAppearance = useCallback((mode: Appearance) => {
|
||||||
setAppearance(mode);
|
setAppearance(mode);
|
||||||
@@ -69,7 +69,7 @@ export function useAppearance() {
|
|||||||
const savedAppearance = localStorage.getItem(
|
const savedAppearance = localStorage.getItem(
|
||||||
'appearance',
|
'appearance',
|
||||||
) as Appearance | null;
|
) as Appearance | null;
|
||||||
updateAppearance(savedAppearance || 'system');
|
updateAppearance(savedAppearance || 'light');
|
||||||
|
|
||||||
return () =>
|
return () =>
|
||||||
mediaQuery()?.removeEventListener(
|
mediaQuery()?.removeEventListener(
|
||||||
|
|||||||
Reference in New Issue
Block a user