Skip to content

Commit 13d4d59

Browse files
committed
fix(floating): fix panel top offset
1 parent 3b8f0dc commit 13d4d59

File tree

7 files changed

+24
-17
lines changed

7 files changed

+24
-17
lines changed

src/components/AppComponent.vue

+10-2
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ const onBack = () => {
219219
220220
:deep(.root-panel-wrapper.n-drawer) {
221221
transition: all 0.3s var(--n-bezier);
222+
223+
.n-drawer-content-wrapper {
224+
overscroll-behavior: none;
225+
}
222226
}
223227
224228
&.watching {
@@ -245,6 +249,10 @@ const onBack = () => {
245249
bottom: auto;
246250
}
247251
252+
:deep(.root-panel-wrapper.n-drawer) {
253+
padding-bottom: layout.$header-navbar-height;
254+
}
255+
248256
&.watching {
249257
:deep(.root-panel-wrapper.n-drawer) {
250258
padding-top: layout.$top-safe-watching-height;
@@ -260,8 +268,8 @@ const onBack = () => {
260268
}
261269
262270
main {
263-
min-height: layout.$floating-content-height;
264-
margin-top: layout.$safe-area-inset-top;
271+
min-height: var(--full-height);
272+
margin-top: 0;
265273
}
266274
267275
:deep(.root-panel-wrapper.n-drawer) {

src/components/common/list/ListScroll.vue

+6-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
} from '~/models/list-scroll.model';
1919
import { useAppStateStoreRefs } from '~/stores/app-state.store';
2020
import { useWatchingStoreRefs } from '~/stores/data/watching.store';
21-
import { Watching } from '~/styles/layout.style';
21+
import { Header, Watching } from '~/styles/layout.style';
2222
import { watchMedia } from '~/utils/window.utils';
2323
2424
const listRef = ref<VirtualListRef>();
@@ -207,14 +207,15 @@ const topInset = computed(() => {
207207
const listPaddingTop = computed(() => {
208208
const offset = topInset.value;
209209
if (listOptions?.value?.paddingTop) return offset + listOptions.value.paddingTop;
210-
if (floating.value) return offset + 10;
211-
if (reverse.value)
212-
return isWatching.value ? offset + 16 + Watching.Height : offset + 16;
210+
if (floating.value) return offset + Header.navbarHeight + Header.floatingOffset + 14;
211+
if (reverse.value && isWatching.value) return offset + 16 + Watching.Height;
212+
if (reverse.value) return offset + 16;
213213
return offset + 60;
214214
});
215215
const listPaddingBottom = computed(() => {
216216
if (listOptions?.value?.paddingBottom) return listOptions.value.paddingBottom;
217-
if (reverse.value) return 8 + 16;
217+
if (reverse.value) return 8 + Header.navbarHeight;
218+
if (isWatching.value) return 8 + Watching.Height;
218219
return 8;
219220
});
220221
</script>

src/components/views/checkin/CheckinComponent.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ const onClick = () => {
412412
413413
&.reverse {
414414
height: layout.$top-safe-watching-height;
415-
padding-top: calc(#{layout.$safe-area-inset-top} / 1.5);
415+
padding-top: layout.$safe-area-inset-top;
416416
417417
&:active,
418418
&:focus-within,

src/components/views/progress/ProgressComponent.vue

-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ const { isWatching } = useWatchingStoreRefs();
3232
const { scrolled, listRef, onClick } = useBackToTop();
3333
const { onItemClick } = usePanelItem();
3434
35-
const { reverse } = useAppStateStoreRefs();
36-
3735
onMounted(() => {
3836
watch(panelOpen, async value => {
3937
if (!value && panelDirty.value) await fetchProgress();
@@ -105,7 +103,6 @@ useActiveAndDocumentVisible({
105103
ref="listRef"
106104
:loading="loading"
107105
:items="progress"
108-
:list-options="reverse ? { paddingBottom: 44 } : {}"
109106
backdrop
110107
hide-date
111108
show-progress

src/stores/app-state.store.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ export const useAppStateStore = defineStore('app.state', () => {
6464
root,
6565
reverse: computed(() => {
6666
if (navbarPosition.value === NavbarPosition.Bottom) return true;
67-
if (!isWeb.value) return false;
67+
if (isPopup.value) return false;
6868
// web and small screen only
6969
return navbarPosition.value === NavbarPosition.Auto && bottom.width;
7070
}),
7171
floating: computed(() => {
7272
if (minimum.width) return false;
7373
// if (panelOpen.value) return false;
7474
if (navbarPosition.value === NavbarPosition.Floating) return true;
75-
if (!isWeb.value) return false;
75+
if (isPopup.value) return false;
7676
// web & big screen only
7777
return navbarPosition.value === NavbarPosition.Auto && floating.width === false;
7878
}),

src/styles/layout.scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ $floating-content-height: $safe-full-height;
2424
$bottom-content-height: calc(var(--full-height) - #{$header-navbar-height});
2525

2626
// Watching
27-
$watching-height: 1.75rem;
27+
$watching-height: 2rem;
2828
$watching-open-height: 3rem;
2929
$safe-watching-height: calc(#{$watching-height} + #{$safe-area-inset-bottom / 1.5});
3030
$safe-watching-open-height: calc(#{$watching-open-height} + #{$safe-area-inset-bottom / 1.5});
31-
$top-safe-watching-height: calc(#{$watching-height} + #{$safe-area-inset-top / 1.5});
32-
$top-safe-watching-open-height: calc(#{$watching-open-height} + #{$safe-area-inset-top / 1.5});
31+
$top-safe-watching-height: calc(#{$watching-height} + #{$safe-area-inset-top});
32+
$top-safe-watching-open-height: calc(#{$watching-open-height} + #{$safe-area-inset-top});
3333

3434
// Navbar transition
3535
$navbar-transition: 0.5s var(--n-bezier);

src/styles/layout.style.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
export const Header = {
2+
floatingOffset: 16,
23
navbarHeight: 44,
34
drawerHeight: 56,
45
totalHeight: 100,
56
} as const;
67

78
export const Watching = {
8-
Height: 28,
9+
Height: 32,
910
OpenHeight: 48,
1011
};

0 commit comments

Comments
 (0)