Merged in feat/SW-3520-update-footer-ui-and-footer-link (pull request #2910)
feat(SW-3520): Updated the footer * feat(SW-3520): Updated links to route to scandic web * feat(SW-3520): Updated the footer with language switcher * feat(SW-3520): Updated the Contact-us link and removed double slash Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -20,11 +20,14 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import Link from "@scandic-hotels/design-system/Link"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
import { languageSwitcherVariants } from "./variants"
|
||||
|
||||
import styles from "./languageSwitcher.module.css"
|
||||
|
||||
type LanguageSwitcherProps = {
|
||||
currentLanguage: Lang
|
||||
isMobile?: boolean
|
||||
type?: "footer" | "header"
|
||||
}
|
||||
|
||||
export function replaceUrlPart(currentPath: string, newPart: string): string {
|
||||
@@ -50,12 +53,16 @@ export function replaceUrlPart(currentPath: string, newPart: string): string {
|
||||
export function LanguageSwitcher({
|
||||
currentLanguage,
|
||||
isMobile = false,
|
||||
type = "header",
|
||||
}: LanguageSwitcherProps) {
|
||||
const classNames = languageSwitcherVariants({ position: type })
|
||||
const isFooter = type === "footer"
|
||||
|
||||
return (
|
||||
<div className={styles.languageSwitcher}>
|
||||
<div className={classNames}>
|
||||
<DialogTrigger>
|
||||
<Button className={styles.triggerButton} variant={"Text"} wrapping>
|
||||
{isMobile ? null : (
|
||||
{isMobile && !isFooter ? null : (
|
||||
<MaterialIcon
|
||||
icon="globe"
|
||||
size={16}
|
||||
@@ -82,7 +89,10 @@ export function LanguageSwitcher({
|
||||
</Typography>
|
||||
</Button>
|
||||
{isMobile ? (
|
||||
<ModalOverlay isDismissable className={styles.languageModalOverlay}>
|
||||
<ModalOverlay
|
||||
isDismissable
|
||||
className={`${styles.languageModalOverlay} ${isFooter ? styles.footer : null}`}
|
||||
>
|
||||
<Modal className={styles.languageModal}>
|
||||
<Dialog>
|
||||
{({ close }) => (
|
||||
@@ -96,7 +106,11 @@ export function LanguageSwitcher({
|
||||
</Modal>
|
||||
</ModalOverlay>
|
||||
) : (
|
||||
<Popover offset={28} className={styles.languageSwitcherPopover}>
|
||||
<Popover
|
||||
offset={isFooter ? 0 : 21}
|
||||
className={styles.languageSwitcherPopover}
|
||||
placement={"bottom right"}
|
||||
>
|
||||
<Dialog>
|
||||
{({ close }) => (
|
||||
<LanguageSwitcherContent
|
||||
@@ -142,19 +156,27 @@ function LanguageSwitcherContent({
|
||||
<div className={styles.languageSwitcherContent}>
|
||||
{isMobile ? (
|
||||
<>
|
||||
<Button
|
||||
variant={"Text"}
|
||||
size={"Medium"}
|
||||
onPress={closeModal}
|
||||
className={styles.arrowBack}
|
||||
>
|
||||
<MaterialIcon
|
||||
icon="chevron_left"
|
||||
size={28}
|
||||
className={styles.arrowBackIcon}
|
||||
color={"CurrentColor"}
|
||||
/>
|
||||
</Button>
|
||||
<div className={styles.closeModalWrapper}>
|
||||
<Button
|
||||
variant={"Text"}
|
||||
size={"Medium"}
|
||||
onPress={closeModal}
|
||||
className={styles.closeModal}
|
||||
>
|
||||
<MaterialIcon
|
||||
icon="chevron_left"
|
||||
size={28}
|
||||
className={styles.arrowBackIcon}
|
||||
color={"CurrentColor"}
|
||||
/>
|
||||
<MaterialIcon
|
||||
icon="close"
|
||||
size={32}
|
||||
className={styles.closeIcon}
|
||||
color={"CurrentColor"}
|
||||
/>
|
||||
</Button>
|
||||
</div>
|
||||
<Typography variant={"Title/Subtitle/md"}>
|
||||
<h3 className={styles.title}>
|
||||
{intl.formatMessage({
|
||||
@@ -180,7 +202,7 @@ function LanguageSwitcherContent({
|
||||
}
|
||||
>
|
||||
<Link
|
||||
className={styles.link}
|
||||
className={`${styles.link} ${isActive ? styles.active : ""}`}
|
||||
href={replaceUrlPart(pathname, url)}
|
||||
variant="languageSwitcher"
|
||||
keepSearchParams
|
||||
|
||||
Reference in New Issue
Block a user