Merged in feat/SW-2782-create-sas-branded-header (pull request #2878)

feat(SW-2782): Updated header as per design, added language switcher and user menu

* feat(SW-2782): Updated header as per design, added language switcher and user menu

* feat(SW-2782): Updated UI as per design

* feat(SW-2782): Optimised code with use of Popover and modal from RAC


Approved-by: Anton Gunnarsson
This commit is contained in:
Hrishikesh Vaipurkar
2025-10-06 08:46:26 +00:00
parent e18bba79c6
commit d3368e9b85
27 changed files with 985 additions and 125 deletions
@@ -0,0 +1,49 @@
"use client"
import { useState } from "react"
import { Dialog, Modal } from "react-aria-components"
import { useIntl } from "react-intl"
import { Button } from "@scandic-hotels/design-system/Button"
import { UserMenu } from "../UserMenu"
import styles from "./mobile-menu.module.css"
export function MobileMenu({ children }: React.PropsWithChildren) {
const intl = useIntl()
const closeMsg = intl.formatMessage({
defaultMessage: "Close menu",
})
const openMsg = intl.formatMessage({
defaultMessage: "Open menu",
})
const [isOpen, setIsOpen] = useState(false)
return (
<div className={styles.mobileMenu}>
<UserMenu isMobile={true} />
<Button
variant={"Text"}
type="button"
className={`${styles.hamburger} ${isOpen ? styles.isExpanded : ""}`}
aria-label={isOpen ? closeMsg : openMsg}
onPress={() => setIsOpen(!isOpen)}
>
<span className={styles.bar} />
</Button>
<Modal className={styles.modal} isOpen={isOpen}>
<Dialog
className={styles.dialog}
aria-label={intl.formatMessage({
defaultMessage: "Menu",
})}
>
{children}
</Dialog>
</Modal>
</div>
)
}
@@ -0,0 +1,104 @@
.mobileMenu {
display: flex;
align-items: center;
gap: var(--Space-x1);
}
.mobileMenu .avatar {
background-color: white;
span {
color: var(--TEMP-sas-20);
}
}
.hamburger {
background-color: transparent;
border: none;
cursor: pointer;
justify-self: flex-start;
padding: 19px 8px 18px;
user-select: none;
}
.bar,
.bar::after,
.bar::before {
background: white;
border-radius: 2.3px;
display: block;
height: 3px;
position: relative;
transition: all 0.3s;
width: 32px;
}
.bar::after,
.bar::before {
content: "";
left: 0;
position: absolute;
transform-origin: 2.286px center;
}
.bar::after {
top: -8px;
}
.bar::before {
top: 8px;
}
.isExpanded .bar {
background: transparent;
}
.isExpanded .bar::after,
.isExpanded .bar::before {
top: 0;
transform-origin: 50% 50%;
width: 32px;
}
.isExpanded .bar::after {
transform: rotate(-45deg);
}
.isExpanded .bar::before {
transform: rotate(45deg);
}
.modal {
position: fixed;
top: calc(var(--main-menu-mobile-height) + var(--sitewide-alert-height));
right: auto;
bottom: 0;
width: 100%;
background-color: var(--Base-Surface-Primary-light-Normal);
transition: right 0.3s;
z-index: var(--menu-overlay-z-index);
}
.dialog {
height: 100%;
overflow-y: auto;
display: flex;
align-content: space-between;
padding: var(--Space-x3) var(--Space-x2) var(--Space-x4);
flex-direction: column;
gap: var(--Space-x2);
}
.footer {
background-color: var(--Base-Surface-Subtle-Normal);
padding: var(--Space-x4) var(--Space-x2);
display: grid;
gap: var(--Space-x2);
}
@media screen and (min-width: 768px) {
.avatar,
.hamburger,
.modal {
display: none;
}
}