-
Notifications
You must be signed in to change notification settings - Fork 3
List box - tree implementation #510
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
base: master
Are you sure you want to change the base?
Conversation
|
|
||
| /** The (inline) size of the list box. Optional. Default: `medium`. */ | ||
| size?: undefined | 'shrink' | 'small' | 'medium' | 'large', | ||
| size?: undefined | 'shrink' | 'small' | 'medium' | 'large' | 'xl', |
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.
Let's rename xl → x-large
| requestFocus: () => void; | ||
| isSelected: boolean; | ||
| requestSelection: () => void; | ||
| selectedChildKey: string | null; |
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.
Can you convert the ; to , here?
| <div | ||
| className={cx( | ||
| cl['bk-list-box__group-layout'], | ||
| { [cl['is-searching']]: isSearching }, |
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.
Should follow BEM: bk-list-box__group-layout--searching
| }, [groups, selectedItemKey]); | ||
|
|
||
| // --- Layout selection --- | ||
| let content: React.ReactNode; |
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.
Can you move this section to a function? Like renderContent. Then we don't need the let (and the whole thing becomes nicely encapsulated)
| React.isValidElement(child) && | ||
| (child.props as OptionProps)?.itemKey === selectedItemKey | ||
| ); | ||
| if (foundChild) return group; |
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.
Add explicit braces if () { ... }. Also elsewhere
| const results: OptionElement[] = []; | ||
|
|
||
| groups.forEach((group) => { | ||
| React.Children.forEach(group.props.children, (option) => { |
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 would rather avoid JSX walking, this is deprecated in React.
| @include bk.scroll-shadow($dir: start); | ||
| } | ||
|
|
||
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.
Trim the extra spaces here
| &.bk-list-box__item--group, &.bk-list-box__item--option { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| inline-size: 100%; |
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.
Do you need the inline-size: 100%? Can this be converted to flex stretch?
| /** Custom icon component. */ | ||
| Icon?: undefined | ListBoxIcon, | ||
|
|
||
| info?: React.ReactNode, |
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.
Add undefined | also
No description provided.