UNPKG

plazbot

Version:

Official Plazbot SDK for creating AI agents for WhatsApp, portals, and developers.

28 lines (27 loc) 832 B
import { useEffect, useRef } from 'react'; import { plazbotKeyframes } from './keyframes'; const STYLE_ID = 'plazbot-react-styles'; export function StyleInjector() { const injected = useRef(false); useEffect(() => { if (injected.current) return; if (typeof document === 'undefined') return; if (document.getElementById(STYLE_ID)) { injected.current = true; return; } const style = document.createElement('style'); style.id = STYLE_ID; style.textContent = plazbotKeyframes; document.head.appendChild(style); injected.current = true; return () => { const el = document.getElementById(STYLE_ID); if (el) el.remove(); }; }, []); return null; }