fix: polish board grid interactions
This commit is contained in:
1 parent
4227e392b5
commit
34f2a0bd24
25 files changed
+517
-178
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import dynamic from "next/dynamic";
|
||||
import { ActionIcon, Badge, Box, Card } from "@mantine/core";
|
||||
import { ActionIcon, Badge, Box, Button, Card } from "@mantine/core";
|
||||
import { IconChevronDown, IconChevronUp, IconExternalLink, IconGripVertical } from "@tabler/icons-react";
|
||||
import combineClasses from "clsx";
|
||||
|
||||
@@ -36,17 +36,22 @@ export const BoardContainerSection = ({ section }: Props) => {
|
||||
sectionId: section.id,
|
||||
collapsible: options.collapsible,
|
||||
});
|
||||
const label = options.title || t("action.create");
|
||||
const label = options.title.trim() || t("untitled");
|
||||
const contentId = `board-container-${section.id}-content`;
|
||||
const labelLeft = isEditMode || options.collapsible ? 40 : 10;
|
||||
const labelLeft = options.collapsible && !isEditMode ? 40 : 8;
|
||||
const labelRight = isEditMode ? 48 : options.showOpenAll ? 40 : 8;
|
||||
|
||||
return (
|
||||
<Box className="board-grid-item-content" data-grid-item-content w="100%" h="100%" style={{ overflow: "visible" }}>
|
||||
<Card
|
||||
className={combineClasses(classes.itemCard, options.customCssClasses.join(" "))}
|
||||
className={combineClasses(
|
||||
classes.itemCard,
|
||||
options.customCssClasses.join(" "),
|
||||
isVisuallyCollapsed && classes.collapsedContainerCard,
|
||||
)}
|
||||
w="100%"
|
||||
h="100%"
|
||||
data-board-container-collapsed={isVisuallyCollapsed ? "true" : "false"}
|
||||
styles={{
|
||||
root: {
|
||||
overflow: "visible",
|
||||
@@ -57,6 +62,31 @@ export const BoardContainerSection = ({ section }: Props) => {
|
||||
radius={board.itemRadius}
|
||||
p={0}
|
||||
>
|
||||
{isVisuallyCollapsed && (
|
||||
<Button
|
||||
pos="absolute"
|
||||
top={0}
|
||||
left={0}
|
||||
maw={`calc(100% - ${options.showOpenAll ? 40 : 0}px)`}
|
||||
size="compact-sm"
|
||||
radius="xl"
|
||||
variant="default"
|
||||
leftSection={<IconChevronDown size={14} />}
|
||||
onClick={toggle}
|
||||
aria-expanded={false}
|
||||
aria-controls={contentId}
|
||||
aria-label={`${t("action.expand")}: ${label}`}
|
||||
data-board-container-collapsed-control
|
||||
styles={{
|
||||
label: {
|
||||
overflow: "hidden",
|
||||
textOverflow: "ellipsis",
|
||||
},
|
||||
}}
|
||||
>
|
||||
{label}
|
||||
</Button>
|
||||
)}
|
||||
{isEditMode && (
|
||||
<ActionIcon
|
||||
component="span"
|
||||
@@ -65,53 +95,65 @@ export const BoardContainerSection = ({ section }: Props) => {
|
||||
left={4}
|
||||
style={{ zIndex: 10, cursor: "grab", touchAction: "none" }}
|
||||
variant="default"
|
||||
radius="xl"
|
||||
size={24}
|
||||
radius="sm"
|
||||
data-grid-container-drag-handle
|
||||
aria-hidden="true"
|
||||
>
|
||||
<IconGripVertical size={16} />
|
||||
</ActionIcon>
|
||||
)}
|
||||
{options.showLabel && options.title && (
|
||||
{!isVisuallyCollapsed && options.showLabel && options.title && (
|
||||
<Badge
|
||||
pos="absolute"
|
||||
top={6}
|
||||
top={-24}
|
||||
left={labelLeft}
|
||||
maw={`calc(100% - ${labelLeft + labelRight}px)`}
|
||||
size="md"
|
||||
radius={board.itemRadius}
|
||||
color="var(--background-color)"
|
||||
radius="sm"
|
||||
variant="default"
|
||||
c="var(--mantine-color-text)"
|
||||
bd="1px solid var(--border-color)"
|
||||
style={{ zIndex: 9, pointerEvents: "none" }}
|
||||
style={{
|
||||
zIndex: 9,
|
||||
overflow: "hidden",
|
||||
pointerEvents: "none",
|
||||
textOverflow: "ellipsis",
|
||||
whiteSpace: "nowrap",
|
||||
backgroundColor: "var(--background-color)",
|
||||
borderColor: "var(--border-color)",
|
||||
}}
|
||||
title={options.title}
|
||||
data-board-container-label
|
||||
>
|
||||
{options.title}
|
||||
</Badge>
|
||||
)}
|
||||
{options.collapsible && !isEditMode && (
|
||||
{options.collapsible && !isEditMode && !isVisuallyCollapsed && (
|
||||
<ActionIcon
|
||||
pos="absolute"
|
||||
top={4}
|
||||
top={-24}
|
||||
left={4}
|
||||
style={{ zIndex: 10 }}
|
||||
variant="default"
|
||||
radius="xl"
|
||||
size={24}
|
||||
radius="sm"
|
||||
onClick={toggle}
|
||||
aria-expanded={!isVisuallyCollapsed}
|
||||
aria-controls={contentId}
|
||||
aria-label={`${isVisuallyCollapsed ? t("action.expand") : t("action.collapse")}: ${label}`}
|
||||
>
|
||||
{isVisuallyCollapsed ? <IconChevronDown size={16} /> : <IconChevronUp size={16} />}
|
||||
<IconChevronUp size={16} />
|
||||
</ActionIcon>
|
||||
)}
|
||||
{options.showOpenAll && !isEditMode && (
|
||||
<ActionIcon
|
||||
pos="absolute"
|
||||
top={4}
|
||||
top={isVisuallyCollapsed ? 0 : -24}
|
||||
right={4}
|
||||
style={{ zIndex: 10 }}
|
||||
variant="default"
|
||||
radius="xl"
|
||||
size={24}
|
||||
radius="sm"
|
||||
loading={areAppsLoading}
|
||||
onClick={openAllInNewTabs}
|
||||
aria-label={tAll("section.action.openAllInNewTabsFor", { name: label })}
|
||||
|
||||
Reference in new issue
Block a user