2023-02-10 12:32:18 +00:00
|
|
|
import React from "react";
|
2023-02-08 13:21:03 +00:00
|
|
|
|
|
|
|
// ui
|
|
|
|
import { CustomMenu } from "components/ui";
|
|
|
|
// types
|
|
|
|
import { IIssueLabels } from "types";
|
2023-03-31 13:01:44 +00:00
|
|
|
//icons
|
|
|
|
import { RectangleGroupIcon, LinkIcon, PencilIcon, TrashIcon } from "@heroicons/react/24/outline";
|
2023-02-08 13:21:03 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
label: IIssueLabels;
|
2023-02-10 12:32:18 +00:00
|
|
|
addLabelToGroup: (parentLabel: IIssueLabels) => void;
|
2023-02-08 13:21:03 +00:00
|
|
|
editLabel: (label: IIssueLabels) => void;
|
|
|
|
handleLabelDelete: (labelId: string) => void;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const SingleLabel: React.FC<Props> = ({
|
|
|
|
label,
|
2023-02-10 12:32:18 +00:00
|
|
|
addLabelToGroup,
|
2023-02-08 13:21:03 +00:00
|
|
|
editLabel,
|
|
|
|
handleLabelDelete,
|
2023-02-10 12:32:18 +00:00
|
|
|
}) => (
|
2023-04-20 08:11:24 +00:00
|
|
|
<div className="gap-2 space-y-3 divide-y divide-brand-base rounded-[10px] border border-brand-base bg-brand-surface-1 p-5">
|
2023-02-10 12:32:18 +00:00
|
|
|
<div className="flex items-center justify-between">
|
2023-03-07 19:37:00 +00:00
|
|
|
<div className="flex items-center gap-3">
|
2023-02-10 12:32:18 +00:00
|
|
|
<span
|
2023-03-07 19:37:00 +00:00
|
|
|
className="h-3.5 w-3.5 flex-shrink-0 rounded-full"
|
2023-02-10 12:32:18 +00:00
|
|
|
style={{
|
2023-02-17 11:36:30 +00:00
|
|
|
backgroundColor: label.color && label.color !== "" ? label.color : "#000",
|
2023-02-10 12:32:18 +00:00
|
|
|
}}
|
|
|
|
/>
|
2023-04-20 08:11:24 +00:00
|
|
|
<h6 className="font-medium text-brand-base">{label.name}</h6>
|
2023-02-10 12:32:18 +00:00
|
|
|
</div>
|
|
|
|
<CustomMenu ellipsis>
|
|
|
|
<CustomMenu.MenuItem onClick={() => addLabelToGroup(label)}>
|
2023-03-31 13:01:44 +00:00
|
|
|
<span className="flex items-center justify-start gap-2">
|
|
|
|
<RectangleGroupIcon className="h-4 w-4" />
|
|
|
|
<span>Convert to group</span>
|
|
|
|
</span>
|
|
|
|
</CustomMenu.MenuItem>
|
|
|
|
<CustomMenu.MenuItem onClick={() => editLabel(label)}>
|
|
|
|
<span className="flex items-center justify-start gap-2">
|
|
|
|
<PencilIcon className="h-4 w-4" />
|
|
|
|
<span>Edit label</span>
|
|
|
|
</span>
|
2023-02-10 12:32:18 +00:00
|
|
|
</CustomMenu.MenuItem>
|
|
|
|
<CustomMenu.MenuItem onClick={() => handleLabelDelete(label.id)}>
|
2023-03-31 13:01:44 +00:00
|
|
|
<span className="flex items-center justify-start gap-2">
|
|
|
|
<TrashIcon className="h-4 w-4" />
|
|
|
|
<span>Delete label</span>
|
|
|
|
</span>
|
2023-02-10 12:32:18 +00:00
|
|
|
</CustomMenu.MenuItem>
|
|
|
|
</CustomMenu>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|