mirror of
https://github.com/aljazceru/landscape-template.git
synced 2025-12-17 22:34:21 +01:00
feat: create new TextInput & TextareaInput components, create error state for inputs
This commit is contained in:
27
src/Components/Inputs/TextareaInput/TextareaInput.tsx
Normal file
27
src/Components/Inputs/TextareaInput/TextareaInput.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import React from "react";
|
||||
|
||||
type Props = {
|
||||
isError?: boolean;
|
||||
className?: string;
|
||||
inputClass?: string
|
||||
} & React.ComponentPropsWithoutRef<'textarea'>
|
||||
|
||||
export default React.forwardRef<HTMLTextAreaElement, Props>(function TextareaInput({ className, inputClass, isError, ...props }, ref) {
|
||||
|
||||
return (
|
||||
<div className={`
|
||||
relative w-full border bg-white rounded-12 flex
|
||||
focus-within:ring focus-within:ring-opacity-50
|
||||
${isError ?
|
||||
"border-red-300 focus-within:border-red-300 focus-within:outline-red-400 focus-within:ring-red-200"
|
||||
:
|
||||
"border-gray-300 focus-within:border-primary-300 focus-within:outline-primary-400 focus-within:ring-primary-200"}
|
||||
${className}`}>
|
||||
<textarea
|
||||
className={`input-text ${inputClass}`}
|
||||
ref={ref}
|
||||
{...props}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
Reference in New Issue
Block a user