2023-01-26 18:12:20 +00:00
|
|
|
import React from "react";
|
|
|
|
|
2023-03-04 12:17:03 +00:00
|
|
|
// ui
|
|
|
|
import { CustomSelect } from "components/ui";
|
2023-02-08 04:43:07 +00:00
|
|
|
// icons
|
|
|
|
import { getPriorityIcon } from "components/icons/priority-icon";
|
2023-01-26 18:12:20 +00:00
|
|
|
// constants
|
2023-02-08 04:43:07 +00:00
|
|
|
import { PRIORITIES } from "constants/project";
|
2023-01-26 18:12:20 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
value: string | null;
|
|
|
|
onChange: (value: string) => void;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const IssuePrioritySelect: React.FC<Props> = ({ value, onChange }) => (
|
2023-03-04 12:17:03 +00:00
|
|
|
<CustomSelect
|
|
|
|
value={value}
|
|
|
|
label={
|
|
|
|
<div className="flex items-center justify-center gap-2 text-xs">
|
|
|
|
<span className="flex items-center">
|
2023-07-10 07:17:00 +00:00
|
|
|
{getPriorityIcon(value, `text-xs ${value ? "" : "text-custom-text-200"}`)}
|
2023-03-04 12:17:03 +00:00
|
|
|
</span>
|
2023-07-10 07:17:00 +00:00
|
|
|
<span className={`${value ? "" : "text-custom-text-200"} capitalize`}>
|
2023-03-04 12:17:03 +00:00
|
|
|
{value ?? "Priority"}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
onChange={onChange}
|
2023-03-05 14:52:01 +00:00
|
|
|
noChevron
|
2023-03-04 12:17:03 +00:00
|
|
|
>
|
|
|
|
{PRIORITIES.map((priority) => (
|
|
|
|
<CustomSelect.Option key={priority} value={priority}>
|
|
|
|
<div className="flex w-full justify-between gap-2 rounded">
|
|
|
|
<div className="flex items-center justify-start gap-2">
|
|
|
|
<span>{getPriorityIcon(priority)}</span>
|
|
|
|
<span className="capitalize">{priority ?? "None"}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</CustomSelect.Option>
|
|
|
|
))}
|
|
|
|
</CustomSelect>
|
2023-01-26 18:12:20 +00:00
|
|
|
);
|