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 component #266

Merged
merged 3 commits into from
Jun 26, 2024
Merged

TextArea component #266

merged 3 commits into from
Jun 26, 2024

Conversation

kotAPI
Copy link
Collaborator

@kotAPI kotAPI commented Feb 25, 2024

Summary by CodeRabbit

  • New Features
    • Enhanced the TextArea component with customizable options for improved user interface and input experience.
    • Added new properties to the TextArea component for applying custom classes, enabling more flexible styling options.
  • Style
    • Implemented custom styling for the TextArea component, including visual property adjustments and a focus style for better aesthetics.

@kotAPI kotAPI linked an issue Feb 25, 2024 that may be closed by this pull request
Copy link
Contributor

coderabbitai bot commented Feb 25, 2024

Walkthrough

The update introduces enhanced customization for the TextArea component within a UI library. It involves adding new properties for class customization, integrating these changes into the component's TypeScript file, and establishing a dedicated SCSS file for styling. Additionally, a story for the TextArea component is created in Storybook to demonstrate its capabilities, all while ensuring the new styles are incorporated into the project's default theme.

Changes

Files Change Summary
.../TextArea/TextArea.tsx Updates to accept customRootClass and className props, includes customClassSwitcher usage.
.../TextArea/shards/TextAreaInput.tsx Introduces TextAreaInput component for rendering textarea with placeholder text.
.../TextArea/shards/TextAreaRoot.tsx Defines TextAreaRoot as root element for text area component with custom styling.
styles/themes/components/textarea.scss Introduces styling for the TextArea component.
styles/themes/default.scss Adds import for textarea.scss to include in the default theme.

🐇✨
In a field of code, under a sky so wide,
A TextArea blooms, with styles anew.
Custom classes dance, in a seamless glance,
A rabbit hops through, admiring the view.
With every line of code, our story's told,
In this digital burrow, where creativity unfolds.
🌼📝✨

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

codecov bot commented Feb 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.64%. Comparing base (1a8aea8) to head (6d5b74d).
Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #266   +/-   ##
=======================================
  Coverage   94.64%   94.64%           
=======================================
  Files          10       10           
  Lines          56       56           
  Branches        9        9           
=======================================
  Hits           53       53           
  Misses          3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 7faf1ee and 69890d5.
Files selected for processing (4)
  • src/components/ui/TextArea/TextArea.stories.js (1 hunks)
  • src/components/ui/TextArea/TextArea.tsx (1 hunks)
  • styles/themes/components/textarea.scss (1 hunks)
  • styles/themes/default.scss (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/components/ui/TextArea/TextArea.stories.js
Additional comments: 2
src/components/ui/TextArea/TextArea.tsx (1)
  • 4-18: The introduction of customRootClass and className props, along with the use of the customClassSwitcher function, enhances the TextArea component's flexibility and styling capabilities. Ensure that the customClassSwitcher function is well-documented and thoroughly tested to maintain code quality and ease of use.
styles/themes/default.scss (1)
  • 15-15: The addition of the textarea.scss import statement correctly integrates the TextArea component's custom styling into the application's default theme. This ensures consistency and maintainability of the UI library's styling.

styles/themes/components/textarea.scss Outdated Show resolved Hide resolved
Copy link

watermelon-copilot-for-code-review bot commented Mar 2, 2024

Watermelon AI Summary

This Pull Request introduces a new, enhanced TextArea component to the project, complete with customizable styles, improved aesthetics, additional subcomponents for structure, and options for an enriched input experience.

GitHub PRs

ui is an open repo and Watermelon will serve it for free.
🍉🫶

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 69890d5 and 68857a0.
Files selected for processing (4)
  • src/components/ui/TextArea/TextArea.tsx (1 hunks)
  • src/components/ui/TextArea/shards/TextAreaInput.tsx (1 hunks)
  • src/components/ui/TextArea/shards/TextAreaRoot.tsx (1 hunks)
  • styles/themes/components/textarea.scss (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/components/ui/TextArea/shards/TextAreaRoot.tsx
Files skipped from review as they are similar to previous changes (2)
  • src/components/ui/TextArea/TextArea.tsx
  • styles/themes/components/textarea.scss
Additional comments: 2
src/components/ui/TextArea/shards/TextAreaInput.tsx (2)
  • 3-6: The TextAreaInputProps type definition correctly specifies the props that the component accepts, including making placeholder optional, which aligns with common usage patterns for text area components.
  • 14-14: The export statement is clear and follows common practices for exporting React components. This ensures that the TextAreaInput component can be easily imported and used in other parts of the application.

Comment on lines +8 to +11
const TextAreaInput = ({children, placeholder=''}:TextAreaInputProps) => {
return <textarea placeholder={placeholder}>
{children}
</textarea>;
Copy link
Contributor

Choose a reason for hiding this comment

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

The use of children within a <textarea> element is unconventional. Typically, the value of a textarea is controlled via the value prop rather than children. This approach might not work as expected in React and could lead to confusion or bugs.

- const TextAreaInput = ({children, placeholder=''}:TextAreaInputProps) => {
+ const TextAreaInput = ({value, placeholder=''}:TextAreaInputProps) => {
- return <textarea placeholder={placeholder}>
+ return <textarea placeholder={placeholder} value={value} onChange={/* handler function */}>
-        {children}
-    </textarea>;
+ </textarea>;

Consider changing the prop from children to value and adding an onChange handler to make the component controlled.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
const TextAreaInput = ({children, placeholder=''}:TextAreaInputProps) => {
return <textarea placeholder={placeholder}>
{children}
</textarea>;
const TextAreaInput = ({value, placeholder=''}:TextAreaInputProps) => {
return <textarea placeholder={placeholder} value={value} onChange={/* handler function */}>
</textarea>;

import React from 'react';
import TextArea from './TextArea';
import SandboxEditor from '~/components/tools/SandboxEditor/SandboxEditor';

Choose a reason for hiding this comment

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

This PR contains leftover multi-line comments. Please review or remove them.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 68857a0 and 6d5b74d.
Files selected for processing (2)
  • src/components/ui/TextArea/TextArea.tsx (1 hunks)
  • styles/themes/components/textarea.scss (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/components/ui/TextArea/TextArea.tsx
  • styles/themes/components/textarea.scss

@kotAPI kotAPI enabled auto-merge (squash) June 26, 2024 13:46
@kotAPI kotAPI disabled auto-merge June 26, 2024 13:47
@kotAPI kotAPI merged commit 1f00675 into main Jun 26, 2024
6 checks passed
@kotAPI kotAPI deleted the pranay/textarea-component branch June 26, 2024 13:47
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 Component
1 participant