Skip to content

Commit 95112a9

Browse files
committed
Overlay rework
1 parent 9a916a3 commit 95112a9

File tree

4 files changed

+33
-42
lines changed

4 files changed

+33
-42
lines changed

src/overlay.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@ export class Overlay extends Events {
2323

2424
compile() {
2525
compile_template(this, `
26-
<div class="modal ${this.css}" id="${this.uid}" t-elem="elem">
26+
<div class="modal fade ${this.css}" id="${this.uid}" t-elem="elem" data-bs-backdrop="static">
2727
<div class="modal-dialog">
2828
<div class="modal-content">
2929
<div class="modal-header">
30-
<button class="btn p-0 text-primary text-decoration-underline link-offset-2 close" t-prop="close_btn" t-bind-click="close">
31-
<span aria-hidden="true">&times;</span>
32-
<span class="sr-only">Close</span>
33-
</button>
3430
<h5 class="modal-title">${this.title}</h5>
31+
<button class="btn-close close" t-prop="close_btn" t-bind-click="close">
32+
<span class="visually-hidden">Close</span>
33+
</button>
3534
</div>
3635
<div class="modal-body" t-elem="body">${this.content}</div>
3736
<div class="modal-footer" t-elem="footer"></div>
@@ -42,23 +41,19 @@ export class Overlay extends Events {
4241
}
4342

4443
open() {
45-
$('body')
46-
.css('padding-right', '13px')
47-
.css('overflow-x', 'hidden')
48-
.addClass('modal-open');
44+
$('body').addClass('modal-open');
4945
this.container.append(this.elem);
5046
this.elem.show();
47+
this.elem.modal('show');
5148
this.is_open = true;
5249
this.trigger('on_open');
5350
}
5451

5552
close() {
5653
if ($('.modal:visible').length === 1) {
57-
$('body')
58-
.css('padding-right', '')
59-
.css('overflow-x', 'auto')
60-
.removeClass('modal-open');
54+
$('body').removeClass('modal-open');
6155
}
56+
this.elem.modal('hide');
6257
this.elem.remove();
6358
this.is_open = false;
6459
this.trigger('on_close');

treibstoff/bundle/treibstoff.bundle.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -569,15 +569,14 @@ var ts = (function (exports, $) {
569569
}
570570
compile() {
571571
compile_template(this, `
572-
<div class="modal ${this.css}" id="${this.uid}" t-elem="elem">
572+
<div class="modal fade ${this.css}" id="${this.uid}" t-elem="elem" data-bs-backdrop="static">
573573
<div class="modal-dialog">
574574
<div class="modal-content">
575575
<div class="modal-header">
576-
<button class="btn p-0 text-primary text-decoration-underline link-offset-2 close" t-prop="close_btn" t-bind-click="close">
577-
<span aria-hidden="true">&times;</span>
578-
<span class="sr-only">Close</span>
579-
</button>
580576
<h5 class="modal-title">${this.title}</h5>
577+
<button class="btn-close close" t-prop="close_btn" t-bind-click="close">
578+
<span class="visually-hidden">Close</span>
579+
</button>
581580
</div>
582581
<div class="modal-body" t-elem="body">${this.content}</div>
583582
<div class="modal-footer" t-elem="footer"></div>
@@ -587,22 +586,18 @@ var ts = (function (exports, $) {
587586
`);
588587
}
589588
open() {
590-
$('body')
591-
.css('padding-right', '13px')
592-
.css('overflow-x', 'hidden')
593-
.addClass('modal-open');
589+
$('body').addClass('modal-open');
594590
this.container.append(this.elem);
595591
this.elem.show();
592+
this.elem.modal('show');
596593
this.is_open = true;
597594
this.trigger('on_open');
598595
}
599596
close() {
600597
if ($('.modal:visible').length === 1) {
601-
$('body')
602-
.css('padding-right', '')
603-
.css('overflow-x', 'auto')
604-
.removeClass('modal-open');
598+
$('body').removeClass('modal-open');
605599
}
600+
this.elem.modal('hide');
606601
this.elem.remove();
607602
this.is_open = false;
608603
this.trigger('on_close');

0 commit comments

Comments
 (0)