Skip to content
Snippets Groups Projects
Commit 5546dab0 authored by Edward Alexander Jaya's avatar Edward Alexander Jaya
Browse files

Change dropdown styling

parent d4e3ba48
Branches
3 merge requests!40Release First Version,!38Hotfix,!21Add dockerize
Pipeline #24536 passed with stage
in 45 seconds
<template> <template>
<div :key="dataReady"> <div :key="dataReady">
<vue-dropdown <b-dropdown :text="dataset">
ref="dropdown" <b-dropdown-item
class="dropdown" v-for="(item, idx) in config.options" :key="idx"
:config="config" @click.native="setNewSelectedOption(item)"
@setSelectedOption="setNewSelectedOption($event)" >
/> {{ item.value }}
</b-dropdown-item>
</b-dropdown>
</div> </div>
</template> </template>
...@@ -25,13 +27,8 @@ export default { ...@@ -25,13 +27,8 @@ export default {
return { return {
config: { config: {
options: [], options: [],
width: 200,
placeholder: "Choose folder",
backgroundColor: "white",
textColor: "#1E889B",
border: ""
}, },
folder: [], dataset: '',
dataReady: false dataReady: false
} }
}, },
...@@ -42,6 +39,18 @@ export default { ...@@ -42,6 +39,18 @@ export default {
}) })
} }
await this.getOptions() await this.getOptions()
if (this.dropdownValue) {
this.dataset = this.dropdownValue
} else {
this.dataset = "Choose Folder"
console.log("Dataset: ", this.dataset)
if (!this.isFolderNotExist()) {
if (!this.isUpload) {
this.dataset = this.config.options[0].value
}
}
this.$emit("onDatasetChanged", this.dataset)
}
this.dataReady = true this.dataReady = true
}, },
methods: { methods: {
...@@ -58,19 +67,6 @@ export default { ...@@ -58,19 +67,6 @@ export default {
}) })
} }
} }
if (this.dropdownValue) {
this.config.placeholder = this.dropdownValue
} else {
if (!this.isFolderNotExist()) {
if (this.isUpload) {
this.config.placeholder = this.config.options[1].value
} else {
this.config.placeholder = this.config.options[0].value
}
this.dataset = this.config.placeholder
this.$emit("onDatasetChanged", this.dataset)
}
}
}, },
isFolderNotExist () { isFolderNotExist () {
if (this.isUpload) { if (this.isUpload) {
...@@ -80,7 +76,6 @@ export default { ...@@ -80,7 +76,6 @@ export default {
} }
}, },
async setNewSelectedOption(selectedOption) { async setNewSelectedOption(selectedOption) {
this.config.placeholder = selectedOption.value
this.dataset = selectedOption.value this.dataset = selectedOption.value
if (this.dataset === "Add New Folder") { if (this.dataset === "Add New Folder") {
this.createNewFolder() this.createNewFolder()
...@@ -89,29 +84,36 @@ export default { ...@@ -89,29 +84,36 @@ export default {
}, },
createNewFolder() { createNewFolder() {
this.$swal.fire({ this.$swal.fire({
title: "New folder name", title: "New folder name: ",
input:'text', input:'text',
inputValidator: (value) => { inputValidator: (value) => {
if (!value) { if (!value) {
return 'You need to write something!' return 'You need to write something!'
} else { } else {
this.config.placeholder = value
this.dataset = value this.dataset = value
this.$emit("onDatasetChanged", this.dataset) this.$emit("onDatasetChanged", this.dataset)
} }
}, },
confirmButtonColor: '#11616F', confirmButtonColor: '#11616F',
showCancelButton: true showCancelButton: true
}) }).then((result) => {
console.log("Result: ", result)
if (!result.value) {
this.dataset = "Choose Folder"
console.log("Dataset: ", this.dataset)
}
})
}, },
} }
} }
</script> </script>
<style scoped> <style>
.dropdown { .dropdown .btn {
-webkit-box-shadow: 2px 5px 5px 0px rgba(0,0,0,0.15); background-color: #1E889B;
-moz-box-shadow: 2px 5px 5px 0px rgba(0,0,0,0.15); color: white;
box-shadow: 2px 5px 5px 0px rgba(0,0,0,0.15); font-family: "Open Sans Bold";
border: 0;
border-radius: 7px;
} }
</style> </style>
\ No newline at end of file
...@@ -2,24 +2,11 @@ ...@@ -2,24 +2,11 @@
<div class="col"> <div class="col">
<div class="ml-4"> <div class="ml-4">
<div class="row"> <div class="row">
<div class="col">
<h5 class="title users-margin">
{{ title }}
</h5>
</div>
</div>
<br>
<div class="row form-title-margin">
<div class="col"> <div class="col">
<div class="flex-display"> <div class="flex-display">
<input <h5 class="title users-margin">
id="imagesID" {{ title }}
type="text" </h5>
class="form-control form-border field-length form-content"
placeholder="Search for file name..."
name="imagesID"
@input="debounceWrapper"
>
<div class="slot-margin"> <div class="slot-margin">
<slot /> <slot />
</div> </div>
...@@ -27,6 +14,19 @@ ...@@ -27,6 +14,19 @@
</div> </div>
</div> </div>
<br> <br>
<div class="row form-title-margin">
<div class="col">
<input
id="imagesID"
type="text"
class="form-control form-border field-length form-content"
placeholder="Search for file name..."
name="imagesID"
@input="debounceWrapper"
>
</div>
</div>
<br>
<b-row v-if="images" :key="updateUI"> <b-row v-if="images" :key="updateUI">
<b-col v-for="id in Object.keys(images)" :key="id"> <b-col v-for="id in Object.keys(images)" :key="id">
<div id="container"> <div id="container">
...@@ -242,8 +242,8 @@ export default { ...@@ -242,8 +242,8 @@ export default {
} }
.slot-margin { .slot-margin {
margin-left: 1.5rem; margin-left: 2.25rem;
margin-top: -0.15rem; margin-top: 3.25rem;
} }
.flex-display { .flex-display {
......
...@@ -175,7 +175,7 @@ export default { ...@@ -175,7 +175,7 @@ export default {
.margin-dropdown { .margin-dropdown {
margin-top: 3.5rem; margin-top: 3.5rem;
margin-left: -0.775rem; margin-left: -0.1rem;
} }
</style> </style>
\ No newline at end of file
...@@ -208,7 +208,7 @@ export default { ...@@ -208,7 +208,7 @@ export default {
}, },
async handleUpload(){ async handleUpload(){
this.files = this.$refs.myDropzone.getAcceptedFiles() this.files = this.$refs.myDropzone.getAcceptedFiles()
if (!this.dataset) { if (!this.dataset || this.dataset === "Choose Folder") {
this.invalidFolder() this.invalidFolder()
} else { } else {
if(this.files.length === 0){ if(this.files.length === 0){
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment