import React from "react"; import Button from "../components/Button/Button"; import Text from "../components/Text/Text"; import useParticleBurst from "./useParticleBurst"; const imagePath = "https://via.placeholder.com/10"; export default { title: "Hooks/useParticleBurst", argTypes: {}, }; export const WithSelector: React.FC = () => { useParticleBurst({ imgSrc: imagePath, selector: "button" }); return (
); }; export const Document: React.FC = () => { useParticleBurst({ imgSrc: imagePath }); return (
Any click (not recommended)
); }; export const AdjustDistance: React.FC = () => { useParticleBurst({ imgSrc: imagePath, particleOptions: { distance: 800 } }); return (
Adjust distance
); }; export const AdjustSize: React.FC = () => { useParticleBurst({ imgSrc: imagePath, particleOptions: { size: 80 } }); return (
Adjust size
); }; export const AdjustNumberOfParticles: React.FC = () => { useParticleBurst({ imgSrc: imagePath, numberOfParticles: 100 }); return (
100 particles (beware of performance)
); }; export const DisableUnderCondition: React.FC = () => { const disableWhen = () => { const date = new Date(); const currentMinutes = date.getMinutes(); return currentMinutes % 2 !== 0; }; useParticleBurst({ selector: "button", imgSrc: imagePath, disableWhen }); return (
Will only burst when current minute is even
); }; export const StopAndStart: React.FC = () => { const { initialize, teardown } = useParticleBurst({ imgSrc: imagePath }); const handleInitialize = () => initialize(); const handleTeardown = () => teardown(); return (
100 particles (beware of performance)
); };