Skip to content

Beautiful Open-Source Form Builder

Enhance file input components with disabled state (#844)

Chirag Chhatrala80bd0ac5ae60
diff --git a/client/components/forms/heavy/FileInput.vue b/client/components/forms/heavy/FileInput.vue
index e31aeaf28..5a90a1572 100644
--- a/client/components/forms/heavy/FileInput.vue
+++ b/client/components/forms/heavy/FileInput.vue
@@ -76,6 +76,7 @@
:key="file.url"
:file="file"
:theme="theme"
+ :disabled="disabled"
@remove="clearFile(file)"
/>
</div>
diff --git a/client/components/forms/heavy/SignatureInput.vue b/client/components/forms/heavy/SignatureInput.vue
index 4f49988b1..266a8d53d 100644
--- a/client/components/forms/heavy/SignatureInput.vue
+++ b/client/components/forms/heavy/SignatureInput.vue
@@ -36,6 +36,7 @@
:file="file"
:theme="theme"
:show-remove="false"
+ :disabled="disabled"
/>
</div>
diff --git a/client/components/forms/heavy/components/UploadedFile.vue b/client/components/forms/heavy/components/UploadedFile.vue
index cc57121ff..da0daf42f 100644
--- a/client/components/forms/heavy/components/UploadedFile.vue
+++ b/client/components/forms/heavy/components/UploadedFile.vue
@@ -1,6 +1,10 @@
<template>
<div
- :class="[theme.fileInput.uploadedFile, 'overflow-hidden']"
+ class="overflow-hidden"
+ :class="[
+ theme.fileInput.uploadedFile,
+ { 'bg-white': !disabled, 'bg-gray-300': disabled }
+ ]"
:title="file.file.name"
>
<div
@@ -37,7 +41,7 @@
{{ file.file.name }}
</p>
<a
- v-if="showRemove"
+ v-if="showRemove && !disabled"
href="javascript:void(0);"
class="flex text-neutral-400 rounded-sm hover:bg-neutral-50 hover:text-red-500 dark:text-neutral-600 p-1"
role="button"
@@ -71,6 +75,7 @@ export default {
props: {
file: { type: Object, default: null },
+ disabled: { type: Boolean, default: false },
showRemove: { type: Boolean, default: true },
theme: {
type: Object, default: () => {
diff --git a/client/lib/forms/themes/form-themes.js b/client/lib/forms/themes/form-themes.js
index cba8a8283..7ce2bd4c4 100644
--- a/client/lib/forms/themes/form-themes.js
+++ b/client/lib/forms/themes/form-themes.js
@@ -165,7 +165,7 @@
dark: 'bg-notion-dark-light'
},
uploadedFile:
- 'border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-notion-dark-light rounded-lg shadow-xs max-w-10'
+ 'border border-neutral-300 dark:border-neutral-600 dark:bg-notion-dark-light rounded-lg shadow-xs max-w-10'
},
SignatureInput: {
minHeight: {
@@ -337,7 +337,7 @@
dark: 'bg-notion-dark-light'
},
uploadedFile:
- 'border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-notion-dark-light shadow-xs max-w-10'
+ 'border border-neutral-300 dark:border-neutral-600 dark:bg-notion-dark-light shadow-xs max-w-10'
},
SignatureInput: {
minHeight: {
@@ -515,7 +515,7 @@
dark: 'bg-notion-dark-light'
},
uploadedFile:
- 'border border-notion-input-border dark:border-notion-input-borderDark bg-white dark:bg-notion-dark-light rounded-xs max-w-10 focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent'
+ 'border border-notion-input-border dark:border-notion-input-borderDark dark:bg-notion-dark-light rounded-xs max-w-10 focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent'
},
SignatureInput: {
minHeight: {