Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 10 additions & 38 deletions src/components/FwbFileInput/FwbFileInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,15 @@
<div v-if="!dropzone">
<label>
<span :class="labelClasses">{{ label }}</span>
<input
:class="fileInpClasses"
:multiple="multiple"
type="file"
:accept="accept"
@change="handleChange"
>
<input :class="fileInpClasses" :multiple="multiple" type="file" :accept="accept" @change="handleChange" />
</label>
<slot />
</div>
<div
v-else
class="flex items-center justify-center"
@change="handleChange"
@dragover="dragOverHandler"
@drop="dropFileHandler"
>
<div v-else class="flex flex-col items-start justify-center" @change="handleChange" @dragover="dragOverHandler" @drop="dropFileHandler">
<span v-if="label !== ''" :class="labelClasses">{{ label }}</span>
<label :class="dropzoneLabelClasses">
<div :class="dropzoneWrapClasses">
<svg
aria-hidden="true"
class="w-8 h-8 text-gray-500 dark:text-gray-400"
fill="none"
viewBox="0 0 20 16"
xmlns="http://www.w3.org/2000/svg"
>
<svg aria-hidden="true" class="w-8 h-8 text-gray-500 dark:text-gray-400" fill="none" viewBox="0 0 20 16" xmlns="http://www.w3.org/2000/svg">
<path
d="M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"
stroke-linecap="round"
Expand All @@ -46,12 +29,7 @@
</div>
<p v-else>File: {{ dropZoneText }}</p>
</div>
<input
:multiple="multiple"
type="file"
:accept="accept"
class="hidden"
>
<input :multiple="multiple" type="file" :accept="accept" class="hidden" />
</label>
</div>
</div>
Expand All @@ -67,8 +45,8 @@ interface FileInputProps {
label?: string
modelValue?: File | File[] | null
multiple?: boolean
size?: string,
accept?:string,
size?: string
accept?: string
}

const props = withDefaults(defineProps<FileInputProps>(), {
Expand Down Expand Up @@ -96,10 +74,10 @@ const dropZoneText = computed(() => {

const emit = defineEmits(['update:modelValue'])
const model = computed({
get () {
get() {
return props.modelValue
},
set (val) {
set(val) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add missing spaces before function parentheses.

There should be a space before the function parentheses for consistency and readability.

- get() {
+ get () {
- set(val) {
+ set (val) {
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
get() {
return props.modelValue
},
set (val) {
set(val) {
get () {
return props.modelValue
},
set (val) {
Tools
GitHub Check: lint (18.x)

[failure] 77-77:
Missing space before function parentheses


[failure] 80-80:
Missing space before function parentheses

emit('update:modelValue', val)
},
})
Expand Down Expand Up @@ -138,11 +116,5 @@ const dragOverHandler = (event: Event) => {
event.preventDefault()
}

const {
fileInpClasses,
labelClasses,
dropzoneLabelClasses,
dropzoneWrapClasses,
dropzoneTextClasses,
} = useFileInputClasses(props.size)
const { fileInpClasses, labelClasses, dropzoneLabelClasses, dropzoneWrapClasses, dropzoneTextClasses } = useFileInputClasses(props.size)
</script>