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

64 lines
1.6 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-31 14:44:58 -05:00
{method === "CREATE" ? (
<>
<p className="ml-10 mt-[0.1rem] text-xl mb-3 font-thin">
Create a New Link
</p>
<AddOrEditLink toggleLinkModal={toggleLinkModal} method="CREATE" />
</>
) : undefined}
2023-10-30 14:20:15 -05:00
{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}
2023-10-31 14:44:58 -05:00
{method === "FORMATS" ? (
2023-10-30 14:20:15 -05:00
<>
<p className="ml-10 mt-[0.1rem] text-xl mb-3 font-thin">
2023-10-31 14:44:58 -05:00
Preserved Formats
2023-10-30 14:20:15 -05:00
</p>
2023-10-30 14:21:16 -05:00
<PreservedFormats />
2023-10-30 14:20:15 -05:00
</>
) : undefined}
</div>
);
}