Improved styling of the version file upload button (#492)

* Update SmartFileInput to be styled like the other file input

* Fix gallery upload layout
This commit is contained in:
Prospector
2022-05-23 21:40:17 -07:00
committed by GitHub
parent d31a920eb7
commit bebdfc259c
4 changed files with 45 additions and 19 deletions

View File

@@ -1,8 +1,10 @@
<template> <template>
<div class="columns"> <div class="columns">
<label class="iconified-button" @drop.prevent="addFile" @dragover.prevent> <label class="button" @drop.prevent="addFile" @dragover.prevent>
<UploadIcon /> <span>
{{ prompt }} <UploadIcon />
{{ prompt }}
</span>
<input <input
type="file" type="file"
:multiple="multiple" :multiple="multiple"
@@ -67,6 +69,27 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
label { label {
cursor: pointer; cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
padding: var(--spacing-card-sm) var(--spacing-card-md);
margin-bottom: var(--spacing-card-sm);
}
span {
display: flex;
align-items: center;
justify-content: center;
text-align: center;
gap: 0.5rem;
border: 2px dashed var(--color-divider-dark);
border-radius: var(--size-rounded-control);
padding: var(--spacing-card-md) var(--spacing-card-lg);
svg {
height: 1.25rem;
}
} }
input { input {

View File

@@ -213,19 +213,21 @@
</div> </div>
</div> </div>
<div class="gallery-bottom"> <div class="gallery-bottom">
<SmartFileInput
accept="image/png,image/jpeg,image/gif,image/webp,.png,.jpeg,.gif,.webp"
prompt="Choose image or drag it here"
@change="(files) => showPreviewImage(files, index)"
/>
<div class="gallery-buttons"> <div class="gallery-buttons">
<SmartFileInput <div class="delete-button-container">
accept="image/png,image/jpeg,image/gif,image/webp,.png,.jpeg,.gif,.webp" <button
prompt="Upload" class="iconified-button"
@change="(files) => showPreviewImage(files, index)" @click="newGalleryItems.splice(index, 1)"
/> >
<button <TrashIcon />
class="iconified-button" Delete
@click="newGalleryItems.splice(index, 1)" </button>
> </div>
<TrashIcon />
Delete
</button>
</div> </div>
</div> </div>
</div> </div>
@@ -609,11 +611,11 @@ export default {
} }
.textarea-wrapper { .textarea-wrapper {
width: 14rem; width: 100%;
} }
input { input {
width: calc(14rem - 2rem - 4px); width: calc(100% - 2rem - 4px);
margin: 0 0 0.25rem; margin: 0 0 0.25rem;
} }

View File

@@ -486,8 +486,9 @@
<SmartFileInput <SmartFileInput
v-if="mode === 'edit' || mode === 'create'" v-if="mode === 'edit' || mode === 'create'"
multiple multiple
class="choose-files"
accept=".jar,application/java-archive,.zip,application/zip,.mrpack" accept=".jar,application/java-archive,.zip,application/zip,.mrpack"
prompt="Upload files" prompt="Choose files or drag them here"
@change="(x) => x.forEach((y) => newFiles.push(y))" @change="(x) => x.forEach((y) => newFiles.push(y))"
/> />
</section> </section>

View File

@@ -467,7 +467,7 @@
class="file-input" class="file-input"
multiple multiple
accept=".jar,application/java-archive,.zip,application/zip,.mrpack" accept=".jar,application/java-archive,.zip,application/zip,.mrpack"
prompt="Upload files" prompt="Choose files or drag them here"
@change=" @change="
(x) => (x) =>
x.forEach((y) => versions[currentVersionIndex].files.push(y)) x.forEach((y) => versions[currentVersionIndex].files.push(y))