Line | |
---|
1 | <script>
|
---|
2 | import { mapState } from "vuex";
|
---|
3 | import MacronRestorationService from "../js/MacronRestorationModule"
|
---|
4 | import FileUpload from "./FileUpload.vue"
|
---|
5 |
|
---|
6 | const macronRestorer = new MacronRestorationService();
|
---|
7 |
|
---|
8 | export default {
|
---|
9 | name: "FileInput",
|
---|
10 | components: {
|
---|
11 | FileUpload
|
---|
12 | },
|
---|
13 | computed: {
|
---|
14 | ...mapState({
|
---|
15 | translations: state => state.translations,
|
---|
16 | fileInfos: state => state.macronisedFileInfos
|
---|
17 | })
|
---|
18 | },
|
---|
19 | methods: {
|
---|
20 | buildDownloadUrl(fileInfo) {
|
---|
21 | return macronRestorer.buildDownloadUrl(fileInfo.filePath, fileInfo.fileName);
|
---|
22 | }
|
---|
23 | }
|
---|
24 | }
|
---|
25 | </script>
|
---|
26 |
|
---|
27 | <template>
|
---|
28 | <file-upload />
|
---|
29 |
|
---|
30 | <div class="file-info-list">
|
---|
31 | <div v-for="(fileInfo, index) in fileInfos" :key="fileInfo.id">
|
---|
32 | <div class="info-container">
|
---|
33 | <img class="icon-l" src="../assets/word_icon.webp" v-if="fileInfo.fileType === '.docx'" />
|
---|
34 | <img class="icon-l" src="../assets/powerpoint_icon.webp" v-else-if="fileInfo.fileType === '.pptx'" />
|
---|
35 | <img class="icon-l" src="../assets/excel_icon.webp" v-else-if="fileInfo.fileType === '.xlsx'" />
|
---|
36 | <span class="material-icons mdi-override" v-else>description</span>
|
---|
37 |
|
---|
38 | {{ fileInfo.fileName }}
|
---|
39 |
|
---|
40 | <a class="btn-primary theme-flat" :href="buildDownloadUrl(fileInfo)" download>
|
---|
41 | <span class="material-icons">download</span>
|
---|
42 | <span>{{ translations.get("FileInput_Download") }}</span>
|
---|
43 | </a>
|
---|
44 | </div>
|
---|
45 |
|
---|
46 | <hr class="divider-s" v-if="index !== fileInfos.length - 1" />
|
---|
47 | </div>
|
---|
48 | </div>
|
---|
49 |
|
---|
50 | </template>
|
---|
51 |
|
---|
52 | <style scoped lang="scss">
|
---|
53 | .info-container {
|
---|
54 | display: grid;
|
---|
55 | grid-template-columns: auto 1fr auto;
|
---|
56 | align-items: center;
|
---|
57 |
|
---|
58 | gap: 0.5em;
|
---|
59 | padding: 0.5em;
|
---|
60 | transition-duration: var(--transition-duration);
|
---|
61 |
|
---|
62 | &:hover {
|
---|
63 | background-color: #DDD;
|
---|
64 | }
|
---|
65 | }
|
---|
66 |
|
---|
67 | .file-info-list {
|
---|
68 | border: 1px solid #BBB;
|
---|
69 | margin-top: 1em;
|
---|
70 | }
|
---|
71 |
|
---|
72 | .mdi-override {
|
---|
73 | @extend .mdi-l;
|
---|
74 |
|
---|
75 | color: var(--bg-color);
|
---|
76 | }
|
---|
77 |
|
---|
78 | .icon-l {
|
---|
79 | height: 36px;
|
---|
80 | }
|
---|
81 | </style>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.