import { useBoolean, useTimeout } from 'ahooks'; import type { FC } from 'react'; import { useMemo } from 'react'; import { usePageStoreContext } from '../PageStore'; const CopySuccess: FC<{ onHide?: () => void }> = ({ onHide }) => { useTimeout(() => { onHide?.(); }, 1500); return Copy Successfully.; }; export const Code: FC = () => { const { svgComponent, svgProps } = usePageStoreContext(); const colors = useMemo(() => { return svgProps.color; }, [svgProps.color]); const code = useMemo(() => { const colorString = colors ? `color={${JSON.stringify(colors)}}` : ''; return `<${svgComponent?.name} ${colorString} />`; }, [colors, svgComponent?.name]); const [copyShow, copyShowToggle] = useBoolean(); return (