ui icon indicating copy to clipboard operation
ui copied to clipboard

Cards can't handle very long words

Open FleetAdmiralJakob opened this issue 6 months ago • 26 comments

As seen here, if I use a very long (longest english word in a major dictionary) the card does not know how it should handle it. image An easy solution would be to add a break-words and hyphens-auto to the title.

I would be up on fixing this problem if this solution is approved.

FleetAdmiralJakob avatar Jan 02 '24 12:01 FleetAdmiralJakob

@FleetAdmiralJakob Shall I work on this?

iamabhshk avatar Jan 04 '24 10:01 iamabhshk

Sure, if you want. I could also do this but go for it!

FleetAdmiralJakob avatar Jan 04 '24 10:01 FleetAdmiralJakob

Pls. show me the PR so I can review it

FleetAdmiralJakob avatar Jan 04 '24 10:01 FleetAdmiralJakob

Sure

iamabhshk avatar Jan 04 '24 11:01 iamabhshk

@FleetAdmiralJakob is this worked upon? I just checked the same in mine, its seems to be working fine. Can you please confirm?

iamabhshk avatar Jan 06 '24 11:01 iamabhshk

I thought you were working on this? I didn't work on this, but I can.

FleetAdmiralJakob avatar Jan 06 '24 12:01 FleetAdmiralJakob

It's still a problem image

FleetAdmiralJakob avatar Jan 06 '24 12:01 FleetAdmiralJakob

This is happening because there is no space in between the text.

MohammedAslam106 avatar Jan 06 '24 13:01 MohammedAslam106

@MohammedAslam106 yes you are right!! It's happening only when it's a single long word

iamabhshk avatar Jan 06 '24 13:01 iamabhshk

This is happening because there is no space in between the text.

@MohammedAslam106 This isn't a text. This is the longest English word.

FleetAdmiralJakob avatar Jan 06 '24 13:01 FleetAdmiralJakob

@FleetAdmiralJakob Yes, maybe text-ellipsis will fix it. But you have to hide the overflow content. And you will no longer be able to see the full text.

MohammedAslam106 avatar Jan 06 '24 14:01 MohammedAslam106

Ok let me give a try and share a screenshot of that

iamabhshk avatar Jan 06 '24 14:01 iamabhshk

@FleetAdmiralJakob Yes, maybe text-ellipsis will fix it. But you have to hide the overflow content. And you will no longer be able to see the full text.

I think that is not an acceptable solution since the user should see the full text.

FleetAdmiralJakob avatar Jan 06 '24 14:01 FleetAdmiralJakob

Or shall we use whitespace-pre-wrap" ?

iamabhshk avatar Jan 06 '24 14:01 iamabhshk

idk, can you try some things out and send me the comparison screenshots?

FleetAdmiralJakob avatar Jan 06 '24 15:01 FleetAdmiralJakob

I applied max-w-md overflow-hidden on the card component, now the card size is fine but the text is still behaving same. Any idea how to fix that?

shadcn-ui

iamabhshk avatar Jan 06 '24 15:01 iamabhshk

An easy solution would be to add a break-words and hyphens-auto to the title.

NOTE: This only breaks words that are words. Not ssdssssss and so on.

FleetAdmiralJakob avatar Jan 06 '24 16:01 FleetAdmiralJakob

Here is my solution. shad-cn-ui-header

MohammedAslam106 avatar Jan 06 '24 16:01 MohammedAslam106

Here is my solution. shad-cn-ui-header

This looks good

iamabhshk avatar Jan 06 '24 16:01 iamabhshk

An easy solution would be to add a break-words and hyphens-auto to the title.

NOTE: This only breaks words that are words. Not ssdssssss and so on.

To implement this, we have to fix the width of the title tag.

MohammedAslam106 avatar Jan 06 '24 16:01 MohammedAslam106

An easy solution would be to add a break-words and hyphens-auto to the title.

NOTE: This only breaks words that are words. Not ssdssssss and so on.

There is a problem with this solution. Here is the result.

Uploading shad-cn-ui-header-2.png…

MohammedAslam106 avatar Jan 06 '24 17:01 MohammedAslam106

Could you reupload the image?

FleetAdmiralJakob avatar Jan 06 '24 17:01 FleetAdmiralJakob

Could you reupload the image?

shad-cn-ui-header-2

MohammedAslam106 avatar Jan 06 '24 17:01 MohammedAslam106

I have a question for you.

How you are using this card example in your code?

Where is the code for this card example?

MohammedAslam106 avatar Jan 06 '24 17:01 MohammedAslam106

I didn't use the card component because of this problem not yet, but if this problem is fixed I want to replace these cards with the better cards (with a solution for this problem).

image

https://github.com/The-Creative-Programming-Group/Weather-App/blob/master/apps/web/src/pages/home/index.tsx

FleetAdmiralJakob avatar Jan 06 '24 18:01 FleetAdmiralJakob

I'm pushing this PR. Just use different classes as per your need inside the CardTitle.

MohammedAslam106 avatar Jan 06 '24 18:01 MohammedAslam106

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

shadcn avatar Feb 26 '24 23:02 shadcn