'use client' import Konami from 'react-konami-code' import { Snowfall } from 'react-snowfall' import { useEffect, useState } from 'react' import { nationalities } from '@/app/db/data' export default function KonamiSnowfall({ nationalityList, }: Readonly<{ nationalityList: string[] }>) { const [snowfallActivated, setSnowfallActivated] = useState(false) const [images, setImages] = useState([]) const handleKonami = () => { setSnowfallActivated(!snowfallActivated) } useEffect(() => { const imagesTemp: HTMLImageElement[] = [] nationalityList.forEach((n) => { const { flag } = nationalities[n] const image = new Image() image.src = flag imagesTemp.push(image) }) setImages(imagesTemp) }, []) return ( <> {snowfallActivated && ( )} ) }