Skip to content

Commit b67a68d

Browse files
pkp/pkp-lib#10444 Improve dialog component design (#415)
* pkp/pkp-lib#10444 Change Dialog component styling * pkp/pkp-lib#10444 Rename prop type with modalStyle * pkp/pkp-lib#10444 Update default Dialog modal styling * pkp/pkp-lib#10444 Add modalStyle param to existing openDialog calls * pkp/pkp-lib#10444 Add isDismissible prop to the Dialog component, and add the X button when there are no actions in the props * pkp/pkp-lib#10444 Add modalStyle to components that use the openDialog api * pkp/pkp-lib#10444 Update Dialog component to add basic modalStyle and add documentation how the styles are used * pkp/pkp-lib#10444 Remove computed defination of default modalStyle in Dialog component * pkp/pkp-lib#10444 Add modalStyle to new dialogs related to user invitations * pkp/pkp-lib#10444 Remove unused classes for dialog component * pkp/pkp-lib#10444 Remove css style for modal--popup class * pkp/pkp-lib#10444 Update param name for onClose function in Dialog component
1 parent 2b591e8 commit b67a68d

37 files changed

+346
-209
lines changed

src/components/ActionPanel/ActionPanel.stories.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const Default = {
3535
callback: (close) => close(),
3636
},
3737
],
38+
modalStyle: 'negative',
3839
});
3940
}
4041
return {

src/components/Composer/Composer.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,7 @@ export default {
906906
callback: (close) => close(),
907907
},
908908
],
909+
modalStyle: 'primary',
909910
});
910911
},
911912

src/components/Container/DecisionPage.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ export default {
182182
callback: (close) => close(),
183183
},
184184
],
185+
modalStyle: 'negative',
185186
});
186187
},
187188
@@ -266,6 +267,7 @@ export default {
266267
message: this.decisionCompleteDescription,
267268
actions,
268269
close,
270+
modalStyle: 'success',
269271
});
270272
},
271273

src/components/Container/ManageEmailsPage.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export default {
151151
callback: (close) => close(),
152152
},
153153
],
154+
modalStyle: 'negative',
154155
});
155156
},
156157
@@ -187,6 +188,7 @@ export default {
187188
callback: (close) => close(),
188189
},
189190
],
191+
modalStyle: 'negative',
190192
});
191193
},
192194
@@ -224,6 +226,7 @@ export default {
224226
callback: (close) => close(),
225227
},
226228
],
229+
modalStyle: 'negative',
227230
});
228231
},
229232
@@ -325,7 +328,7 @@ export default {
325328
title: mailable ? mailable.name : '',
326329
mailable: this.currentMailable,
327330
onOpenTemplate: this.openTemplate,
328-
onConfirmResetTemplate: this.confirmRemoveTemplate,
331+
onConfirmResetTemplate: this.confirmResetTemplate,
329332
onConfirmRemoveTemplate: this.confirmRemoveTemplate,
330333
});
331334
});

src/components/Container/SubmissionWizardPage.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ export default {
432432
callback: (close) => close(),
433433
},
434434
],
435+
modalStyle: 'negative',
435436
});
436437
},
437438
@@ -661,6 +662,7 @@ export default {
661662
callback: (close) => close(),
662663
},
663664
],
665+
modalStyle: 'primary',
664666
});
665667
},
666668

src/components/Container/WorkflowPage.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ export default {
341341
actions: [
342342
{
343343
label: this.t('common.yes'),
344-
isWarnable: true,
344+
isPrimary: true,
345345
callback: (close) => {
346346
close();
347347
this.createVersion();
@@ -352,6 +352,7 @@ export default {
352352
callback: (close) => close(),
353353
},
354354
],
355+
modalStyle: 'primary',
355356
});
356357
},
357358
@@ -447,7 +448,7 @@ export default {
447448
this.workingPublication.status === pkp.const.STATUS_SCHEDULED
448449
? this.unscheduleLabel
449450
: this.unpublishLabel,
450-
isPrimary: true,
451+
isWarnable: true,
451452
callback: (close) => {
452453
this.unpublish(this.workingPublication);
453454
close();
@@ -458,6 +459,7 @@ export default {
458459
callback: (close) => close(),
459460
},
460461
],
462+
modalStyle: 'negative',
461463
});
462464
},
463465

src/components/Form/context/NotifyUsersForm.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export default {
5353
callback: (close) => close(),
5454
},
5555
],
56+
modalStyle: 'primary',
5657
});
5758
},
5859
},

src/components/Form/fields/FieldOrcid.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ export default {
190190
},
191191
},
192192
],
193+
modalStyle: 'primary',
193194
close: () => {},
194195
});
195196
},
@@ -227,20 +228,20 @@ export default {
227228
actions: [
228229
{
229230
label: this.t('common.yes'),
230-
isPrimary: true,
231+
isWarnable: true,
231232
callback: async (close) => {
232233
await this.deleteOrcid();
233234
close();
234235
},
235236
},
236237
{
237238
label: this.t('common.no'),
238-
isWarnable: true,
239239
callback: (close) => {
240240
close();
241241
},
242242
},
243243
],
244+
modalStyle: 'negative',
244245
close: () => {},
245246
});
246247
},

