feat: pointer cursor for boards and deals
This commit is contained in:
@ -4,7 +4,6 @@ import DealCard from "@/app/deals/components/DealCard/DealCard";
|
|||||||
import { DealSchema } from "@/client";
|
import { DealSchema } from "@/client";
|
||||||
import { SortableItem } from "@/components/SortableDnd/SortableItem";
|
import { SortableItem } from "@/components/SortableDnd/SortableItem";
|
||||||
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
deal: DealSchema;
|
deal: DealSchema;
|
||||||
};
|
};
|
||||||
@ -14,7 +13,11 @@ const DealContainer: FC<Props> = ({ deal }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<SortableItem id={deal.id}>{dealBody}</SortableItem>
|
<SortableItem
|
||||||
|
dragHandleStyle={{ cursor: "pointer" }}
|
||||||
|
id={deal.id}>
|
||||||
|
{dealBody}
|
||||||
|
</SortableItem>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
import React, { ReactNode, useContext } from "react";
|
import React, { CSSProperties, ReactNode, useContext } from "react";
|
||||||
import SortableItemContext from "@/components/SortableDnd/SortableItemContext";
|
import SortableItemContext from "@/components/SortableDnd/SortableItemContext";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
|
style?: CSSProperties;
|
||||||
};
|
};
|
||||||
|
|
||||||
const DragHandle = ({ children }: Props) => {
|
const DragHandle = ({ children, style }: Props) => {
|
||||||
const { attributes, listeners, ref } = useContext(SortableItemContext);
|
const { attributes, listeners, ref } = useContext(SortableItemContext);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -15,6 +16,7 @@ const DragHandle = ({ children }: Props) => {
|
|||||||
style={{
|
style={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
cursor: "grab",
|
cursor: "grab",
|
||||||
|
...style,
|
||||||
}}
|
}}
|
||||||
ref={ref}>
|
ref={ref}>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@ -109,6 +109,7 @@ const SortableDnd = <T extends BaseItem>({
|
|||||||
onItemClick(item);
|
onItemClick(item);
|
||||||
}}>
|
}}>
|
||||||
<SortableItem
|
<SortableItem
|
||||||
|
dragHandleStyle={{ cursor: "pointer" }}
|
||||||
itemStyle={itemStyle}
|
itemStyle={itemStyle}
|
||||||
id={item.id}>
|
id={item.id}>
|
||||||
{renderItem(item)}
|
{renderItem(item)}
|
||||||
|
|||||||
@ -7,12 +7,14 @@ import SortableItemContext from "./SortableItemContext";
|
|||||||
type Props = {
|
type Props = {
|
||||||
id: number | string;
|
id: number | string;
|
||||||
itemStyle?: CSSProperties;
|
itemStyle?: CSSProperties;
|
||||||
|
dragHandleStyle?: CSSProperties;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SortableItem = ({
|
export const SortableItem = ({
|
||||||
children,
|
children,
|
||||||
itemStyle,
|
itemStyle,
|
||||||
id,
|
id,
|
||||||
|
dragHandleStyle,
|
||||||
}: PropsWithChildren<Props>) => {
|
}: PropsWithChildren<Props>) => {
|
||||||
const {
|
const {
|
||||||
attributes,
|
attributes,
|
||||||
@ -45,7 +47,7 @@ export const SortableItem = ({
|
|||||||
<div
|
<div
|
||||||
ref={setNodeRef}
|
ref={setNodeRef}
|
||||||
style={style}>
|
style={style}>
|
||||||
<DragHandle>{children}</DragHandle>
|
<DragHandle style={dragHandleStyle}>{children}</DragHandle>
|
||||||
</div>
|
</div>
|
||||||
</SortableItemContext.Provider>
|
</SortableItemContext.Provider>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user