Skip to content

Commit 0e6b9a8

Browse files
committed
feat: create JOverlay component
Also replace VOverlay with it Signed-off-by: Fernando Fernández <ferferga@hotmail.com>
1 parent 0245f8f commit 0e6b9a8

File tree

9 files changed

+87
-116
lines changed

9 files changed

+87
-116
lines changed

frontend/src/assets/styles/global.css

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@ html.no-forced-scrollbar {
1313

1414
/* Custom utility classes */
1515

16-
.absolute-cover {
17-
height: 100%;
18-
width: 100%;
19-
position: absolute;
20-
top: 0;
21-
left: 0;
22-
right: 0;
23-
bottom: 0;
24-
}
25-
2616
.link {
2717
cursor: pointer;
2818
color: inherit !important;

frontend/src/components/Item/Card/GenericItemCard.vue

Lines changed: 22 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,35 @@
77
<JHover v-slot="{ isHovering }">
88
<div
99
:class="shape"
10-
class="elevation-2">
11-
<div
12-
class="d-flex align-center justify-center absolute-cover card-content">
13-
<JSlot class="card-image">
14-
<slot
15-
name="image" />
16-
</JSlot>
10+
class="elevation-2 uno-bg-background">
11+
<JSlot class="align-center card-content uno-h-full uno-w-full uno-flex uno-justify-center">
12+
<slot name="image" />
13+
</JSlot>
14+
<div class="align-center card-upper-content uno-flex uno-justify-center">
15+
<slot name="upper-content" />
1716
</div>
18-
<div
19-
class="absolute-cover d-flex justify-center align-center card-overlay"
20-
:class="{ 'card-overlay-hover': overlay && hasFinePointer }">
21-
<div class="d-flex justify-center align-center card-upper-content">
22-
<slot name="upper-content" />
17+
<JOverlay
18+
v-if="(isHovering && overlay && hasFinePointer) || forceOverlay"
19+
scrim>
20+
<slot name="center-content" />
21+
<div class="align-center card-lower-content uno-flex uno-justify-center">
22+
<slot name="bottom-content" />
2323
</div>
24-
<div
25-
v-if="(isHovering && overlay && hasFinePointer) || forceOverlay"
26-
class="card-overlay-hover-hidden">
27-
<slot name="center-content" />
28-
<div class="d-flex justify-center align-center card-lower-content">
29-
<slot name="bottom-content" />
30-
</div>
31-
</div>
32-
<VProgressLinear
33-
v-if="
34-
!isNil(progress) && progress > 0
35-
"
36-
:model-value="progress"
37-
absolute
38-
location="bottom" />
39-
</div>
24+
</JOverlay>
25+
<VProgressLinear
26+
v-if="
27+
!isNil(progress) && progress > 0
28+
"
29+
:model-value="progress"
30+
absolute
31+
location="bottom" />
4032
</div>
4133
</JHover>
4234
</Component>
4335
<div
4436
v-if="$slots.title || ($slots.title && $slots.subtitle)"
4537
class="card-text">
46-
<a class="font-weight-medium pa-0 mt-1 text-truncate d-block">
38+
<a class="font-weight-medium pa-0 mt-1 text-truncate uno-block">
4739
<slot name="title" />
4840
</a>
4941
<a class="v-card-subtitle">
@@ -59,6 +51,7 @@ import { useAttrs, computed } from 'vue';
5951
import { isNil } from '@/utils/validation';
6052
import { hasFinePointer } from '@/store';
6153
import type { CardShapes } from '@/utils/items';
54+
import JOverlay from '@/components/lib/JOverlay.vue';
6255
6356
const { shape, progress, overlay, forceOverlay, to, margin } = defineProps<{
6457
shape: CardShapes;
@@ -112,11 +105,6 @@ const hasClick = computed(() => !!attrs.onClick);
112105
border-radius: 0.3em;
113106
}
114107
115-
.card-image {
116-
width: 100%;
117-
height: 100%;
118-
}
119-
120108
.card-upper-content {
121109
position: absolute;
122110
right: 0.5em;
@@ -147,28 +135,6 @@ const hasClick = computed(() => !!attrs.onClick);
147135
-webkit-tap-highlight-color: transparent;
148136
}
149137
150-
.card-overlay {
151-
transition: all 0.2s;
152-
}
153-
154-
.overlay-hover {
155-
transition: opacity 0.2s;
156-
}
157-
158-
.card-overlay-hover-hidden {
159-
transition: inherit;
160-
opacity: 0;
161-
}
162-
163-
@media (hover: hover) and (pointer: fine) {
164-
.card-box:hover .card-overlay-hover {
165-
background: rgb(var(--j-color-background), 0.5);
166-
}
167-
.card-box:hover .card-overlay-hover .card-overlay-hover-hidden {
168-
opacity: 1;
169-
}
170-
}
171-
172138
.card-text {
173139
text-align: center;
174140
padding: 0 0.25em;
@@ -181,7 +147,4 @@ const hasClick = computed(() => !!attrs.onClick);
181147
text-decoration: none;
182148
color: unset;
183149
}
184-
.absolute {
185-
position: absolute;
186-
}
187150
</style>

frontend/src/components/Layout/Images/Blurhash/BlurhashImage.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
2-
<div>
2+
<JOverlay>
33
<JImg
4-
class="absolute-cover"
4+
class="uno-h-full uno-w-full"
55
:src="imageUrl"
66
:alt="item.Name ?? $t('unknown')"
77
v-bind="$attrs">
@@ -12,7 +12,7 @@
1212
:width="width"
1313
:height="height"
1414
:punch="punch"
15-
class="absolute-cover">
15+
class="uno-h-full uno-w-full">
1616
<BlurhashImageIcon
1717
:item="item"
1818
class="uno-z--1" />
@@ -22,7 +22,7 @@
2222
:item="item" />
2323
</template>
2424
</JImg>
25-
</div>
25+
</JOverlay>
2626
</template>
2727

2828
<script setup lang="ts">

frontend/src/components/Layout/Images/Blurhash/BlurhashImageIcon.vue

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<template>
2-
<VAvatar
3-
v-if="getItemIcon(item)"
4-
:rounded="false"
5-
size="100%"
6-
class="absolute-cover d-flex justify-center align-center align-self-center">
7-
<VIcon
8-
class="text--disabled placeholder"
9-
size="50%"
10-
:icon="getItemIcon(item)">
11-
<component :is="getItemIcon(item)" />
12-
</VIcon>
13-
</VAvatar>
2+
<JOverlay>
3+
<VAvatar
4+
v-if="getItemIcon(item)"
5+
:rounded="false"
6+
size="100%"
7+
class="d-flex justify-center align-center align-self-center uno-h-full uno-w-full">
8+
<VIcon
9+
class="text--disabled placeholder"
10+
size="50%"
11+
:icon="getItemIcon(item)">
12+
<component :is="getItemIcon(item)" />
13+
</VIcon>
14+
</VAvatar>
15+
</JOverlay>
1416
</template>
1517

1618
<script setup lang="ts">

frontend/src/components/Playback/MiniVideoPlayer.vue

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,13 @@
66
no-click-animation
77
:scrim="false"
88
scroll-strategy="none"
9-
content-class="minimized-overlay"
9+
content-class="uno-absolute uno-right-8 uno-bottom-8"
1010
:close-on-back="false"
1111
:width="$vuetify.display.mobile ? '60vw' : '25vw'">
1212
<div
1313
ref="videoContainerRef"
1414
class="minimized-video-container" />
15-
<VOverlay
16-
:model-value="isHovering"
17-
contained
18-
:close-on-back="false"
19-
height="100%"
20-
width="100%">
15+
<JOverlay scrim>
2116
<div class="d-flex flex-column">
2217
<div class="d-flex flex-row">
2318
<VBtn
@@ -66,7 +61,7 @@
6661
</VBtn>
6762
</div>
6863
</div>
69-
</VOverlay>
64+
</JOverlay>
7065
</VOverlay>
7166
</JHover>
7267
</template>
@@ -75,16 +70,3 @@
7570
import { playbackManager } from '@/store/playback-manager';
7671
import { playerElement, videoContainerRef } from '@/store/player-element';
7772
</script>
78-
79-
<style scoped>
80-
:deep(.minimized-overlay) {
81-
position: absolute;
82-
right: 2em;
83-
bottom: 2em;
84-
}
85-
86-
:deep(.minimized-video-container video) {
87-
max-width: 100%;
88-
max-height: 100%;
89-
}
90-
</style>

frontend/src/components/Playback/PlayerElement.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
crossorigin
1515
playsinline
1616
:loop="playbackManager.isRepeatingOnce"
17-
class="uno-h-full uno-max-h-100vh"
17+
class="uno-h-full uno-w-full"
1818
:class="{
1919
'uno-object-fill': playerElement.isStretched.value,
20-
'uno-w-screen': playerElement.isStretched.value
20+
'!uno-w-screen': playerElement.isStretched.value
2121
}"
2222
@loadeddata="onLoadedData">
2323
<track
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<template>
2+
<span
3+
v-bind="$attrs"
4+
aria-hidden
5+
class="uno-fixed uno-inset-0 uno-z-100"
6+
:class="[{
7+
'uno-opacity-0 uno-transition-opacity': scrim,
8+
'media-mouse:uno-bg-background media-mouse:uno-bg-opacity-50': !override && scrim
9+
}, ...(override ? override : [])]"
10+
@pointerenter="model = true"
11+
@pointerleave="model = false">
12+
<slot />
13+
</span>
14+
</template>
15+
16+
<script setup lang="ts">
17+
/**
18+
* @component - JOverlay
19+
* This component is used to create an overlay over the parent div.
20+
* By default, it will just provide a wrapper for rendering content over it.
21+
* If you want to darken on hover, please use the `scrim` prop.
22+
* By default, the theme's background color will be used, but if you pass
23+
* custom classes, yours will override the this.
24+
*/
25+
26+
// TODO: Extract transition duration to a global variable in UnoCSS preset
27+
28+
const { scrim } = defineProps<{
29+
/**
30+
* Whether to darken the overlay on hover
31+
*/
32+
scrim?: boolean;
33+
/**
34+
* Classes to override the scrim CSS
35+
*/
36+
override?: string;
37+
}>();
38+
const model = defineModel<boolean>({ default: false });
39+
</script>

