Files
web/apps/scandic-web/components/Webviews/LinkToOverview/index.tsx
Linus Flood 456e10c674 Merged in feat/webview-hide-overview-back (pull request #2684)
feat(webview): flag to show/hide back to overview-button

* feat(webview): flag to show/hide back to overview-button


Approved-by: Joakim Jäderberg
2025-08-21 12:32:08 +00:00

33 lines
885 B
TypeScript

import { ArrowLeft } from "react-feather"
import Link from "@scandic-hotels/design-system/Link"
import { overview } from "@/constants/routes/webviews"
import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import { webviewSearchParams } from "@/utils/webviews"
import styles from "./linkToOverview.module.css"
import { env } from "@/env/server"
export default async function LinkToOverview() {
if (!env.WEBVIEW_SHOW_OVERVIEW) {
return null
}
const intl = await getIntl()
const searchParams = await webviewSearchParams()
const lang = await getLang()
const overviewHref = `${overview[lang]}?${searchParams.toString()}`
return (
<Link className={styles.overviewLink} href={overviewHref}>
<ArrowLeft height={20} width={20} />
{intl.formatMessage({
defaultMessage: "Go back to overview",
})}
</Link>
)
}