import { useState, useEffect } from '@wordpress/element' import { Transition } from '@headlessui/react' import classNames from 'classnames' import Color from 'color' import Skeleton, { SkeletonTheme } from 'react-loading-skeleton' import 'react-loading-skeleton/dist/skeleton.css' export const SkeletonLoader = ({ theme, context }) => { const [highlightColor, setHighlightColor] = useState() const color = theme?.color ?? '#000000' const bgColor = theme?.bgColor ?? '#cccccc' useEffect(() => { const id = requestAnimationFrame(() => { if (!theme?.color) return const hl = Color(color).isLight() ? darkenBy(Color(color), 0.15).hexa() : lightenBy(Color(color), 0.15).hexa() setHighlightColor(hl) }) return () => cancelAnimationFrame(id) }, [color, bgColor, theme?.color]) return (