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

feat: allow overriding of item height in virtual list #420

Merged
merged 3 commits into from
Jul 13, 2023

Conversation

pregnantboy
Copy link
Contributor

@pregnantboy pregnantboy commented Jul 9, 2023

Problem

MultiSelect and SingleSelect components rely on fixed heights for items.

// SingleSelect/constants.ts
export const VIRTUAL_LIST_ITEM_HEIGHT = {
  xs: 40,
  sm: 40,
  md: 48,
}

However, when descriptions are added, item height exceed fixed constant and overflows the computed virtualListHeight.

export const VIRTUAL_LIST_MAX_HEIGHT = {
  xs: 4 * VIRTUAL_LIST_ITEM_HEIGHT.xs,
  sm: 4 * VIRTUAL_LIST_ITEM_HEIGHT.sm,
  md: 4 * VIRTUAL_LIST_ITEM_HEIGHT.md,
}

E.g. list becomes scrollable with only one item

image

Solution

Allow overriding of list item height.

image

@netlify
Copy link

netlify bot commented Jul 9, 2023

Deploy Preview for objective-bell-0ffbfb canceled.

Name Link
🔨 Latest commit c88f4e6
🔍 Latest deploy log https://app.netlify.com/sites/objective-bell-0ffbfb/deploys/64afb1e41dec1a0009ec335f

@pregnantboy pregnantboy marked this pull request as ready for review July 9, 2023 17:30
@pregnantboy pregnantboy requested a review from karrui July 9, 2023 17:30
@pregnantboy pregnantboy linked an issue Jul 10, 2023 that may be closed by this pull request
@karrui karrui merged commit a16e772 into main Jul 13, 2023
@karrui karrui deleted the feat/override-select-item-height branch July 13, 2023 08:44
@karrui karrui mentioned this pull request Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiselect item height does not support description
2 participants