frontend/src/pages/playback/video.vue

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@
66
:class="{ 'uno-cursor-none': !overlay }"
77
@mousemove="handleMouseMove"
88
@touchend="handleMouseMove">
9-
<VOverlay
10-
v-model="overlay"
11-
contained
12-
scrim="transparent"
13-
:close-on-back="false"
14-
width="100%"
15-
height="100%">
9+
<JOverlay v-show="overlay">
1610
<div
1711
class="d-flex flex-column align-center justify-space-between player-overlay">
1812
<div class="osd-top pt-s pl-s pr-s">
@@ -112,7 +106,7 @@
112106
</div>
113107
</div>
114108
</div>
115-
</VOverlay>
109+
</JOverlay>
116110
</div>
117111
</VMain>
118112
</template>

frontend/types/global/components.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ declare module 'vue' {
100100
JApp: typeof import('./../../src/components/lib/JApp.vue')['default']
101101
JHover: typeof import('./../../src/components/lib/JHover.vue')['default']
102102
JImg: typeof import('./../../src/components/lib/JImg.vue')['default']
103+
JOverlay: typeof import('./../../src/components/lib/JOverlay.vue')['default']
103104
JSafeHtml: typeof import('./../../src/components/lib/JSafeHtml.vue')['default']
104105
JSlot: typeof import('./../../src/components/lib/JSlot.vue')['default']
105106
JSplashscreen: typeof import('./../../src/components/lib/JSplashscreen.vue')['default']

0 commit comments

Comments
 (0)