Skip to content

Commit 180a12d

Browse files
committed
support preview mode background
1 parent c93db00 commit 180a12d

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextDevicePreviewMode.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ export default {
6464
width,
6565
height
6666
}) {
67+
document.querySelector('body').setAttribute('data-device-preview-mode', mode);
6768
document.querySelector('[data-apos-refreshable]').setAttribute('data-resizable', this.resizable);
68-
document.querySelector('[data-apos-refreshable]').setAttribute('data-device-preview-mode', mode);
6969
document.querySelector('[data-apos-refreshable]').setAttribute('data-label', this.$t(label));
7070
document.querySelector('[data-apos-refreshable]').style.width = width;
7171
document.querySelector('[data-apos-refreshable]').style.height = height;
@@ -84,8 +84,8 @@ export default {
8484
height
8585
}) {
8686
if (this.mode === mode || mode === null) {
87+
document.querySelector('body').removeAttribute('data-device-preview-mode');
8788
document.querySelector('[data-apos-refreshable]').removeAttribute('data-resizable');
88-
document.querySelector('[data-apos-refreshable]').removeAttribute('data-device-preview-mode');
8989
document.querySelector('[data-apos-refreshable]').removeAttribute('data-label');
9090
document.querySelector('[data-apos-refreshable]').style.removeProperty('width');
9191
document.querySelector('[data-apos-refreshable]').style.removeProperty('height');
Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1-
[data-apos-refreshable][data-device-preview-mode] {
2-
container-type: size;
3-
flex-grow: unset;
4-
margin: 60px auto auto;
5-
border: 1px solid var(--a-base-2);
6-
box-shadow: 0 0 3px var(--a-base-2);
1+
body[data-device-preview-mode] {
2+
background-color: var(--a-base-10);
73

8-
&[data-resizable="true"] {
9-
resize: both;
10-
overflow: scroll;
11-
}
4+
[data-apos-refreshable] {
5+
container-type: size;
6+
flex-grow: unset;
7+
margin: 60px auto auto;
8+
border: 1px solid var(--a-base-2);
9+
box-shadow: 0 2px 10px 2px var(--a-base-5);
10+
background-color: var(--a-background-primary);
11+
12+
&[data-resizable="true"] {
13+
resize: both;
14+
overflow: scroll;
15+
}
1216

13-
&::before {
14-
content: attr(data-label);
15-
position: relative;
16-
top: -1.5rem;
17-
left: $spacing-half;
18-
display: block;
17+
&::before {
18+
content: attr(data-label);
19+
position: relative;
20+
top: -1.5rem;
21+
display: block;
22+
}
1923
}
2024
}

0 commit comments

Comments
 (0)