Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions src/components/NcModal/NcModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ export default {
<div v-show="showModal"
ref="mask"
class="modal-mask"
:class="{ 'modal-mask--dark': dark || !closeButtonContained || hasPrevious || hasNext }"
:class="{
'modal-mask--opaque': dark || !closeButtonContained || hasPrevious || hasNext,
'modal-mask--light': lightBackdrop,
}"
:style="cssVariables"
role="dialog"
aria-modal="true"
Expand All @@ -200,7 +203,9 @@ export default {
tabindex="-1">
<!-- Header -->
<transition name="fade-visibility" appear>
<div class="modal-header" data-theme-dark>
<div class="modal-header"
:data-theme-light="lightBackdrop"
:data-theme-dark="!lightBackdrop">
<h2 v-if="name.trim() !== ''"
:id="'modal-name-' + randId"
class="modal-header__name">
Expand Down Expand Up @@ -447,14 +452,22 @@ export default {
},

/**
* Makes the modal backdrop black if true
* Makes the modal backdrop opaque if true
* Will be overwritten if some buttons are shown outside
*/
dark: {
type: Boolean,
default: false,
},

/**
* Set light backdrop. Makes the modal header appear light.
*/
lightBackdrop: {
type: Boolean,
default: false,
},

/**
* Selector for the modal container, pass `null` to prevent automatic container mounting
*/
Expand Down Expand Up @@ -835,9 +848,13 @@ export default {
display: block;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
&--dark {
background-color: rgba(0, 0, 0, .92);
--backdrop-color: 0, 0, 0;
background-color: rgba(var(--backdrop-color), .5);
&--opaque {
background-color: rgba(var(--backdrop-color), .92);
}
&--light {
--backdrop-color: 255, 255, 255;
}
}

Expand Down