Merge pull request #997 from Safelite/feature/humphries/centered-modal
Add prop to modal component to allow for centering
This commit is contained in:
commit
8ece7b9095
2 changed files with 42 additions and 21 deletions
|
|
@ -11,7 +11,11 @@
|
||||||
'hidden.bs.modal': onModalClosed,
|
'hidden.bs.modal': onModalClosed,
|
||||||
'shown.bs.modal': onModalOpened
|
'shown.bs.modal': onModalOpened
|
||||||
}">
|
}">
|
||||||
<div class="modal-dialog modal-dialog-centered">
|
<div class="modal-dialog"
|
||||||
|
:class="{
|
||||||
|
'modal-dialog-edge': modalPosition === 'edge',
|
||||||
|
'modal-dialog-centered': modalPosition === 'center'
|
||||||
|
}">
|
||||||
<div
|
<div
|
||||||
class="modal-content"
|
class="modal-content"
|
||||||
role="dialog"
|
role="dialog"
|
||||||
|
|
@ -77,6 +81,10 @@ export default {
|
||||||
buttonVariant: {
|
buttonVariant: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'success'
|
default: 'success'
|
||||||
|
},
|
||||||
|
modalPosition: {
|
||||||
|
type: String,
|
||||||
|
default: 'edge'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ['footer-button-event', 'isModalOpened'],
|
emits: ['footer-button-event', 'isModalOpened'],
|
||||||
|
|
@ -192,24 +200,10 @@ export default {
|
||||||
}
|
}
|
||||||
&.modal-component {
|
&.modal-component {
|
||||||
.modal-dialog {
|
.modal-dialog {
|
||||||
|
display: flex;
|
||||||
max-width: 47.9375rem;
|
max-width: 47.9375rem;
|
||||||
margin: 0 auto;
|
|
||||||
@include media-breakpoint-up(md) {
|
|
||||||
width: 23.5rem;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
transform: translate(100%, 0);
|
|
||||||
}
|
|
||||||
.modal-content {
|
.modal-content {
|
||||||
margin: 1.5rem auto 0 auto;
|
margin: 1.5rem auto 0 auto;
|
||||||
box-shadow: 0px 1rem 3rem -1rem rgba(0, 0, 0, 0.25);
|
|
||||||
border-radius: 1.5rem 1.5rem 0 0;
|
|
||||||
@include media-breakpoint-up(md) {
|
|
||||||
box-shadow: none;
|
|
||||||
border-radius: 0;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
.modal-body {
|
.modal-body {
|
||||||
.col {
|
.col {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
|
@ -235,11 +229,40 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&.modal-dialog-centered {
|
&.modal-dialog-edge {
|
||||||
align-items: flex-end;
|
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
align-items: flex-end;
|
||||||
@include media-breakpoint-up(md) {
|
@include media-breakpoint-up(md) {
|
||||||
align-items: inherit;
|
align-items: inherit;
|
||||||
|
width: 23.5rem;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
transform: translate(100%);
|
||||||
|
}
|
||||||
|
.modal-content {
|
||||||
|
box-shadow: 0px 1rem 3rem -1rem rgba(0, 0, 0, 0.25);
|
||||||
|
border-radius: 1.5rem 1.5rem 0 0;
|
||||||
|
@include media-breakpoint-up(md) {
|
||||||
|
box-shadow: none;
|
||||||
|
border-radius: 0;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.modal-dialog-centered {
|
||||||
|
.modal-content {
|
||||||
|
box-shadow: 0px 1rem 3rem -1rem rgba(0, 0, 0, 0.25);
|
||||||
|
border-radius: 1.5rem;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.show .modal-dialog {
|
||||||
|
&.modal-dialog-edge {
|
||||||
|
@include media-breakpoint-up(md) {
|
||||||
|
transform: translateY(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -251,9 +274,6 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&.show .modal-dialog {
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
|
||||||
@include media-breakpoint-up(md) {
|
@include media-breakpoint-up(md) {
|
||||||
&.fade {
|
&.fade {
|
||||||
transition: opacity 0.25s linear;
|
transition: opacity 0.25s linear;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
:onModalOpenedCallback="onModalOpened"
|
:onModalOpenedCallback="onModalOpened"
|
||||||
:onModalClosedCallback="onModalClosed"
|
:onModalClosedCallback="onModalClosed"
|
||||||
:footerButtonText="modalFooterText"
|
:footerButtonText="modalFooterText"
|
||||||
|
:modalPosition="'center'"
|
||||||
@footerButtonEvent="setZipCode">
|
@footerButtonEvent="setZipCode">
|
||||||
<serviceZipQuestion
|
<serviceZipQuestion
|
||||||
ref="serviceZipCodeQuestion"
|
ref="serviceZipCodeQuestion"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue