Skip to content

Conversation

@dominik-petrik
Copy link
Contributor

What: Closes #8975

@dominik-petrik dominik-petrik marked this pull request as draft May 9, 2023 19:49
@nicolethoen nicolethoen force-pushed the table-bulkSelect-cleanup branch from db6fdb2 to fc0748d Compare May 12, 2023 00:41
@nicolethoen nicolethoen marked this pull request as ready for review May 12, 2023 00:41
@patternfly-build
Copy link
Contributor

patternfly-build commented May 12, 2023

@nicolethoen nicolethoen requested review from jenny-s51 and kmcfaul May 15, 2023 17:26
Copy link
Contributor

@jenny-s51 jenny-s51 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good @dominik-petrik ! Left some comments

const [perPage, setPerPage] = React.useState(10);
const [paginatedRows, setPaginatedRows] = React.useState(rows.slice(0, 10));
const [selectedRows, setSelectedRows] = React.useState([]);
const handleSetPage = (_evt, newPage, perPage, startIdx, endIdx) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const handleSetPage = (_evt, newPage, perPage, startIdx, endIdx) => {
const handleSetPage = (_evt, newPage, _perPage, startIdx, endIdx) => {

aria-label={anySelected ? 'Deselect all cards' : 'Select all cards'}
isChecked={isChecked}
onClick={() => {
anySelected ? setBulkSelection('none') : setBulkSelection('all');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we want to update the checkbox logic here so it works correctly

Suggested change
anySelected ? setBulkSelection('none') : setBulkSelection('all');
anySelected ? setSelectedRows([]) : selectAllRows(bulkSelection !== 'all');

<Toolbar>
<ToolbarContent>
<ToolbarGroup>
<ToolbarItem variant="bulk-select">{buildBulkSelect()}</ToolbarItem>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit - can we specify in the name here that this is a dropdown?

Suggested change
<ToolbarItem variant="bulk-select">{buildBulkSelect()}</ToolbarItem>
<ToolbarItem variant="bulk-select">{buildBulkSelectDropdown()}</ToolbarItem>

/>
);

const buildBulkSelect = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit - can we specify in the name here that this is a dropdown?

Suggested change
const buildBulkSelect = () => {
const buildBulkSelectDropdown = () => {

import { rows, columns } from '../../examples/Data.jsx';

export const BulkSelectTableDemo = () => {
const [isBulkSelectOpen, setIsBulkSelectOpen] = React.useState(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit

Suggested change
const [isBulkSelectOpen, setIsBulkSelectOpen] = React.useState(false);
const [isBulkSelectDropdownOpen, setIsBulkSelectDropdownOpen] = React.useState(false);

<Dropdown
role="menu"
onSelect={(_ev, itemId) => {
console.log(itemId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(itemId);

Copy link
Contributor

@kmcfaul kmcfaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just needs that small logic update to handle the split dropdown checkbox click properly. I agree with the other nits as well, but not a blocker worst case.

@nicolethoen nicolethoen requested review from jenny-s51 and kmcfaul May 17, 2023 12:42
@tlabaj tlabaj merged commit ff43fa3 into patternfly:v5 May 17, 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.

Table - Bulk select demo clean up

6 participants