Skip to content

Commit 49d4bd1

Browse files
committed
Update FileInputSelectedInfo
1 parent 6ff2f7f commit 49d4bd1

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

demo/App.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
<video src="#" style="background-color: aqua"> TEST </video>
44

55
<FileInput :state="state" :global-drop-zone="false">
6-
<!-- <FileInputSelectedInfo :state="state"/>-->
6+
<FileInputSelectedInfo :state="state"/>
77
</FileInput>
88

99
<div class="files">
1010
<div>Files:</div>
1111
<div v-for="e of state.fileEntries.value">{{e.name}} — {{formatSizeWinLike(e.size)}}</div>
1212
</div>
13+
14+
<a class="readme" title="Open Readme" href="https://github.com/AlttiRi/vue-file-input" target="_blank"><i>i</i></a>
1315
</template>
1416

1517
<script setup>
@@ -27,4 +29,14 @@ globalThis.state = state;
2729
.files {
2830
padding: 6px 0;
2931
}
32+
33+
.readme {
34+
position: fixed;
35+
bottom: 0;
36+
right: 0;
37+
padding: 2px 8px;
38+
margin: 1px;
39+
color: darkgray;
40+
text-decoration: none;
41+
}
3042
</style>

src/components/FileInput.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,14 @@ function onKeyDown(event: KeyboardEvent) {
231231
.file-input-hover-modal.drop-hover {
232232
opacity: 1;
233233
}
234+
235+
label {
236+
display: flex;
237+
width: 100%;
238+
height: 100%;
239+
}
240+
[tabindex]:focus {
241+
outline: none;
242+
box-shadow: 0 0 2px grey;
243+
}
234244
</style>

src/components/FileInputSelectedInfo.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<template>
2+
<span data-component="FileInputSelectedInfo">
23
<span class="file-info" v-if="file">
34
<span class="file-name" :title="file.name">{{file.name}}</span>
45
<span class="file-size" :title="file.size.toString()">{{bytesToSizeWinLike(file.size)}}</span>
56
<span class="file-mtime" v-if="file.mtime">{{dateToDayDateTimeString(file.mtime, false)}}</span>
67
</span>
8+
<span v-else>No file selected</span>
9+
</span>
710
</template>
811

912
<script setup lang="ts">

0 commit comments

Comments
 (0)