1
1
<script lang="ts" setup>
2
2
import { formatTime } from ' @dvcol/common-utils/common/format' ;
3
3
import { NButton , NIcon , NTooltip } from ' naive-ui' ;
4
- import { computed , defineProps } from ' vue' ;
4
+ import { computed } from ' vue' ;
5
5
6
6
import IconCancel from ' ~/components/icons/IconCancel.vue' ;
7
7
import IconMovie from ' ~/components/icons/IconMovie.vue' ;
@@ -19,7 +19,7 @@ import {
19
19
} from ' ~/utils/watching.utils' ;
20
20
import { watchMedia } from ' ~/utils/window.utils' ;
21
21
22
- defineProps ({
22
+ const props = defineProps ({
23
23
parentElement: {
24
24
type: HTMLElement ,
25
25
required: false ,
@@ -33,6 +33,24 @@ const { cancel } = useWatchingStore();
33
33
34
34
const isTiny = watchMedia (' (max-width: 600px)' );
35
35
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
+
36
54
const icon = computed (() => (watching .value ?.type === ' movie' ? IconMovie : IconScreen ));
37
55
const title = computed (() => {
38
56
if (! watching .value ) return ' ' ;
@@ -128,7 +146,7 @@ const onClick = () => {
128
146
129
147
<template >
130
148
<div class =" wrapper" >
131
- <div class =" container" :class =" { watching: isWatching }" @click =" onClick" >
149
+ <div class =" container" :class =" { watching: isWatching, offset }" @click =" onClick" >
132
150
<span class =" left" >
133
151
<NIcon class =" icon" :component =" icon" />
134
152
<div class =" column" >
@@ -302,12 +320,21 @@ const onClick = () => {
302
320
}
303
321
304
322
& .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
+ }
306
333
307
334
& :active ,
308
335
& :focus-within ,
309
336
& :hover {
310
- height : calc (3rem + #{layout .$safe-area-inset-bottom } );
337
+ height : calc (3rem + #{layout .$safe-area-inset-bottom } / 2 );
311
338
color : var (--white );
312
339
313
340
.icon {
0 commit comments