forked from github/plane
2b168edd99
* feat: peak overview for issues * fix: peek spelling * chore: truncate issue property labels * style: full screen view designed * chore: add comment section * chore: copy link and delete options added * chore: update icons --------- Co-authored-by: Aaryan Khandelwal <aaryan610@Aaryans-MacBook-Pro.local>
62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
import React from "react";
|
|
|
|
// hooks
|
|
import useEstimateOption from "hooks/use-estimate-option";
|
|
// ui
|
|
import { CustomSelect } from "components/ui";
|
|
// icons
|
|
import { PlayIcon } from "@heroicons/react/24/outline";
|
|
|
|
type Props = {
|
|
value: number | null;
|
|
onChange: (val: number | null) => void;
|
|
disabled?: boolean;
|
|
};
|
|
|
|
export const SidebarEstimateSelect: React.FC<Props> = ({ value, onChange, disabled = false }) => {
|
|
const { isEstimateActive, estimatePoints } = useEstimateOption();
|
|
|
|
if (!isEstimateActive) return null;
|
|
|
|
return (
|
|
<CustomSelect
|
|
value={value}
|
|
customButton={
|
|
<button
|
|
type="button"
|
|
className="flex items-center gap-1.5 !text-sm bg-custom-background-80 rounded px-2.5 py-0.5"
|
|
>
|
|
<PlayIcon
|
|
className={`h-4 w-4 -rotate-90 ${
|
|
value !== null ? "text-custom-text-100" : "text-custom-text-200"
|
|
}`}
|
|
/>
|
|
{estimatePoints?.find((e) => e.key === value)?.value ?? "No estimate"}
|
|
</button>
|
|
}
|
|
onChange={onChange}
|
|
disabled={disabled}
|
|
>
|
|
<CustomSelect.Option value={null}>
|
|
<>
|
|
<span>
|
|
<PlayIcon className="h-4 w-4 -rotate-90" />
|
|
</span>
|
|
None
|
|
</>
|
|
</CustomSelect.Option>
|
|
{estimatePoints &&
|
|
estimatePoints.map((point) => (
|
|
<CustomSelect.Option key={point.key} value={point.key}>
|
|
<>
|
|
<span>
|
|
<PlayIcon className="h-4 w-4 -rotate-90" />
|
|
</span>
|
|
{point.value}
|
|
</>
|
|
</CustomSelect.Option>
|
|
))}
|
|
</CustomSelect>
|
|
);
|
|
};
|