@jitcoder/solid-dialog
v0.0.3
Published
A functional approach to showing modals/dialogs.
Readme
Solid Dialog Component
A functional approach to showing modals/dialogs.
Installation
$ yarn add @jitcoder/solid-dialogUsage
const App = () => {
return (
<div>
<Dialog />
</div>
)
}
// showDialog will add a `submit` callback to props. submit will be the showDialog's promise's resolution
const HelloWorldDialog = ({message, submit}) => {
const onDone = () => {
submit('hello world button clicked');
}
return (
<div>
<span> Hello World : {message} </span>
<button onClick={onDone}>Click Me!</button>
</div>
)
}
// second argument will be passed to the ExtensionSettingsDialog's props
const result = await showDialog(HelloWorldDialog, { message });
console.log(result);
//'hello world button clicked'
