UNPKG

dynamic-modal

Version:

The dynamic-modal is a solution of creation different modals into project using a json configuration file

15 lines (14 loc) 559 B
'use client'; import { jsx as _jsx } from "react/jsx-runtime"; import { useContext, useId } from 'react'; import { ComponentStateContext } from '../../context/component/component-state'; const MakeButton = ({ element, getValues }) => { const { Button } = useContext(ComponentStateContext); const elementId = useId(); return (_jsx(Button, { ...element, id: elementId, onClick: () => { const formData = getValues(); if (element.onClick) element.onClick(formData); } })); }; export default MakeButton;