src/components/Form/fields/FieldShowEnsuringLink.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default {
2323
},
2424
mounted() {
2525
/**
26-
* Show the requested message in a modal when the link in the messgae is
26+
* Show the requested message in a modal when the link in the message is
2727
* clicked.
2828
*/
2929
$('.pkpFormField--options__option button', this.$el).click(() => {
@@ -36,6 +36,7 @@ export default {
3636
callback: (close) => {
3737
close();
3838
},
39+
modalStyle: 'primary',
3940
},
4041
{
4142
height: 'auto',

src/components/ListPanel/announcements/AnnouncementsListPanel.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export default {
209209
actions: [
210210
{
211211
label: this.t('common.yes'),
212-
isPrimary: true,
212+
isWarnable: true,
213213
callback: (close) => {
214214
var self = this;
215215
$.ajax({
@@ -233,10 +233,10 @@ export default {
233233
},
234234
{
235235
label: this.t('common.no'),
236-
isWarnable: true,
237236
callback: (close) => close(),
238237
},
239238
],
239+
modalStyle: 'negative',
240240
});
241241
},
242242

src/components/ListPanel/contributors/ContributorsListPanel.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ export default {
363363
callback: (close) => close(),
364364
},
365365
],
366+
modalStyle: 'negative',
366367
});
367368
},
368369

src/components/ListPanel/doi/DoiListItem.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,12 +513,12 @@ export default {
513513
actions: [
514514
{
515515
label: this.t('common.ok'),
516-
isPrimary: true,
517516
callback: (close) => {
518517
close();
519518
},
520519
},
521520
],
521+
modalStyle: 'negative',
522522
});
523523
},
524524
openVersionModal() {
@@ -814,6 +814,7 @@ export default {
814814
},
815815
},
816816
],
817+
modalStyle: 'primary',
817818
});
818819
},
819820
triggerDeposit() {

src/components/ListPanel/doi/DoiListPanel.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,13 @@ export default {
375375
actions: [
376376
{
377377
label: this.t('common.ok'),
378-
isPrimary: true,
379378
callback: (close) => {
380379
this.failedDoiActions = [];
381380
close();
382381
},
383382
},
384383
],
384+
modalStyle: 'negative',
385385
bodyComponent: DoiFailedActionDialogBody,
386386
bodyProps: {
387387
failedDoiActions: this.failedDoiActions,
@@ -789,6 +789,7 @@ export default {
789789
callback: (close) => close(),
790790
},
791791
],
792+
modalStyle: 'primary',
792793
});
793794
},
794795
/**

src/components/ListPanel/highlights/HighlightsListPanel.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export default {
228228
actions: [
229229
{
230230
label: this.t('common.yes'),
231-
isPrimary: true,
231+
isWarnable: true,
232232
callback: (close) => {
233233
$.ajax({
234234
url: this.apiUrl + '/' + id,
@@ -251,10 +251,10 @@ export default {
251251
},
252252
{
253253
label: this.t('common.no'),
254-
isWarnable: true,
255254
callback: (close) => close(),
256255
},
257256
],
257+
modalStyle: 'negative',
258258
});
259259
},
260260

src/components/ListPanel/institutions/InstitutionsListPanel.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export default {
211211
actions: [
212212
{
213213
label: this.t('common.yes'),
214-
isPrimary: true,
214+
isWarnable: true,
215215
callback: (close) => {
216216
var self = this;
217217
$.ajax({
@@ -235,10 +235,10 @@ export default {
235235
},
236236
{
237237
label: this.t('common.no'),
238-
isWarnable: true,
239238
callback: (close) => close(),
240239
},
241240
],
241+
modalStyle: 'negative',
242242
});
243243
},
244244

src/components/ListPanel/submissionFiles/SubmissionFilesListPanel.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ export default {
259259
actions: [
260260
{
261261
label: this.t('common.yes'),
262-
isPrimary: true,
262+
isWarnable: true,
263263
callback: (close) => {
264264
$.ajax({
265265
url: this.apiUrl + '/' + item.id + '?stageId=' + this.stageId,
@@ -281,10 +281,10 @@ export default {
281281
},
282282
{
283283
label: this.t('common.no'),
284-
isWarnable: true,
285284
callback: (close) => close(),
286285
},
287286
],
287+
modalStyle: 'negative',
288288
});
289289
},
290290

src/components/ListPanel/submissions/SubmissionsListItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,15 +813,15 @@ export default {
813813
actions: [
814814
{
815815
label: this.t('common.yes'),
816-
isPrimary: true,
816+
isWarnable: true,
817817
callback: this.deleteSubmission,
818818
},
819819
{
820820
label: this.t('common.no'),
821-
isWarnable: true,
822821
callback: (close) => close(),
823822
},
824823
],
824+
modalStyle: 'negative',
825825
});
826826
},
827827

src/components/Modal/Dialog.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ Dialog purpose is to display simple feedback like success and error messages. Or
1919

2020
Dialog are opened via method `openDialog` from [useModal](../?path=/docs/composables-usemodal--docs#opensidemodal) composable. Check out the props description for details.
2121

22+
## Styling
23+
24+
The style of the modal can be changed by passing the prop `modalStyle`. It accepts the following values:
25+
26+
- **`primary`**: A modal style that uses the primary color scheme. Use this for informational dialogs or confirmation modals that don't involve negative actions. This is the default style used when the modal is invoked via the composable API for the Dialog component.
27+
- **`negative`**: Indicates a negative state, typically for error messages or alerts. It should also be used for confirming negative actions like deleting or removing items that may be irreversible.
28+
- **`success`**: Represents a positive state, often used for success notifications.
29+
- **` basic`**: The standard modal style, which has no special border styling. This style is applied by default in the legacy PHP implementation of the Dialog component, if no value is specified.
30+
2231
## Accessibility
2332

2433
To correctly handle accessibility (title, description) and focus management - [headless-ui](https://headlessui.com) library is used.

0 commit comments

Comments
 (0)