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

misc: migrate multiple combobox to tailwind #1947

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/components/form/ComboBox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,10 @@
ComboboxList as any
}
ListboxProps={
// @ts-ignore

Check warning on line 195 in src/components/form/ComboBox/ComboBox.tsx

View workflow job for this annotation

GitHub Actions / Run linters

Use "@ts-expect-error" instead of "@ts-ignore", as "@ts-ignore" will do nothing if the following line is error-free
{ value, renderGroupHeader, virtualized }
}
PopperComponent={ComboBoxPopperFactory({
...PopperProps,
grouped: !!(data || [])[0]?.group,
virtualized,
})}
PopperComponent={ComboBoxPopperFactory(PopperProps)}
getOptionDisabled={(option) => !!option?.disabled}
getOptionLabel={(option) => {
const optionForString =
Expand Down
17 changes: 3 additions & 14 deletions src/components/form/ComboBox/ComboBoxPopperFactory.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import { Popper, PopperProps } from '@mui/material'
import { cx } from 'class-variance-authority'
import { ReactNode } from 'react'

import { theme } from '~/styles'

import { ComboBoxProps } from './types'

type ComboBoxPopperFactoryArgs = Required<Pick<ComboBoxProps, 'PopperProps'>>['PopperProps'] & {
grouped?: boolean
virtualized?: boolean
}
type ComboBoxPopperFactoryArgs = Required<Pick<ComboBoxProps, 'PopperProps'>>['PopperProps']

// return a configured <Popper> component with custom styles
export const ComboBoxPopperFactory =
({ placement, displayInDialog, grouped, virtualized }: ComboBoxPopperFactoryArgs = {}) =>
({ placement, displayInDialog }: ComboBoxPopperFactoryArgs = {}) =>
// eslint-disable-next-line react/display-name
(props: PopperProps) => (
<Popper
Expand All @@ -35,13 +31,6 @@ export const ComboBoxPopperFactory =
]}
{...props}
>
<div
className={cx({
'combobox-popper--virtualized': virtualized,
'combobox-popper--grouped': grouped,
})}
>
{props?.children as ReactNode}
</div>
<>{props?.children as ReactNode}</>
</Popper>
)
2 changes: 1 addition & 1 deletion src/components/form/ComboBox/ComboboxList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface ComboBoxVirtualizedListProps
children: ReactNode
}

const ComboboxListItem = ({
export const ComboboxListItem = ({
children,
virtualized,
className,
Expand Down
Loading
Loading