Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,95 @@
|
||||
import { Transition } from "@headlessui/react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { Fragment, ReactNode, useState } from "react";
|
||||
import { useEscapeKeypress } from "~/utils/shared/KeypressUtils";
|
||||
import clsx from "clsx";
|
||||
import { XIcon } from "~/components/ui/icons/vendor";
|
||||
|
||||
type size = "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "full";
|
||||
interface Props {
|
||||
title?: string;
|
||||
size?: size;
|
||||
paddingContent?: string;
|
||||
paddingY?: string;
|
||||
content?: ReactNode;
|
||||
footer?: ReactNode;
|
||||
children?: ReactNode;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
export default function SlideOver({ title = "", size = "md", paddingContent = "px-4 sm:px-6", paddingY = "py-6", onClose, content, footer }: Props) {
|
||||
const [open] = useState(true);
|
||||
|
||||
useEscapeKeypress(onClose);
|
||||
return (
|
||||
<div>
|
||||
<div className="bg-foreground/50 absolute inset-0 transition-opacity"></div>
|
||||
|
||||
<div className="fixed inset-0 z-10 overflow-hidden">
|
||||
<div className="absolute inset-0 overflow-hidden">
|
||||
<section className="absolute inset-y-0 right-0 flex max-w-full pl-10">
|
||||
<Transition
|
||||
show={open}
|
||||
as={Fragment}
|
||||
enter="transform transition ease-in-out duration-500 sm:duration-700"
|
||||
enterFrom="-translate-x-full"
|
||||
enterTo="translate-x-0"
|
||||
leave="transform transition ease-in-out duration-500 sm:duration-700"
|
||||
leaveFrom="translate-x-0"
|
||||
leaveTo="-translate-x-full"
|
||||
>
|
||||
<div
|
||||
className={clsx(
|
||||
// Subframe Drawer panel layout: min-w-[320px] floor on the side panel width.
|
||||
"w-screen min-w-[320px] max-w-sm",
|
||||
size === "md" && "md:max-w-md",
|
||||
size === "lg" && "md:max-w-lg",
|
||||
size === "2xl" && "md:max-w-2xl",
|
||||
size === "3xl" && "md:max-w-3xl",
|
||||
size === "4xl" && "md:max-w-4xl",
|
||||
size === "full" && "md:max-w-full"
|
||||
)}
|
||||
>
|
||||
<div className="divide-border-default bg-surface-neutral-primary flex h-full flex-col divide-y shadow-2xl">
|
||||
<div className={clsx(paddingY, "h-0 flex-1 space-y-6 overflow-y-scroll")}>
|
||||
{title && (
|
||||
<div className="px-4 sm:px-6">
|
||||
<div className="flex items-start justify-between space-x-3">
|
||||
<h2 className="text-text-neutral-primary text-lg font-medium leading-7">{title}</h2>
|
||||
<div className="flex h-7 items-center">
|
||||
<button
|
||||
onClick={() => onClose()}
|
||||
aria-label={i18nT("components.slideOver.closePanel")}
|
||||
className="hover:text-text-neutral-tertiary text-text-neutral-tertiary transition duration-150 ease-in-out"
|
||||
>
|
||||
<XIcon className="h-6 w-6" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className={clsx(paddingContent, "relative flex-1")}>
|
||||
{content && <div>{content}</div>}
|
||||
{footer && <div className="border-border-default flex shrink-0 justify-end space-x-4 border-t px-1 py-4">{footer}</div>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</section>
|
||||
</div>
|
||||
<div className="absolute right-10 top-4">
|
||||
{!title && (
|
||||
<button
|
||||
onClick={() => onClose()}
|
||||
className="border-border-default text-text-neutral-primary bg-surface-neutral-primary flex items-center space-x-1 rounded-md border px-2 py-1 text-xs font-extrabold uppercase shadow-lg hover:bg-gray-200"
|
||||
>
|
||||
<div>{i18nT("shared.close")}</div>
|
||||
<XIcon className="h-3.5" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
import { ReactNode } from "react";
|
||||
import { t as i18nT } from "i18next";
|
||||
// import { Dialog, DialogBackdrop, DialogPanel, DialogTitle } from "@headlessui/react";
|
||||
import XIcon from "../icons/XIcon";
|
||||
import { ChevronsRightIcon } from "~/components/ui/icons/vendor";
|
||||
import clsx from "clsx";
|
||||
import { cn } from "~/lib/utils";
|
||||
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "~/components/ui/sheet";
|
||||
|
||||
export default function SlideOverWideEmpty({
|
||||
title,
|
||||
description,
|
||||
open,
|
||||
children,
|
||||
onClose,
|
||||
className,
|
||||
buttons,
|
||||
withTitle = true,
|
||||
withClose = true,
|
||||
overflowYScroll,
|
||||
position = 5,
|
||||
size = "2xl",
|
||||
classNameContent,
|
||||
}: {
|
||||
title?: string | ReactNode;
|
||||
description?: string | ReactNode;
|
||||
open: boolean;
|
||||
children: ReactNode;
|
||||
onClose: () => void;
|
||||
className?: string;
|
||||
buttons?: ReactNode;
|
||||
withTitle?: boolean;
|
||||
withClose?: boolean;
|
||||
overflowYScroll?: boolean;
|
||||
position?: 0 | 1 | 2 | 3 | 4 | 5 | 99;
|
||||
size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "full";
|
||||
classNameContent?: string;
|
||||
}) {
|
||||
return (
|
||||
<Sheet
|
||||
open={open}
|
||||
onOpenChange={(e) => {
|
||||
if (!e) {
|
||||
onClose();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{/* <DialogBackdrop transition className="fixed inset-0 bg-gray-500/75 transition-opacity duration-500 ease-in-out data-closed:opacity-0" /> */}
|
||||
|
||||
<SheetContent
|
||||
className={cn(
|
||||
// "pointer-events-auto w-screen max-w-md transform transition duration-500 ease-in-out data-closed:translate-x-full sm:duration-700",
|
||||
className,
|
||||
size === "xs" && "max-w-xs sm:max-w-xs",
|
||||
size === "sm" && "max-w-sm sm:max-w-sm",
|
||||
size === "md" && "max-w-md sm:max-w-md",
|
||||
size === "lg" && "max-w-lg sm:max-w-lg",
|
||||
size === "xl" && "max-w-xl sm:max-w-xl",
|
||||
size === "2xl" && "max-w-2xl sm:max-w-2xl",
|
||||
size === "3xl" && "max-w-3xl sm:max-w-3xl",
|
||||
size === "4xl" && "max-w-4xl sm:max-w-4xl",
|
||||
size === "5xl" && "max-w-5xl sm:max-w-5xl",
|
||||
size === "6xl" && "max-w-6xl sm:max-w-6xl",
|
||||
size === "7xl" && "max-w-7xl sm:max-w-7xl",
|
||||
size === "full" && "max-w-full sm:max-w-full",
|
||||
position === 0 && "z-0",
|
||||
position === 1 && "z-10",
|
||||
position === 2 && "z-20",
|
||||
position === 3 && "z-30",
|
||||
position === 4 && "z-40",
|
||||
position === 5 && "z-50"
|
||||
)}
|
||||
>
|
||||
<div className="bg-surface-neutral-primary flex h-full flex-col overflow-y-auto pt-6 shadow-xl">
|
||||
<div className="px-4 sm:px-6">
|
||||
<div className="flex items-start justify-between">
|
||||
{withTitle ? (
|
||||
<SheetHeader className="flex flex-col px-0">
|
||||
<SheetTitle>{title}</SheetTitle>
|
||||
{description && <SheetDescription>{description}</SheetDescription>}
|
||||
</SheetHeader>
|
||||
) : (
|
||||
<div>
|
||||
<button
|
||||
type="button"
|
||||
className="text-text-neutral-tertiary hover:text-text-neutral-primary focus:shadow-focus rounded-md outline-hidden focus:outline-hidden"
|
||||
onClick={onClose}
|
||||
>
|
||||
<span className="sr-only">{i18nT("components.slideOver.closePanel")}</span>
|
||||
<ChevronsRightIcon className="h-6 w-6" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="ml-3 flex h-7 items-center space-x-4">
|
||||
{buttons}
|
||||
{withClose && (
|
||||
<SheetClose asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="text-text-neutral-tertiary hover:text-text-neutral-primary focus:shadow-focus rounded-md focus:outline-hidden"
|
||||
onClick={onClose}
|
||||
>
|
||||
<span className="sr-only">{i18nT("components.slideOver.closePanel")}</span>
|
||||
<XIcon className="size-4" aria-hidden="true" />
|
||||
</button>
|
||||
</SheetClose>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className={clsx("relative mt-6 flex-1 border-t px-4 pt-5 pb-6 sm:px-6", overflowYScroll && "overflow-y-scroll")}>{children}</div>
|
||||
</div>
|
||||
</SheetContent>
|
||||
</Sheet>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user