feat: lexical integrated
This commit is contained in:
parent
3e5e1ab403
commit
945a75e18b
18 changed files with 417 additions and 240 deletions
|
|
@ -0,0 +1,47 @@
|
|||
import React, { useState } from "react";
|
||||
// react hook form
|
||||
import { Controller, Control } from "react-hook-form";
|
||||
// hooks
|
||||
import useUser from "lib/hooks/useUser";
|
||||
// types
|
||||
import type { IIssue } from "types";
|
||||
// icons
|
||||
import { UserIcon } from "@heroicons/react/24/outline";
|
||||
// components
|
||||
import IssuesListModal from "components/project/issues/IssuesListModal";
|
||||
|
||||
type Props = {
|
||||
control: Control<IIssue, any>;
|
||||
};
|
||||
|
||||
const SelectParent: React.FC<Props> = ({ control }) => {
|
||||
const [isIssueListModalOpen, setIsIssueListModalOpen] = useState(false);
|
||||
|
||||
const { issues } = useUser();
|
||||
|
||||
return (
|
||||
<Controller
|
||||
control={control}
|
||||
name="parent"
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<>
|
||||
<IssuesListModal
|
||||
isOpen={isIssueListModalOpen}
|
||||
handleClose={() => setIsIssueListModalOpen(false)}
|
||||
onChange={onChange}
|
||||
issues={issues}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
className="p-2 text-left text-gray-900 hover:bg-theme hover:text-white rounded-md text-xs whitespace-nowrap"
|
||||
onClick={() => setIsIssueListModalOpen(true)}
|
||||
>
|
||||
{value ? issues?.results.find((i) => i.id === value)?.name : "Select Parent Issue"}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default SelectParent;
|
||||
Loading…
Add table
Add a link
Reference in a new issue