decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.95k stars 3.04k forks source link

Feat: use react component for dialogs instead of window alerts #3057

Open erezrokah opened 4 years ago

erezrokah commented 4 years ago

Is your feature request related to a problem? Please describe. There are several places in the code that use window.confirm/alert for dialogs (one example is when uploading an existing media file).

I think we should should consider switching to a friendlier UI (maybe we can use the existing redux-notifications package we're using for status messages).

Describe the solution you'd like Use a react component for dialogs instead of window dialogs.

Describe alternatives you've considered We can write our own modals but I'm guessing there should be a library for that.

Additional context Related to this https://github.com/netlify/netlify-cms/issues/2822

Mack241 commented 2 years ago

There is an npm package called react-modal.

Alternative: Using the Modal component API from Material-UI @erezrokah @erquhart

erezrokah commented 2 years ago

I think we'll be good with using an external package for this, as long as it's not deprecated/archived and gets security updates

Mack241 commented 2 years ago

I have noticed that Editor, EditorToolbar and EditorInterface are class based components. Do you think changing it into functional components will be more efficient as we can use Hooks. @erezrokah

Mack241 commented 2 years ago

Or rather just EditorToolbar, since the Back-Arrow is present in this component.

erezrokah commented 2 years ago

Hi @Mack241, see my comment in https://github.com/netlify/netlify-cms/pull/6137#pullrequestreview-859639958 about using hooks in the CMS

Mack241 commented 2 years ago

@erezrokah Got it!