hero1
This commit is contained in:
parent
a63ba979d4
commit
0aa214e3eb
1 changed files with 12 additions and 10 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
import { useThemeMode } from '@/hooks/useThemeMode'
|
||||||
import { useEffect, useRef, useState } from "react";
|
// REPLACE WITH:
|
||||||
|
import { useEffect, useRef } from "react";
|
||||||
|
|
||||||
const STAR_TONES = [255, 210, 160, 110, 65];
|
const STAR_TONES = [255, 210, 160, 110, 65];
|
||||||
const WAVE_TONES = [55, 90, 125, 165, 205];
|
const WAVE_TONES = [55, 90, 125, 165, 205];
|
||||||
|
|
@ -125,15 +126,16 @@ export default function HeroBackground({
|
||||||
showToggle = true,
|
showToggle = true,
|
||||||
}: HeroBackgroundProps) {
|
}: HeroBackgroundProps) {
|
||||||
const canvasRef = useRef<HTMLCanvasElement>(null);
|
const canvasRef = useRef<HTMLCanvasElement>(null);
|
||||||
const [internalDark, setInternalDark] = useState(true);
|
// REPLACE WITH:
|
||||||
|
const { isDark: hookDark, toggle } = useThemeMode();
|
||||||
|
|
||||||
// Use external control if provided, otherwise internal state
|
// Use external control if provided, otherwise hook
|
||||||
const isDark = externalIsDark !== undefined ? externalIsDark : internalDark;
|
const isDark = externalIsDark !== undefined ? externalIsDark : hookDark;
|
||||||
|
|
||||||
|
// REPLACE WITH:
|
||||||
function handleToggle() {
|
function handleToggle() {
|
||||||
const next = !isDark;
|
toggle();
|
||||||
setInternalDark(next);
|
onToggle?.(!isDark);
|
||||||
onToggle?.(next);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue