Skip to content

feat: created TextArea component#23

Open
Kiru2115 wants to merge 13 commits intomainfrom
feat/TextArea
Open

feat: created TextArea component#23
Kiru2115 wants to merge 13 commits intomainfrom
feat/TextArea

Conversation

@Kiru2115
Copy link

@Kiru2115 Kiru2115 commented Feb 20, 2026

Changes

What has been done in this PR?

  • added characterLimitVisibility to provide multiple styles

  • added all TextArea variants

  • added stories.tsx

  • added test.tsx

How to test

Describe how to test the changes manually

  • yarn storybook
  • yarn test
  • ...

Checklist

Check if the code follows the standards

  • Follows front-end standards
  • No unused code / console.log / leftover comments
  • Component is exported in the main.ts file (if applicable)
  • Resolved merge conflicts (if applicable)
  • Added / updated unit tests (if applicable)
  • Added / updated storybook stories (if applicable)

- Added new props to TextArea for error handling, character limits, and helper text.
- Implemented a render function in stories to manage state and args.
- Created comprehensive tests for rendering, character limits, error states, and onChange behavior.
- Added export for the Textarea component to make it available for use in other parts of the application.
- Renamed the Textarea component to TextArea for consistency.
- Updated exports, stories, and tests to reflect the new naming convention.
- Enhanced the TextArea component with additional props and improved test coverage.
@prewendowski prewendowski linked an issue Feb 24, 2026 that may be closed by this pull request
@prewendowski
Copy link

Missclick

@prewendowski prewendowski reopened this Feb 24, 2026
Copy link
Contributor

@whit33y whit33y left a comment

Choose a reason for hiding this comment

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

Few bugs that I found right now. I will do further more accurate review later.

isRequired?: boolean;
isError?: boolean;
errorText?: string;
helper?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Story says:
helper: optional, React.ReactNode (so we can pass strings and react nodes).
So it cannot be string as we can pass "<a" for example.

{isRequired && <span className="text-red-500 ml-1 size-4">*</span>}
{""}
</p>
<textarea
Copy link
Contributor

Choose a reason for hiding this comment

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

We should pass isRequired here too I guess

variant?: TextAreaVariant;
value?: string;
onChange: (value: string) => void;
placeholder: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Story says:
placeholder optional

disabled: "text-gray-400",
};

export interface TextAreaProps {
Copy link
Contributor

Choose a reason for hiding this comment

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

Story says:
extend Props type with React.ComponentProps<"textarea"> so all the additional props will be passed!

disabled={isDisabled}
className={cn(
TextAreaVariants({
variant: isError ? "error" : "default",
Copy link
Contributor

Choose a reason for hiding this comment

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

Logical problem. Check what will happen if we pass disabled for example?

Copy link
Contributor

Choose a reason for hiding this comment

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

(issue, non-blocking, logic) - The "disabled" styling variant was never being applied

Suggested change
variant: isError ? "error" : "default",
variant: disabled
? "disabled"
: isError
? "error"
: variant || "default",

@prewendowski prewendowski changed the title Feat/text area feat: created TextArea component Feb 24, 2026
- Renamed `isDisabled` prop to `disabled` for consistency.
- Updated the TextArea component to accept `placeholder` as an optional prop.
- Adjusted related tests and stories to reflect the prop changes and ensure accurate rendering.
Copy link
Contributor

@whit33y whit33y left a comment

Choose a reason for hiding this comment

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

Here you have solution to problem with this React.Component props and few style bugs that I found.
Take a closer look in Figma and analyze all colors and fonts because I may have missed something.

disabled: "text-gray-400",
};

export interface TextAreaProps {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export interface TextAreaProps {
export interface TextAreaProps
extends Omit<React.ComponentProps<"textarea">, "onChange">


return (
<div>
<p className={cn("text-[16px]", labelVariants[variant ?? "default"])}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<p className={cn("text-[16px]", labelVariants[variant ?? "default"])}>
<p className={cn("font-bold", labelVariants[variant ?? "default"])}>

Default text size is 16px so this isn't necessary.

import { cn } from "@/lib/utils";

const TextAreaVariants = cva(
"px-3 py-2 w-[346px] h-[122px] text-gi-primary rounded-3xl h-30.5 ",
Copy link
Contributor

Choose a reason for hiding this comment

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

You added text-gi-primary here so its not necessary to add it separated to all variants underneath


type TextAreaVariant = VariantProps<typeof TextAreaVariants>["variant"];

const labelVariants: Record<string, string> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to specify rest of variant text-colors here beacuse in storybook hover color is black but in figma is text-gi-primary:

Image Image

…ling

- Added 'hover' and 'focus' variants to label styles for improved UI feedback.
- Updated TextAreaProps interface to extend textarea props more clearly.
- Changed label class to 'font-bold' for better emphasis.
@Kiru2115 Kiru2115 self-assigned this Feb 25, 2026
variant: {
default:
"text-gi-primary border-[1px] border-gi-primary/10 focus:ring-0 focus:outline-none",
hover:
Copy link
Member

Choose a reason for hiding this comment

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

issue(blocking): hover & focus are states, not variants, all variants should react on focus and hover

- Removed 'hover' and 'focus' variants from the TextArea component for a cleaner design.
- Updated story options to reflect the changes in available variants.
- Adjusted styling for default, disabled, and error states to enhance consistency.
- Changed expected label class from 'text-gray-400' to 'text-gi-primary/50' to align with recent styling updates.
- Simplified the variant selection logic to handle 'disabled' and 'error' states more clearly.
- Ensured that the default variant is applied when neither 'disabled' nor 'error' is active.
- Removed the variant prop from stories and tests, replacing it with direct usage of disabled and isError props.
- Updated the TextArea component to compute the variant based on the disabled and isError states for better clarity.
- Adjusted story args to include a default value and character limit visibility for enhanced usability.
- Added a 'helper' argType to the TextArea stories for improved prop handling.
- Updated story args to include a default helper text for better usability.
- Cleaned up formatting in the TextArea component for consistency.
@github-actions
Copy link

Coverage Report

Coverage after merging feat/TextArea into main will be:

Hit/ Total Coverage
🟰 Statements 36 / 36 100% 🥳
🌿 Branches 48 / 51 94.12% 🥳
🔢 Functions 9 / 9 100% 🥳
📝 Elements 93 / 96 96.88% 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextArea

4 participants