Skip to content

Commit

Permalink
feat(BulkSelect): Make X selected clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
fhlavac committed Jun 19, 2024
1 parent 0e40ad7 commit 8f7d8e5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/module/src/BulkSelect/BulkSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import {
MenuToggle,
MenuToggleCheckbox,
MenuToggleCheckboxProps,
MenuToggleElement,
Text
MenuToggleElement
} from '@patternfly/react-core';

export const BulkSelectValue = {
Expand Down Expand Up @@ -84,6 +83,8 @@ export const BulkSelect: React.FC<BulkSelectProps> = ({
const allOption = isDataPaginated ? BulkSelectValue.page : BulkSelectValue.all;
const noneOption = isDataPaginated ? BulkSelectValue.nonePage : BulkSelectValue.none;

const onToggleClick = () => setOpen(!isOpen);

return (
<Dropdown
shouldFocusToggleOnSelect
Expand All @@ -98,7 +99,7 @@ export const BulkSelect: React.FC<BulkSelectProps> = ({
<MenuToggle
ref={toggleRef}
isExpanded={isOpen}
onClick={() => setOpen(!isOpen)}
onClick={onToggleClick}
aria-label="Bulk select toggle"
data-ouia-component-id={`${ouiaId}-toggle`}
splitButtonOptions={{
Expand All @@ -118,9 +119,9 @@ export const BulkSelect: React.FC<BulkSelectProps> = ({
{...menuToggleCheckboxProps}
/>,
selectedCount > 0 ? (
<Text ouiaId={`${ouiaId}-text`} key="bulk-select-text">
<span onClick={onToggleClick} data-ouia-component-id={`${ouiaId}-text`} key="bulk-select-text">
{`${selectedCount} selected`}
</Text>
</span>
) : null
]
}}
Expand Down

0 comments on commit 8f7d8e5

Please sign in to comment.