import React from 'react' import { Flex } from '@chakra-ui/react' export const RainbowSkeleton = props => { const [rainbowColours] = React.useState(["#f34a4a", "#ffbc48", "#58ca70", "#47b5e6", "#a555e8"]) const keyframes = React.useMemo(() => { let keyframes = {} rainbowColours.forEach((colour, idx) => { keyframes[Math.round(idx * 100 / rainbowColours.length) + "%"] = { backgroundColor: colour } }) keyframes["100%"] = { backgroundColor: rainbowColours[0] } return keyframes }, [rainbowColours]) if (props?.loaded) { return props?.children } return ( ) }