Skip to content

Commit 45d519e

Browse files
committed
Use FileInputDefaultHoverModal
1 parent d114bcb commit 45d519e

File tree

2 files changed

+40
-19
lines changed

2 files changed

+40
-19
lines changed

src/components/FileInput.vue

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import {
33
ref, toRefs, onMounted, computed, onBeforeUnmount, watchEffect,
44
Ref, ComputedRef
55
} from "vue";
6-
import FileInputDefault from "./FileInputDefault.vue";
6+
import FileInputDefault from "./FileInputDefault.vue";
7+
import FileInputDefaultHoverModal from "./FileInputDefaultHoverModal.vue";
78
import {FileInputState, HTMLFileInputElement} from "../index.ts";
89
910
@@ -169,7 +170,6 @@ function onKeyDown(event: KeyboardEvent) {
169170
:accept="accept"
170171
:multiple="multiple"
171172
@change="onFileInputChange"
172-
style="display: none"
173173
:nwdirectory="nwdirectory"
174174
ref="templateInputElem"
175175
>
@@ -179,7 +179,7 @@ function onKeyDown(event: KeyboardEvent) {
179179
</label>
180180
<teleport to="body">
181181
<slot name="modal">
182-
<div class="file-input-hover-modal" :class="{'drop-hover': dropHover}"></div>
182+
<FileInputDefaultHoverModal :state="state"/>
183183
</slot>
184184
</teleport>
185185
</div>
@@ -195,6 +195,10 @@ function onKeyDown(event: KeyboardEvent) {
195195
</style>
196196

197197
<style scoped>
198+
input {
199+
display: none;
200+
}
201+
198202
.file-input {
199203
width: 100%;
200204
height: 100%;
@@ -216,22 +220,6 @@ function onKeyDown(event: KeyboardEvent) {
216220
background-color: var(--drop-active);
217221
}
218222
219-
.file-input-hover-modal {
220-
height: 50px;
221-
width: 100%;
222-
position: fixed;
223-
bottom: 0;
224-
left: 0;
225-
pointer-events: none;
226-
background-image: linear-gradient(to top, rgba(0,0,0,0.15), rgba(0,0,0,0.005));
227-
228-
transition: opacity 0.25s ease-out;
229-
opacity: 0;
230-
}
231-
.file-input-hover-modal.drop-hover {
232-
opacity: 1;
233-
}
234-
235223
label {
236224
display: flex;
237225
place-content: center;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<script setup lang="ts">
2+
import {FileInputState} from "./file-input-state.ts";
3+
4+
defineProps<{
5+
state: FileInputState,
6+
}>();
7+
</script>
8+
9+
<template>
10+
<div
11+
data-component="FileInputDefaultHoverModal"
12+
class="file-input-hover-modal"
13+
:class="{'drop-hover': state.private.dropHover.value}"
14+
></div>
15+
</template>
16+
17+
<style scoped>
18+
.file-input-hover-modal {
19+
height: 50px;
20+
width: 100%;
21+
position: fixed;
22+
bottom: 0;
23+
left: 0;
24+
pointer-events: none;
25+
background-image: linear-gradient(to top, rgba(0,0,0,0.15), rgba(0,0,0,0.005));
26+
27+
transition: opacity 0.25s ease-out;
28+
opacity: 0;
29+
}
30+
.file-input-hover-modal.drop-hover {
31+
opacity: 1;
32+
}
33+
</style>

0 commit comments

Comments
 (0)