Skip to content

Commit c40e441

Browse files
committed
fix(web): fix checkin safe inset area padding
1 parent 2f83b9f commit c40e441

File tree

4 files changed

+36
-29
lines changed

4 files changed

+36
-29
lines changed

src/components/AppComponent.vue

+2
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ onBeforeUnmount(() => {
169169
justify-content: center;
170170
min-height: layout.$main-content-height;
171171
margin-top: layout.$safe-navbar-height;
172+
padding-right: calc(#{layout.$safe-area-inset-right} / 1.5);
173+
padding-left: calc(#{layout.$safe-area-inset-left} / 1.5);
172174
173175
&.full-height {
174176
min-height: var(--full-height);

src/components/common/buttons/FloatingButton.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const emit = defineEmits<{
5555

5656
<style lang="scss" scoped>
5757
@use '~/styles/mixin' as mixin;
58+
@use '~/styles/layout' as layout;
5859
@use '~/styles/transition' as transition;
5960
@include transition.scale($scale: 0.6);
6061
@@ -68,7 +69,7 @@ const emit = defineEmits<{
6869
padding: 0.5rem;
6970
7071
&.watching {
71-
bottom: 2.5rem;
72+
bottom: calc(2.5rem + #{layout.$safe-area-inset-bottom / 1.5});
7273
}
7374
7475
.text {

src/components/views/checkin/CheckinComponent.vue

+32-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts" setup>
22
import { formatTime } from '@dvcol/common-utils/common/format';
33
import { NButton, NIcon, NTooltip } from 'naive-ui';
4-
import { computed, defineProps } from 'vue';
4+
import { computed } from 'vue';
55
66
import IconCancel from '~/components/icons/IconCancel.vue';
77
import IconMovie from '~/components/icons/IconMovie.vue';
@@ -19,7 +19,7 @@ import {
1919
} from '~/utils/watching.utils';
2020
import { watchMedia } from '~/utils/window.utils';
2121
22-
defineProps({
22+
const props = defineProps({
2323
parentElement: {
2424
type: HTMLElement,
2525
required: false,
@@ -33,6 +33,24 @@ const { cancel } = useWatchingStore();
3333
3434
const isTiny = watchMedia('(max-width: 600px)');
3535
36+
const offset = computed(() => {
37+
if (!props.parentElement) return;
38+
return (
39+
Number.parseInt(
40+
getComputedStyle(props.parentElement).getPropertyValue('--safe-area-inset-bottom'),
41+
10,
42+
) ||
43+
Number.parseInt(
44+
getComputedStyle(props.parentElement).getPropertyValue('--safe-area-inset-left'),
45+
10,
46+
) ||
47+
Number.parseInt(
48+
getComputedStyle(props.parentElement).getPropertyValue('--safe-area-inset-right'),
49+
10,
50+
)
51+
);
52+
});
53+
3654
const icon = computed(() => (watching.value?.type === 'movie' ? IconMovie : IconScreen));
3755
const title = computed(() => {
3856
if (!watching.value) return '';
@@ -128,7 +146,7 @@ const onClick = () => {
128146

129147
<template>
130148
<div class="wrapper">
131-
<div class="container" :class="{ watching: isWatching }" @click="onClick">
149+
<div class="container" :class="{ watching: isWatching, offset }" @click="onClick">
132150
<span class="left">
133151
<NIcon class="icon" :component="icon" />
134152
<div class="column">
@@ -302,12 +320,21 @@ const onClick = () => {
302320
}
303321
304322
&.watching {
305-
height: calc(1.75rem + #{layout.$safe-area-inset-bottom});
323+
height: calc(1.75rem + #{layout.$safe-area-inset-bottom / 1.5});
324+
325+
&.offset {
326+
padding: 0
327+
max(
328+
calc(#{layout.$safe-area-inset-left} / 2),
329+
calc(#{layout.$safe-area-inset-right} / 2),
330+
calc(#{layout.$safe-area-inset-bottom} / 1.5)
331+
);
332+
}
306333
307334
&:active,
308335
&:focus-within,
309336
&:hover {
310-
height: calc(3rem + #{layout.$safe-area-inset-bottom});
337+
height: calc(3rem + #{layout.$safe-area-inset-bottom} / 2);
311338
color: var(--white);
312339
313340
.icon {

src/styles/base.scss

-23
Original file line numberDiff line numberDiff line change
@@ -190,29 +190,6 @@
190190
--bg-color-hover: var(--bg-black-60);
191191
}
192192

193-
/*
194-
@media (prefers-color-scheme: light) {
195-
!* semantic color variables for this project *!
196-
--color-background: var(--white);
197-
--color-background-soft: var(--white-soft);
198-
--color-background-mute: var(--white-mute);
199-
--color-border: var(--vt-c-divider-light-2);
200-
--color-border-hover: var(--vt-c-divider-light-1);
201-
--color-heading: var(--vt-c-text-light-1);
202-
--color-text: var(--vt-c-text-light-1);
203-
204-
!* ui color variables *!
205-
--bg-color-20: var(--bg-red-20);
206-
--bg-color-30: var(--bg-red-30);
207-
--bg-color-60: var(--bg-red-60);
208-
--bg-color-70: var(--bg-red-70);
209-
--bg-color-80: var(--bg-red-80);
210-
--bg-color-90: var(--bg-red-90);
211-
--bg-color: var(--bg-color-80);
212-
--bg-color-hover: var(--bg-red-90);
213-
}
214-
*/
215-
216193
@media (display-mode: standalone) {
217194
/* height */
218195
--full-height: 100vh;

0 commit comments

Comments
 (0)