Skip to content

Commit d4fcd98

Browse files
committed
allow manual direction setup
1 parent 37ca65f commit d4fcd98

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

resources/views/components/stack.blade.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
@props([
2+
'direction' => null,
23
'fullscreen' => false,
34
])
45

56
<div {!! $attributes->class([
67
'pt-20 sm:p-5' => !$fullscreen,
78
'size-full min-w-0 flex pointer-events-none [&>*]:pointer-events-auto',
89
]) !!} x-data="{
10+
modalDirection: {{ $direction ? Js::from($direction) : '[0, 0]' }},
911
modalPosition: [null, null],
10-
get modalStackDirection() {
12+
computeModalDirection() {
1113
const [px, py] = this.modalPosition;
1214
1315
const directions = {
@@ -32,16 +34,18 @@
3234
return [px, py];
3335
},
3436
init() {
35-
this.$nextTick(() => {
37+
@if (!$direction) this.$nextTick(() => {
3638
this.modalPosition = this.computeModalPosition();
37-
});
39+
this.modalDirection = this.computeModalDirection();
40+
}); @endif
41+
3842
},
3943
modalAttributes: {
4044
['x-show']() { return isModalStacked ? modalHistory.includes(modalId) : isModalActive; },
4145
['x-bind:inert']() { return !isModalActive },
4246
['x-bind:style']() {
4347
if (isModalStacked) {
44-
const [dx, dy] = this.modalStackDirection;
48+
const [dx, dy] = this.modalDirection;
4549
4650
return {
4751
'--dx': dx,

0 commit comments

Comments
 (0)