Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Enable auto expanding textarea #86

Merged
merged 3 commits into from
Apr 28, 2024

Conversation

albertdbio
Copy link
Contributor

This replaces the input box with an auto expanding textarea.
However by default when the text area expand, the border radius will eventually cause it to look oval.
We can solve this issue by reducing the border radius each increment.
The key insight is that a border radius of 32 provided the same effect as rounded-full.
Therefore we can decrement it in an algorithmic manner.

Also the behavior of enter is maintained, that is, enter submits while shift+enter adds a new line.

auto-expanding-radius

Copy link

vercel bot commented Apr 26, 2024

@albertdbio is attempting to deploy a commit to the morphic Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Apr 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
morphic ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2024 5:00pm

Copy link
Owner

@miurla miurla left a comment

Choose a reason for hiding this comment

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

Nice work! Good implementation.

Since the initial state design has changed,
could you make the height and padding the same as the current ones?

main feat/auto-resizing-textbox
Screenshot 2024-04-26 at 13 22 09 Screenshot 2024-04-26 at 13 21 40

@albertdbio
Copy link
Contributor Author

On it!

@albertdbio
Copy link
Contributor Author

Ahh I see the reason why the pr is 70px.
The auto resize component overrides styles based on font-width and line-height.

Just noticed the previous open issue perhaps the other contributor can give it a try.
Otherwise, I'll try to get it working over the weekend.
However I'm thinking that we either have to accept a font size of 16px or accept a slightly bigger textarea height, possibly 50px.

@albertdbio
Copy link
Contributor Author

@Techno-o76 want to give the requested changes a try?
If it's to hard then perhaps we should create our own auto expanding textarea component that accounts for border radius as that is a very common pattern

@miurla
Copy link
Owner

miurla commented Apr 26, 2024

@albertdbio
Understood. I'll also try to see if I can resolve it by adjusting the design.

@miurla
Copy link
Owner

miurla commented Apr 28, 2024

Hey @albertdbio,

I've created a v0.1.8 branch, so could you change the base branch to this one?
After merging, I'll handle the remaining adjustments on my end.

https://github.com/miurla/morphic/tree/rc-0.1.8

@albertdbio albertdbio changed the base branch from main to rc-0.1.8 April 28, 2024 16:46
@albertdbio
Copy link
Contributor Author

Hey @miurla, I added the bunlock file from rc 0.1.8

@miurla miurla merged commit 321004c into miurla:rc-0.1.8 Apr 28, 2024
2 checks passed
@miurla
Copy link
Owner

miurla commented Apr 28, 2024

Thank you!!

@albertdbio
Copy link
Contributor Author

Oh but that also means that react-textarea-autosize is missing in that bun.lockb.
But when you run bun iagain it will add it

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants