fix: add login/logout buttons
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
"use client"
|
||||
import { useParams } from "next/navigation"
|
||||
import { useState } from "react"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { login } from "@/constants/routes/handleAuth"
|
||||
import { myPages } from "@/constants/routes/myPages"
|
||||
import { _ } from "@/lib/translation"
|
||||
|
||||
import Image from "@/components/Image"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
|
||||
import BookingButton from "../BookingButton"
|
||||
|
||||
@@ -16,9 +23,13 @@ export function MainMenu({
|
||||
logo,
|
||||
topMenuMobileLinks,
|
||||
languageSwitcher,
|
||||
bookingHref,
|
||||
isLoggedIn,
|
||||
}: MainMenuProps) {
|
||||
const [isOpen, setIsOpen] = useState(false)
|
||||
|
||||
const lang = useParams().lang as Lang
|
||||
|
||||
function toogleIsOpen() {
|
||||
setIsOpen((prevIsOpen) => !prevIsOpen)
|
||||
}
|
||||
@@ -59,6 +70,52 @@ export function MainMenu({
|
||||
<ul
|
||||
className={`${styles.listWrapper} ${isOpen ? styles.isOpen : ""}`}
|
||||
>
|
||||
<ul className={styles.linkRow}>
|
||||
{isLoggedIn ? (
|
||||
<>
|
||||
<li>
|
||||
<div className={styles.loggedInLogo} />
|
||||
</li>
|
||||
<li className={styles.mobileLinkRow}>
|
||||
<Link
|
||||
className={styles.mobileLinkButton}
|
||||
href={myPages[lang]}
|
||||
>
|
||||
{_("My pages")}
|
||||
</Link>
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<li>
|
||||
<Image
|
||||
src="/_static/img/icon-scandic-friends.svg"
|
||||
alt="Scanidc Friends Logo"
|
||||
height={35}
|
||||
width={35}
|
||||
className={styles.scandicFriendsLogo}
|
||||
/>
|
||||
</li>
|
||||
<li className={styles.mobileLinkRow}>
|
||||
<Link
|
||||
className={styles.mobileLinkButton}
|
||||
href={login[lang]}
|
||||
>
|
||||
{_("Log in")}
|
||||
</Link>
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
|
||||
<li className={styles.mobileLinkRow}>
|
||||
<span className={styles.mobileSeparator} />
|
||||
</li>
|
||||
<li className={styles.mobileLinkRow}>
|
||||
<a className={styles.mobileLinkButton} href="">
|
||||
{_("Find booking")}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul className={styles.mainLinks}>
|
||||
{links.map((link, i) => (
|
||||
<li className={styles.li} key={link.href + i}>
|
||||
@@ -84,7 +141,7 @@ export function MainMenu({
|
||||
) : null}
|
||||
</ul>
|
||||
<div className={styles.buttonContainer}>
|
||||
<BookingButton />
|
||||
<BookingButton href={bookingHref} />
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
top: 0;
|
||||
width: 100%;
|
||||
z-index: 99999;
|
||||
height: 52.39px;
|
||||
}
|
||||
|
||||
.container {
|
||||
@@ -25,7 +26,8 @@
|
||||
.navBar {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 80px 1fr;
|
||||
height: 52.39px;
|
||||
grid-template-rows: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.expanderBtn {
|
||||
@@ -154,6 +156,57 @@
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.linkRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-bottom: 1px solid #e3e0db;
|
||||
background-color: #f3f2f1 !important;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.scandicFriendsLogo {
|
||||
margin-right: 4px;
|
||||
margin-left: -4px;
|
||||
}
|
||||
|
||||
.mobileLinkRow {
|
||||
margin: 6px 0;
|
||||
padding: 15px 15px 15px 5px;
|
||||
}
|
||||
|
||||
.loggedInLogo {
|
||||
height: 35px;
|
||||
width: 35px;
|
||||
border-radius: 50px;
|
||||
background-color: #000;
|
||||
margin-right: 4px;
|
||||
margin-left: -4px;
|
||||
}
|
||||
|
||||
.mobileLinkButton {
|
||||
font-size: 14px;
|
||||
font-family:
|
||||
Helvetica Neue,
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif;
|
||||
font-weight: 700;
|
||||
background-color: transparent !important;
|
||||
text-decoration: none;
|
||||
color: #000;
|
||||
outline-color: transparent;
|
||||
}
|
||||
|
||||
.mobileSeparator {
|
||||
border-left: 1px solid #e3e0db;
|
||||
height: 35px;
|
||||
margin-bottom: -12px;
|
||||
margin-left: -1px;
|
||||
margin-top: -12px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.mobileList {
|
||||
padding-top: 6px;
|
||||
}
|
||||
@@ -187,6 +240,7 @@
|
||||
background-color: hsla(0, 0%, 100%, 0.95);
|
||||
position: relative;
|
||||
z-index: unset;
|
||||
height: 85.09px;
|
||||
}
|
||||
|
||||
.container {
|
||||
@@ -201,7 +255,9 @@
|
||||
.navBar {
|
||||
grid-template-columns: 132.18px 1fr auto;
|
||||
align-content: center;
|
||||
height: 85.09px;
|
||||
padding-bottom: 2px;
|
||||
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.expanderBtn {
|
||||
@@ -217,9 +273,8 @@
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 102.18px;
|
||||
object-fit: cover;
|
||||
height: auto;
|
||||
width: 102.17px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.listWrapper {
|
||||
@@ -250,6 +305,10 @@
|
||||
padding: 30px 15px;
|
||||
}
|
||||
|
||||
.linkRow {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mobileList {
|
||||
display: none;
|
||||
padding-top: 0px;
|
||||
@@ -258,12 +317,18 @@
|
||||
.mobileLi {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.buttonContainer {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.mainMenu {
|
||||
height: 82.4px;
|
||||
}
|
||||
.navBar {
|
||||
grid-template-columns: 140px auto 1fr;
|
||||
height: 82.4px;
|
||||
}
|
||||
|
||||
.logoLink {
|
||||
|
||||
Reference in New Issue
Block a user