-
Notifications
You must be signed in to change notification settings - Fork 14
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
fix: Truncate long text within buttons #303
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @chuck-ankit, thanks for your contribution!
.gitignore
Outdated
@@ -42,3 +42,5 @@ node_modules | |||
|
|||
# Local files | |||
*.local | |||
|
|||
.env.local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the Convex initialization added this automatically; can you revert it since .env.local
is already included above?
convex/README.md
Outdated
@@ -0,0 +1,90 @@ | |||
# Welcome to your Convex functions directory! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convex initialization may have added this file, too. Mind removing it?
<div className="relative group"> | ||
<Button | ||
icon={Pencil} | ||
className="max-w-[200px] truncate" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll want to make this change on the shared Button
component, instead of this specific button. The Button
component is in src/components/common
!
{user?.name && user.name.length > 15 && ( | ||
<span className="absolute hidden group-hover:block bg-gray-700 text-white text-sm px-2 py-1 rounded"> | ||
{user.name} | ||
</span> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your idea of showing a tooltip when the text is too long! We have a Tooltip
component (also in src/components/common
) that we can use for that instead of a custom element.
Bonus: If we set max-w-[30ch]
using the ch
unit, we can reliably show the Tooltip
when the contents are more than 30 characters long. This will also make sure if we increase the font size on Button
, the same number of characters will be displayed!
Note: we should also add a changeset to this PR! You can add one by running |
What changed?
The Button in the
EditNameSettings.tsx
component was updated to address the issue with overly long user names.max-w-[200px]
class to limit the button width.truncate
class to truncate long strings.Fixes #302 (Truncate long text within buttons)
Why?
This change addresses the issue where long user names were overflowing within the button. It ensures that buttons maintain a consistent width and provides a way to view the full name using a tooltip on hover.
How was this change made?
max-w-[200px]
class was applied to restrict the button width.truncate
class was added to cut off overflowing text.How was this tested?
Anything else?