mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
483c49d0ff
* style: sub issue theming * style: shortcut modal theming * style: blocking and blocked by modal theming * fix: filter labels dropdown width fix * style: display properties * chore: workspace invite * style: invite co workers theming * style: create workspace theming * style: attachment theming * style: workspace sidebar theming * style: issue property theming * style: create module modal lead icon * style: label list modal theming * delete attachment and member modal theming * style: transfer issue modal * style: delete estimate modal theming * style: module form status * style: delete state modal theming * style: shortcut modal * style: onboarding logo * style: onboarding command menu
70 lines
2.0 KiB
TypeScript
70 lines
2.0 KiB
TypeScript
import React from "react";
|
|
|
|
// react hook form
|
|
import { Controller, FieldError, Control } from "react-hook-form";
|
|
// ui
|
|
import { CustomSelect } from "components/ui";
|
|
// icons
|
|
import { Squares2X2Icon } from "@heroicons/react/24/outline";
|
|
// types
|
|
import type { IModule } from "types";
|
|
// constants
|
|
import { MODULE_STATUS } from "constants/module";
|
|
|
|
type Props = {
|
|
control: Control<IModule, any>;
|
|
error?: FieldError;
|
|
};
|
|
|
|
export const ModuleStatusSelect: React.FC<Props> = ({ control, error }) => (
|
|
<Controller
|
|
control={control}
|
|
rules={{ required: true }}
|
|
name="status"
|
|
render={({ field: { value, onChange } }) => (
|
|
<CustomSelect
|
|
value={value}
|
|
label={
|
|
<div
|
|
className={`flex items-center justify-center gap-2 text-xs ${
|
|
error ? "text-red-500" : ""
|
|
}`}
|
|
>
|
|
{value ? (
|
|
<span
|
|
className="h-1.5 w-1.5 flex-shrink-0 rounded-full"
|
|
style={{
|
|
backgroundColor: MODULE_STATUS.find((s) => s.value === value)?.color,
|
|
}}
|
|
/>
|
|
) : (
|
|
<Squares2X2Icon
|
|
className={`h-3 w-3 ${error ? "text-red-500" : "text-brand-secondary"}`}
|
|
/>
|
|
)}
|
|
{MODULE_STATUS.find((s) => s.value === value)?.label ?? (
|
|
<span className={`${error ? "text-red-500" : "text-brand-secondary"}`}>Status</span>
|
|
)}
|
|
</div>
|
|
}
|
|
onChange={onChange}
|
|
noChevron
|
|
>
|
|
{MODULE_STATUS.map((status) => (
|
|
<CustomSelect.Option key={status.value} value={status.value}>
|
|
<div className="flex items-center gap-2">
|
|
<span
|
|
className="h-1.5 w-1.5 flex-shrink-0 rounded-full"
|
|
style={{
|
|
backgroundColor: status.color,
|
|
}}
|
|
/>
|
|
{status.label}
|
|
</div>
|
|
</CustomSelect.Option>
|
|
))}
|
|
</CustomSelect>
|
|
)}
|
|
/>
|
|
);
|