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";
|
||||
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useThemeMode } from '@/hooks/useThemeMode'
|
||||
// REPLACE WITH:
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
const STAR_TONES = [255, 210, 160, 110, 65];
|
||||
const WAVE_TONES = [55, 90, 125, 165, 205];
|
||||
|
|
@ -125,15 +126,16 @@ export default function HeroBackground({
|
|||
showToggle = true,
|
||||
}: HeroBackgroundProps) {
|
||||
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
|
||||
const isDark = externalIsDark !== undefined ? externalIsDark : internalDark;
|
||||
// Use external control if provided, otherwise hook
|
||||
const isDark = externalIsDark !== undefined ? externalIsDark : hookDark;
|
||||
|
||||
// REPLACE WITH:
|
||||
function handleToggle() {
|
||||
const next = !isDark;
|
||||
setInternalDark(next);
|
||||
onToggle?.(next);
|
||||
toggle();
|
||||
onToggle?.(!isDark);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue