el.xwx.moe/components/Modal/Link/index.tsx

69 lines
1.8 KiB
TypeScript
Raw Normal View History

import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
2023-06-26 18:35:12 -05:00
import AddOrEditLink from "./AddOrEditLink";
2023-10-30 14:20:15 -05:00
import PreservedFormats from "./PreservedFormats";
type Props =
| {
toggleLinkModal: Function;
method: "CREATE";
activeLink?: LinkIncludingShortenedCollectionAndTags;
className?: string;
}
| {
toggleLinkModal: Function;
method: "UPDATE";
activeLink: LinkIncludingShortenedCollectionAndTags;
2023-10-30 14:20:15 -05:00
className?: string;
}
| {
toggleLinkModal: Function;
method: "FORMATS";
activeLink: LinkIncludingShortenedCollectionAndTags;
className?: string;
};
2023-06-24 16:54:35 -05:00
export default function LinkModal({
className,
toggleLinkModal,
activeLink,
method,
}: Props) {
return (
<div className={className}>
2023-10-30 14:20:15 -05:00
{/* {method === "CREATE" && (
<p className="text-xl text-black dark:text-white text-center">
New Link
</p>
)} */}
{activeLink && method === "UPDATE" ? (
<>
<p className="ml-10 mt-[0.1rem] text-xl mb-3 font-thin">Edit Link</p>
<AddOrEditLink
toggleLinkModal={toggleLinkModal}
method="UPDATE"
activeLink={activeLink}
/>
</>
) : undefined}
{method === "CREATE" ? (
<>
<p className="ml-10 mt-[0.1rem] text-xl mb-3 font-thin">
Create a New Link
2023-08-11 00:11:02 -05:00
</p>
2023-10-30 14:20:15 -05:00
<AddOrEditLink toggleLinkModal={toggleLinkModal} method="CREATE" />
</>
) : undefined}
2023-10-30 14:20:15 -05:00
{activeLink && method === "FORMATS" ? (
<>
<p className="ml-10 mt-[0.1rem] text-xl mb-3 font-thin">
Manage Preserved Formats
</p>
<PreservedFormats activeLink={activeLink} />
</>
) : undefined}
</div>
);
}