Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Textarea props #305

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions docs/components/textarea.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ const message = ref('')
```vue
<template>
<div>
<fwb-textarea
v-model="message"
label="Your message"
placeholder="Write your message..."
max-length="20"
min-length="10"
/>
<fwb-textarea
v-model="message"
label="Your message"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<fwb-textarea
v-model="message"
label="Textarea with minlength 10 and maxlength 20"
minlength="10"
maxlength="20"
min-length="10"
max-length="20"
required
/>
<fwb-textarea
Expand Down
3 changes: 2 additions & 1 deletion src/components/FwbFileInput/FwbFileInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
</div>
<div
v-else
class="flex items-center justify-center"
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
Expand Down
6 changes: 6 additions & 0 deletions src/components/FwbTextarea/FwbTextarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
:class="textareaClasses"
:rows="rows"
:placeholder="placeholder"
:maxlength="maxLength"
:minlength="minLength"
/>
<span
v-if="$slots.footer"
Expand All @@ -29,6 +31,8 @@ interface TextareaProps {
rows?: number
custom?: boolean
placeholder?: string
maxLength?: number,
minLength?: number,
}

defineOptions({
Expand All @@ -41,6 +45,8 @@ const props = withDefaults(defineProps<TextareaProps>(), {
rows: 4,
custom: false,
placeholder: 'Write your message here...',
maxLength: 10000,
minLength: 0,
})

const emit = defineEmits(['update:modelValue'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { simplifyTailwindClasses } from '@/utils/simplifyTailwindClasses'
import { computed } from 'vue'

const textareaWrapperClasses = 'block w-full mb-4 border border-gray-200 rounded-lg bg-gray-50 dark:bg-gray-700 dark:border-gray-600'
const textareaDefaultClasses = 'block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-200 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500'
const textareaDefaultClasses = 'block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-200 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 disabled:cursor-not-allowed disabled:opacity-50'
const textareaLabelClasses = 'block mb-2 text-sm font-medium text-gray-900 dark:text-white'
const textareaFooterClasses = 'block py-2 px-3 border-gray-200 dark:border-gray-600'

Expand Down