feat: pointer cursor for boards and deals

This commit is contained in:
2025-08-05 16:52:26 +04:00
parent 236c0dcf10
commit c13cc4a0a5
4 changed files with 13 additions and 5 deletions

View File

@ -4,7 +4,6 @@ import DealCard from "@/app/deals/components/DealCard/DealCard";
import { DealSchema } from "@/client";
import { SortableItem } from "@/components/SortableDnd/SortableItem";
type Props = {
deal: DealSchema;
};
@ -14,7 +13,11 @@ const DealContainer: FC<Props> = ({ deal }) => {
return (
<Box>
<SortableItem id={deal.id}>{dealBody}</SortableItem>
<SortableItem
dragHandleStyle={{ cursor: "pointer" }}
id={deal.id}>
{dealBody}
</SortableItem>
</Box>
);
};

View File

@ -1,11 +1,12 @@
import React, { ReactNode, useContext } from "react";
import React, { CSSProperties, ReactNode, useContext } from "react";
import SortableItemContext from "@/components/SortableDnd/SortableItemContext";
type Props = {
children: ReactNode;
style?: CSSProperties;
};
const DragHandle = ({ children }: Props) => {
const DragHandle = ({ children, style }: Props) => {
const { attributes, listeners, ref } = useContext(SortableItemContext);
return (
@ -15,6 +16,7 @@ const DragHandle = ({ children }: Props) => {
style={{
width: "100%",
cursor: "grab",
...style,
}}
ref={ref}>
{children}

View File

@ -109,6 +109,7 @@ const SortableDnd = <T extends BaseItem>({
onItemClick(item);
}}>
<SortableItem
dragHandleStyle={{ cursor: "pointer" }}
itemStyle={itemStyle}
id={item.id}>
{renderItem(item)}

View File

@ -7,12 +7,14 @@ import SortableItemContext from "./SortableItemContext";
type Props = {
id: number | string;
itemStyle?: CSSProperties;
dragHandleStyle?: CSSProperties;
};
export const SortableItem = ({
children,
itemStyle,
id,
dragHandleStyle,
}: PropsWithChildren<Props>) => {
const {
attributes,
@ -45,7 +47,7 @@ export const SortableItem = ({
<div
ref={setNodeRef}
style={style}>
<DragHandle>{children}</DragHandle>
<DragHandle style={dragHandleStyle}>{children}</DragHandle>
</div>
</SortableItemContext.Provider>
);