UNPKG

dynamic-modal

Version:

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

17 lines (16 loc) 692 B
'use client'; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = require("react"); const component_state_1 = require("../../context/component/component-state"); const MakeButton = ({ element, getValues }) => { const { Button } = (0, react_1.useContext)(component_state_1.ComponentStateContext); const elementId = (0, react_1.useId)(); return ((0, jsx_runtime_1.jsx)(Button, { ...element, id: elementId, onClick: () => { const formData = getValues(); if (element.onClick) element.onClick(formData); } })); }; exports.default = MakeButton;