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

New Textarea component #2476

Draft
wants to merge 13 commits into
base: master-lts
Choose a base branch
from

Conversation

Iru89
Copy link
Contributor

@Iru89 Iru89 commented May 17, 2023

Description

  • keeps the autosize function up to 4 lines
  • emoji picker works
  • all tests are in green

Context

When moving to node 16, npm 8 with react 17, we have problems with the react-textarea-autosize library.
The latest version fails the tests because it uses a forwardRef that doesn't work with jest, and the previous versions don't use react 17 so I have problems with peer dependencies.
With this we can reduce the final bundle by using less libraries.

Approach taken / Explain the design

I have created a textarea component with react styled-components and a hook to control the state. This way in the future from webchat we could make a custom component for the textarea and use the same hook to control the state.
It would be necessary to move all the attributes that are used inside the hook use-text-area to a context, so it would not be necessary to pass anything when calling this hook. I will make a refactor to achieve this.
By extracting the functions into a hook we also reduce the size of the webchat file which is too big.

To document / Usage example

Testing

The pull request...

  • has unit tests
  • has integration tests
  • doesn't need tests because... [provide a description]

@Iru89 Iru89 removed the request for review from ericmarcos May 17, 2023 11:07
@Iru89 Iru89 force-pushed the refactor/extract-botonic-react-textarea branch from 3320cd0 to 03736ad Compare May 19, 2023 09:33
@github-actions
Copy link

Unit Test Results

1 files  1 suites   3s ⏱️
1 tests 1 ✔️ 0 💤 0 ❌

Results for commit 03736ad.

@Iru89 Iru89 force-pushed the refactor/extract-botonic-react-textarea branch from 03736ad to 024eb00 Compare May 19, 2023 10:42
@vanbasten17 vanbasten17 force-pushed the refactor/extract-botonic-react-textarea branch from fa7e54d to 5b235a4 Compare May 31, 2023 10:33
@github-actions
Copy link

github-actions bot commented May 31, 2023

Test Results

32 tests   32 ✔️  3m 41s ⏱️
  7 suites    0 💤
  1 files      0

Results for commit 31de8d0.

♻️ This comment has been updated with latest results.

@vanbasten17
Copy link
Contributor

@Iru89 is this still in draft?

@Iru89
Copy link
Contributor Author

Iru89 commented Jun 5, 2023

@Iru89 is this still in draft?

yes

@Iru89 Iru89 force-pushed the refactor/extract-botonic-react-textarea branch from 5b235a4 to 31de8d0 Compare August 22, 2023 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants