import '../styles/Background.sass' import { Show, createSignal } from 'solid-js' import fs from 'fs' import webpPath from '../images/background.webp' import avifPath from '../images/background.avif' import noBackground from '../images/no-background.webp' interface Props { image?: boolean color?: string } let [imageLoaded, setImageLoaded] = createSignal(false) const checkBackground = () => { if (!fs.existsSync(avifPath.src) && !fs.existsSync(webpPath.src)) { setImageLoaded(true) } else { setImageLoaded(false) } } export default (props: Props) => { checkBackground() return ( <> An image background An alternative background if found no image background
) }