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,53 @@
|
||||
import { XIcon } from "~/components/ui/icons/vendor";
|
||||
import { ReactNode } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router";
|
||||
import { BannerAlert } from "~/ui/components/BannerAlert";
|
||||
|
||||
// Subframe migration (strangler shim):
|
||||
// Keeps the original ErrorBanner API but renders the Subframe design-system BannerAlert
|
||||
// (type="error"). BannerAlert has no separate title slot, so the title is composed into the
|
||||
// content (rendered bold) alongside text/redirect/children — same as before, all ReactNode.
|
||||
// `redirect` maps to BannerAlert's `actionLabel` (the underlined action). `onDismiss` is NOT
|
||||
// mapped to BannerAlert's `dismissible` button because that button is a non-functional design
|
||||
// mock (no onClick); the original functional dismiss button is overlaid to preserve behavior.
|
||||
|
||||
interface Props {
|
||||
title?: ReactNode;
|
||||
text?: ReactNode | string;
|
||||
redirect?: string;
|
||||
children?: ReactNode;
|
||||
onDismiss?: () => void;
|
||||
}
|
||||
|
||||
export default function ErrorBanner({ title, text = "", redirect, children, onDismiss }: Props) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="not-prose relative">
|
||||
<BannerAlert
|
||||
type="error"
|
||||
fillContainer
|
||||
actionLabel={
|
||||
redirect ? (
|
||||
<Link to={redirect}>
|
||||
{t("shared.goTo")} {redirect}
|
||||
</Link>
|
||||
) : undefined
|
||||
}
|
||||
>
|
||||
<span className="font-medium">{title ?? t("shared.error")}</span>{" "}
|
||||
{text}
|
||||
{children}
|
||||
</BannerAlert>
|
||||
|
||||
{onDismiss && (
|
||||
<div className="absolute top-4 right-4">
|
||||
<button type="button" onClick={onDismiss} className="text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-200">
|
||||
<span className="sr-only">{t("shared.close")}</span>
|
||||
<XIcon className="size-4" />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { ReactNode } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router";
|
||||
import { BannerAlert } from "~/ui/components/BannerAlert";
|
||||
|
||||
// Subframe migration (strangler shim):
|
||||
// Keeps the original InfoBanner API but renders the Subframe design-system BannerAlert
|
||||
// (type="information"). BannerAlert has no separate title slot, so the title is composed into the
|
||||
// content (rendered bold) alongside text/redirect/children — same as before, all ReactNode.
|
||||
// `redirect` maps to BannerAlert's `actionLabel` (the underlined action).
|
||||
|
||||
interface Props {
|
||||
title?: ReactNode;
|
||||
text?: ReactNode | string;
|
||||
redirect?: string;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
export default function InfoBanner({ title, text = "", redirect, children }: Props) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<BannerAlert
|
||||
className="not-prose"
|
||||
type="information"
|
||||
fillContainer
|
||||
actionLabel={
|
||||
redirect ? (
|
||||
<Link to={redirect}>
|
||||
{t("shared.goTo")} {redirect}
|
||||
</Link>
|
||||
) : undefined
|
||||
}
|
||||
>
|
||||
<span className="font-medium">{title ?? t("shared.note")}</span>{" "}
|
||||
{text}
|
||||
{children}
|
||||
</BannerAlert>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import InfoBanner from "./InfoBanner";
|
||||
import { t as i18nT } from "i18next";
|
||||
import WarningBanner from "./WarningBanner";
|
||||
|
||||
export default function PreviewBanners() {
|
||||
return (
|
||||
<div id="banners" className="not-prose text-foreground w-full space-y-2">
|
||||
<h3 className="text-sm font-medium">{i18nT("components.banners.preview.info")}</h3>
|
||||
<InfoBanner title={i18nT("components.banners.preview.infoTitle")} text={i18nT("components.banners.preview.sampleText")} />
|
||||
|
||||
<h3 className="text-sm font-medium">{i18nT("components.banners.preview.warning")}</h3>
|
||||
<WarningBanner title={i18nT("components.banners.preview.warning")} text={i18nT("components.banners.preview.sampleText")} />
|
||||
|
||||
<h3 className="text-sm font-medium">{i18nT("components.banners.preview.warningWithLink")}</h3>
|
||||
<WarningBanner
|
||||
title={i18nT("components.banners.preview.warningWithRedirect")}
|
||||
text={i18nT("components.banners.preview.sampleText")}
|
||||
redirect="https://www.example.com"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import { ReactNode } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router";
|
||||
import { BannerAlert } from "~/ui/components/BannerAlert";
|
||||
|
||||
// Subframe migration (strangler shim):
|
||||
// Keeps the original SuccessBanner API but renders the Subframe design-system BannerAlert
|
||||
// (type="success"). BannerAlert has no separate title slot, so the (optional, translated) title
|
||||
// is composed into the content (rendered bold) alongside text/redirect/children. As before, the
|
||||
// title is only shown when provided and is passed through `t()`. `redirect` maps to
|
||||
// BannerAlert's `actionLabel` (the underlined action).
|
||||
|
||||
interface Props {
|
||||
title?: string;
|
||||
text?: ReactNode | string;
|
||||
redirect?: string;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
export default function SuccessBanner({ title, text = "", redirect, children }: Props) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<BannerAlert
|
||||
className="not-prose"
|
||||
type="success"
|
||||
fillContainer
|
||||
actionLabel={
|
||||
redirect ? (
|
||||
<Link to={redirect}>
|
||||
{t("shared.goTo")} {redirect}
|
||||
</Link>
|
||||
) : undefined
|
||||
}
|
||||
>
|
||||
{title && <span className="font-medium">{t(title)} </span>}
|
||||
{text}
|
||||
{children}
|
||||
</BannerAlert>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { ReactNode } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router";
|
||||
import { BannerAlert } from "~/ui/components/BannerAlert";
|
||||
|
||||
// Subframe migration (strangler shim):
|
||||
// Keeps the original WarningBanner API but renders the Subframe design-system BannerAlert
|
||||
// (type="warning"). BannerAlert has no separate title slot, so the title is composed into the
|
||||
// content (rendered bold) alongside text/redirect/children — same as before, all ReactNode.
|
||||
// `redirect` maps to BannerAlert's `actionLabel` (the underlined action).
|
||||
|
||||
interface Props {
|
||||
title?: ReactNode;
|
||||
text?: ReactNode;
|
||||
redirect?: string;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
export default function WarningBanner({ title, text = "", redirect, children }: Props) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<BannerAlert
|
||||
className="not-prose"
|
||||
type="warning"
|
||||
fillContainer
|
||||
actionLabel={
|
||||
redirect ? (
|
||||
<Link to={redirect}>
|
||||
{t("shared.goTo")} {redirect}
|
||||
</Link>
|
||||
) : undefined
|
||||
}
|
||||
>
|
||||
<span className="font-medium">{title ?? t("shared.warning")}</span>{" "}
|
||||
{text}
|
||||
{children}
|
||||
</BannerAlert>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user