summaryrefslogtreecommitdiff
path: root/src/lib/FileList.svelte
blob: ad0648f7538b7c3b2802a10d6c00e41c52799a65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<script>
  export let title;
  export let files = [];
  export let isError = false;
</script>

{#if files.length !== 0}
  <div id="selected-files-container">
    <h2>{title}:</h2>
    {#each Array.from(files) as file}
      <div id={isError ? "selected-file-card-error" : "selected-file-card"}>
        <p>{file.name} ({file.size / 1000} kb)</p>
      </div>
    {/each}
  </div>
{/if}

<style>
  #selected-file-card {
    border: 1px solid #000;
    width: 500px;
    padding-left: 15px;
    margin-top: 10px;
  }

  #selected-file-card-error {
    border: 1px solid red;
    width: 500px;
    padding-left: 15px;
    margin-top: 10px;
    color: red;
  }

  @media only screen and (max-device-width: 812px) {
    #selected-files-container,
    #selected-file-card-error {
      width: 100%;
    }

    #selected-file-card {
      width: 100%;
    }
  }
</style>