ClickHouse / click-ui

The home of the ClickHouse design system and component library.
https://click-ui.vercel.app
78 stars 8 forks source link

Select: add useFullWidthItems to allow dropdown with to expand #462

Closed hoorayimhelping closed 3 months ago

hoorayimhelping commented 3 months ago

Helps with https://github.com/ClickHouse/control-plane/issues/10057

Example from the Database selector in Sql Console

Reasonable length content

Screenshot 2024-08-12 at 9 59 09 AM

Very long content

Screenshot 2024-08-12 at 12 09 20 PM

Ludicrously long content (clipped at 64 characters)

Screenshot 2024-08-12 at 12 00 00 PM

Minimum width of the dropdown selector

Screenshot 2024-08-12 at 11 50 32 AM

itemCharacterLimit="32ch"

Screenshot 2024-08-12 at 12 34 52 PM

itemCharacterLimit="200ch" (can break things if not careful)

Screenshot 2024-08-12 at 12 35 59 PM

vercel[bot] commented 3 months ago

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

Name Status Preview Comments Updated (UTC)
click-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 12, 2024 4:44pm
gjones commented 3 months ago

@hoorayimhelping I don't think we should allow the Ludicrously long content example, perhaps we can add a limit? 64 chars?

gjones commented 3 months ago

@hoorayimhelping Maybe a maxChars prop?

ArctypeZach commented 3 months ago

@gjones this would allow us to make the service selector wider as well

hoorayimhelping commented 3 months ago

@gjones I set the max-width to 64ch and replaced the outdated screenshots. What do you think?

gjones commented 3 months ago

@hoorayimhelping Yeah I think that's a good default limit, (I still think a prop to override it would provide really useful flexibility though)

hoorayimhelping commented 3 months ago

@gjones alright, I'll add that limit as a prop (was hoping I could be lazy, but alas 😉)

gjones commented 3 months ago

ha ha, sorry 😄

hoorayimhelping commented 3 months ago

@gjones alright, added itemCharacterLimit and a couple more screenshots showing it in use. What do you think?

hoorayimhelping commented 3 months ago

I looked into writing unit tests for this logic, but it's not possible (or is very difficult and brittle) to test text truncation using react-testing-library