remove magic numbers
This commit is contained in:
parent
af9b8ac9bd
commit
a307e4d8b4
|
@ -3,6 +3,9 @@
|
||||||
import { FILE_TYPES } from "constants/backend"
|
import { FILE_TYPES } from "constants/backend"
|
||||||
import api from "builderStore/api"
|
import api from "builderStore/api"
|
||||||
|
|
||||||
|
const BYTES_IN_KB = 1000
|
||||||
|
const BYTES_IN_MB = 1000000
|
||||||
|
|
||||||
export let files = []
|
export let files = []
|
||||||
|
|
||||||
let selectedImageIdx = 0
|
let selectedImageIdx = 0
|
||||||
|
@ -90,9 +93,9 @@
|
||||||
<span class="filename">{selectedImage.name}</span>
|
<span class="filename">{selectedImage.name}</span>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
{#if selectedImage.size <= 1000000}
|
{#if selectedImage.size <= BYTES_IN_MB}
|
||||||
{selectedImage.size / 1000}KB
|
{selectedImage.size / BYTES_IN_KB}KB
|
||||||
{:else}{selectedImage.size / 1000000}MB{/if}
|
{:else}{selectedImage.size / BYTES_IN_MB}MB{/if}
|
||||||
</p>
|
</p>
|
||||||
</header>
|
</header>
|
||||||
<div class="delete-button" on:click={removeFile}>
|
<div class="delete-button" on:click={removeFile}>
|
||||||
|
|
Loading…
Reference in New Issue