Skip to content

Commit 421fcf5

Browse files
committed
fix(pwa): update header offset
1 parent 0c647a7 commit 421fcf5

File tree

7 files changed

+26
-14
lines changed

7 files changed

+26
-14
lines changed

src/components/AppComponent.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,15 @@ const onBack = () => {
183183
flex-direction: column;
184184
align-items: center;
185185
justify-content: center;
186-
min-height: calc(var(--full-height) - #{layout.$header-navbar-height});
187-
margin-top: layout.$header-navbar-height;
186+
min-height: layout.$main-content-height;
187+
margin-top: layout.$safe-navbar-height;
188188
189189
&.full-height {
190190
min-height: var(--full-height);
191191
margin-top: 0;
192192
193193
:deep(.loading-container) {
194-
padding-top: layout.$header-navbar-height;
194+
padding-top: layout.$safe-navbar-height;
195195
}
196196
}
197197
}
@@ -205,7 +205,7 @@ const onBack = () => {
205205
206206
.panel {
207207
position: relative;
208-
max-height: calc(100% - #{layout.$header-navbar-height});
208+
max-height: calc(100% - #{layout.$safe-navbar-height});
209209
overflow: auto;
210210
211211
&-header {

src/components/common/list/ListScroll.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ const isEmpty = computed(() => !items.value.length && !loading.value);
228228
@include animation.fade-in;
229229
230230
.list-scroll {
231-
height: calc(var(--full-height) - 8px);
232-
margin-top: -#{layout.$header-navbar-height};
231+
height: calc(var(--full-height-absolute) - 8px);
232+
margin-top: calc(0% - #{layout.$safe-navbar-height});
233233
margin-bottom: 8px;
234234
235235
.load-more {

src/components/container/ContainerComponent.ce.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ onBeforeMount(() => addCustomProgressProperty());
135135
layout.$navbar-transition-delay-visible}
136136
);
137137
138-
top: layout.$header-navbar-height;
138+
top: layout.$safe-navbar-height;
139139
140140
&.drawer-visible {
141141
top: layout.$header-open-drawer-height;
@@ -156,7 +156,7 @@ onBeforeMount(() => addCustomProgressProperty());
156156
layout.$navbar-transition-delay-visible}
157157
);
158158
159-
top: calc(#{layout.$header-navbar-height} + 12px);
159+
top: calc(#{layout.$safe-navbar-height} + 12px);
160160
161161
&.drawer-visible {
162162
top: calc(#{layout.$header-open-drawer-height} + 12px);

src/components/views/about/AboutComponent.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ const openRelease = (url?: string) => {
127127
128128
.container {
129129
width: 100%;
130-
height: calc(var(--full-height) - #{layout.$header-navbar-height});
130+
height: layout.$main-content-height;
131131
background: transparent;
132132
133133
.card {

src/components/views/settings/SettingsComponent.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@ onDeactivated(() => {
136136
.container {
137137
width: 100%;
138138
height: var(--full-height);
139-
margin-top: -#{layout.$header-navbar-height};
139+
margin-top: calc(0% - #{layout.$safe-navbar-height});
140140
background: transparent;
141141
142142
.card {
143143
@include mixin.hover-background($from: var(--bg-black-50), $to: var(--bg-color-80));
144144
145145
z-index: var(--length);
146-
scroll-margin-top: calc(#{layout.$header-navbar-height} + 1rem);
146+
scroll-margin-top: calc(#{layout.$safe-navbar-height} + 1rem);
147147
148148
&:not(:last-child) {
149149
z-index: calc(var(--length) - var(--index));
@@ -164,7 +164,7 @@ onDeactivated(() => {
164164
.menu {
165165
@include mixin.hover-background;
166166
167-
height: calc(var(--full-height) - #{layout.$header-navbar-height});
167+
height: layout.$main-content-height;
168168
padding: 0.5rem;
169169
}
170170
@@ -175,7 +175,7 @@ onDeactivated(() => {
175175
176176
.menu,
177177
.content .card:first-child {
178-
margin-top: layout.$header-navbar-height;
178+
margin-top: layout.$safe-navbar-height;
179179
}
180180
}
181181
</style>

src/styles/base.scss

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
:host {
33
/* height */
44
--full-height: 100dvh;
5+
--full-height-absolute: 100vh;
56
--half-height: 50dvh;
67
--height-40-dvh: 40dvh;
78
--height-70-dvh: 70dvh;

src/styles/layout.scss

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1+
// Pwa safe areas
2+
$safe-area-inset-top: env(safe-area-inset-top);
3+
$safe-area-inset-right: env(safe-area-inset-right);
4+
$safe-area-inset-bottom: env(safe-area-inset-bottom);
5+
$safe-area-inset-left: env(safe-area-inset-left);
6+
7+
// Element heights
18
$header-navbar-height: 2.75rem;
9+
$safe-navbar-height: calc(#{$header-navbar-height} + #{$safe-area-inset-top});
210
$header-drawer-height: 3.5rem;
3-
$header-open-drawer-height: calc(#{$header-navbar-height} + #{$header-drawer-height});
11+
$header-open-drawer-height: calc(#{$safe-navbar-height} + #{$header-drawer-height});
12+
$main-content-height: calc(var(--full-height) - #{$safe-navbar-height});
13+
14+
// Navbar transition
415
$navbar-transition: 0.5s var(--n-bezier);
516
$navbar-transition-visible: 0.25s var(--n-bezier);
617
$navbar-transition-delay: 0.5s;

0 commit comments

Comments
 (0)