40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
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>
|
|
);
|
|
}
|