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

Put bulk actions above popovers in collections #42512

Merged
merged 2 commits into from
May 10, 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
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ export const CollectionRoot = styled.div`
height: 100%;
overflow: hidden;
position: relative;
container-name: ItemsTableContainer;
container-type: inline-size;
// NOTE: The BulkActionsToast is centered within this container.
// If this div ever ceases to be a container one day, let's restore the previously
// existing margin-left fix for the toast so it is still centered when the nav sidebar is open
`;

export const CollectionMain = styled.div`
Expand All @@ -24,6 +19,9 @@ export interface CollectionTableProps {

export const CollectionTable = styled.div<CollectionTableProps>`
margin-top: ${props => (props.hasPinnedItems ? "2rem" : "")};

container-name: ItemsTableContainer;
container-type: inline-size;
`;

export const CollectionEmptyContent = styled.div`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,41 +350,43 @@ export const CollectionContentView = ({
}

return (
<CollectionTable data-testid="collection-table">
<ItemsTable
databases={databases}
bookmarks={bookmarks}
createBookmark={createBookmark}
deleteBookmark={deleteBookmark}
items={unpinnedItems}
collection={collection}
sortingOptions={unpinnedItemsSorting}
onSortingOptionsChange={
handleUnpinnedItemsSortingChange
}
selectedItems={selected}
hasUnselected={hasUnselected}
getIsSelected={getIsSelected}
onToggleSelected={toggleItem}
onDrop={clear}
onMove={handleMove}
onCopy={handleCopy}
onSelectAll={handleSelectAll}
onSelectNone={clear}
/>
<div className={cx(CS.flex, CS.justifyEnd, CS.my3)}>
{hasPagination && (
<PaginationControls
showTotal
page={page}
pageSize={PAGE_SIZE}
total={metadata.total}
itemsLength={unpinnedItems.length}
onNextPage={handleNextPage}
onPreviousPage={handlePreviousPage}
/>
)}
</div>
<>
<CollectionTable data-testid="collection-table">
<ItemsTable
databases={databases}
bookmarks={bookmarks}
createBookmark={createBookmark}
deleteBookmark={deleteBookmark}
items={unpinnedItems}
collection={collection}
sortingOptions={unpinnedItemsSorting}
onSortingOptionsChange={
handleUnpinnedItemsSortingChange
}
selectedItems={selected}
hasUnselected={hasUnselected}
getIsSelected={getIsSelected}
onToggleSelected={toggleItem}
onDrop={clear}
onMove={handleMove}
onCopy={handleCopy}
onSelectAll={handleSelectAll}
onSelectNone={clear}
/>
<div className={cx(CS.flex, CS.justifyEnd, CS.my3)}>
{hasPagination && (
<PaginationControls
showTotal
page={page}
pageSize={PAGE_SIZE}
total={metadata.total}
itemsLength={unpinnedItems.length}
onNextPage={handleNextPage}
onPreviousPage={handlePreviousPage}
/>
)}
</div>
</CollectionTable>
<CollectionBulkActions
selected={selected}
collection={collection}
Expand All @@ -396,7 +398,7 @@ export const CollectionContentView = ({
selectedItems={selectedItems}
selectedAction={selectedAction}
/>
</CollectionTable>
</>
);
}}
</Search.ListLoader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import styled from "@emotion/styled";

import Card from "metabase/components/Card";
import { alpha, color } from "metabase/lib/colors";
import { NAV_SIDEBAR_WIDTH } from "metabase/nav/constants";
import { space } from "metabase/styled-components/theme";
import { Button, DEFAULT_POPOVER_Z_INDEX } from "metabase/ui";

Expand All @@ -12,6 +13,8 @@ export const BulkActionsToast = styled.div<{ isNavbarOpen: boolean }>`
position: fixed;
bottom: 0;
left: 50%;
margin-left: ${props =>
props.isNavbarOpen ? `${parseInt(NAV_SIDEBAR_WIDTH) / 2}px` : "0"};
margin-bottom: ${space(2)};
z-index: ${BULK_ACTIONS_Z_INDEX};
`;
Expand Down
Loading