import React, { useState, useEffect } from 'react'
interface HeartLogoProps {
size?: 'small' | 'medium' | 'large' | 'header' | 'header-no-rays'
className?: string
onClick?: () => void
}
export function HeartLogo({ size = 'small', className = '', onClick }: HeartLogoProps) {
const [animationOffset, setAnimationOffset] = useState(0)
const [isAnimating, setIsAnimating] = useState(false)
// Click handler to toggle animation
const handleClick = () => {
setIsAnimating(!isAnimating)
if (onClick) {
onClick()
}
}
// Animation for header beams
useEffect(() => {
if (size !== 'header-no-rays' || !isAnimating) return
let animationId: number
let startTime = Date.now()
const animate = () => {
const elapsed = Date.now() - startTime
const rotationSpeed = 0.02 // Slow rotation speed
const offset = (elapsed * rotationSpeed) % 360
setAnimationOffset(offset)
animationId = requestAnimationFrame(animate)
}
animationId = requestAnimationFrame(animate)
return () => {
if (animationId) {
cancelAnimationFrame(animationId)
}
}
}, [size, isAnimating])
if (size === 'header') {
// Header version with rays filling the entire header rectangle
return (
)
}
if (size === 'header-no-rays') {
// Header version with small red beams - compact sunlight effect
return (
)
}
// Original square version for other sizes
return (
)
}