From 4f40d5f0a53449688f6d4f491849a1424bfb0015 Mon Sep 17 00:00:00 2001 From: zuramai Date: Mon, 4 Dec 2023 10:37:41 +0700 Subject: [PATCH] feat(component): textarea filled and disabled --- packages/forms/src/lib/textarea/index.tsx | 29 ++++++++++++------- .../forms/src/stories/Textarea.stories.tsx | 11 +++++++ 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/packages/forms/src/lib/textarea/index.tsx b/packages/forms/src/lib/textarea/index.tsx index 66bd677..7b5491d 100644 --- a/packages/forms/src/lib/textarea/index.tsx +++ b/packages/forms/src/lib/textarea/index.tsx @@ -9,7 +9,8 @@ export interface TextareaProps extends React.TextareaHTMLAttributes = ({ name, placeholder, disabled = false, + filled=true, leftSection, rightSection, ...props }) => { - const variantMap: Record = { + const variantMap: Record = { error: { - input: 'bg-red-50 focus:bg-white border-red-300 focus:border-red-400 focus:ring-red-100', + input: 'bg-red-50 focus:bg-white border-red-300 focus:border-red-500', + filled: 'bg-red-50', description: 'text-red-500', }, default: { - input: 'border-gray-300 focus:bg-white hover:border-gray-900 focus:border-gray-400 focus:ring-gray-300', + input: 'border-gray-300 focus:bg-white hover:border-gray-900 focus:border-gray-500', + filled: 'bg-gray-100', description: 'text-zinc-500', }, success: { - input: 'bg-green-50 focus:bg-white border-green-300 hover:border-green-900 focus:border-green-400 focus:ring-green-100', + input: 'bg-green-50 focus:bg-white border-green-300 hover:border-green-900 focus:border-green-500', + filled: 'bg-green-50', description: 'text-green-500', }, warning: { - input: 'bg-orange-50 focus:bg-white border-orange-300 hover:border-orange-900 focus:border-orange-400 focus:ring-orange-100', + input: 'bg-orange-50 focus:bg-white border-orange-300 hover:border-orange-900 focus:border-orange-500', + filled: 'bg-orange-50', description: 'text-orange-500', }, } const classes = variantMap[variant] const inputClasses = `transition duration-200 placeholder:text-gray-400 - rounded-lg focus:ring-4 text-gray-900 py-2.5 px-3.5 w-80 max-w-full - disabled:bg-neutral-100 + focus:ring-0 disabled:border-gray-200 + disabled:bg-transparent disabled:cursor-not-allowed ${classes.input} ${leftSection ? 'pl-14' : ''} ${rightSection ? 'pr-14' : ''} + ${filled ? 'border-0 border-b rounded-none' + classes.filled : 'border rounded-lg'} ` return ( -
+
{ label && (
@@ -71,9 +78,9 @@ export const Textarea: React.FC = ({ { leftSection } )} -