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

Rewrote EnumFilter jsx to tsx and sonarfix #2754

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,26 @@ import ClearIcon from '@mui/icons-material/Clear'
import useMenu from '~/hooks/use-menu'
import FilterCheckbox from '~/components/enhanced-table/filter-checkbox/FilterCheckbox'

const EnumFilter = ({ column, filter, setFilter, clearFilter }) => {
interface FilterEnum {
value: string
label: string
}

interface EnumFilterProps {
column: {
filterEnum: FilterEnum[]
}
filter: string[]
setFilter: (filter: string[]) => void
clearFilter: () => void
}

const EnumFilter: React.FC<EnumFilterProps> = ({
column,
filter,
setFilter,
clearFilter
}) => {
const { renderMenu, openMenu } = useMenu()

const menuItems = column.filterEnum.map((filterEnum) => (
Expand All @@ -21,7 +40,8 @@ const EnumFilter = ({ column, filter, setFilter, clearFilter }) => {

const endAdornment = (
<IconButton
className={filter.length ? 'visible' : 'hidden'}
aria-hidden={filter.length === 0}
className={filter.length > 0 ? 'visible' : 'hidden'}
SofiiaYevush marked this conversation as resolved.
Show resolved Hide resolved
data-testid='clear-icon-in-filter'
onClick={clearFilter}
>
Expand Down
Loading