HardeepAsrani / my-awesome-plugin

This is an example plugin to create options page in WordPress using components from Gutenberg.
26 stars 13 forks source link

Notification and multiple inputs #20

Closed Mecanik closed 2 years ago

Mecanik commented 2 years ago

Hi! Thanks for the awesome example.

I`m not so well versed with React or WP components, how would I add a notification upon save? I tried a few examples online but frankly wasted hours and nothing worked, lol.

Also, if I add multiple inputs... how can I save all "at once"? For example besides analytics key input, I would like to add another one.

Many Thanks!

HardeepAsrani commented 2 years ago

Hey @Mecanik,

You can use a component like this for adding notifications: https://www.npmjs.com/package/react-notifications-component

You can just do what we did in our example just add a save button that sends both the input values at the same time. We do something similar here: https://github.com/Codeinwp/otter-blocks/blob/master/src/dashboard/Components/Main.js#L274-L317

Mecanik commented 2 years ago

Thanks a lot.