refactor(feat-SW-94): use enum for HotelHashValues and move to types/components dir
This commit is contained in:
@@ -4,27 +4,28 @@ import { useIntl } from "react-intl"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
import useHash from "@/hooks/useHash"
|
||||
|
||||
import { HotelHashValues } from "./types"
|
||||
|
||||
import styles from "./tabNavigation.module.css"
|
||||
|
||||
import { HotelHashValues } from "@/types/components/hotelPage/tabNavigation"
|
||||
|
||||
export default function TabNavigation() {
|
||||
const hash = useHash()
|
||||
const { formatMessage } = useIntl()
|
||||
const hotelTabLinks: { href: HotelHashValues; text: string }[] = [
|
||||
{ href: "#overview", text: "Overview" },
|
||||
{ href: "#rooms-section", text: "Rooms" },
|
||||
{ href: "#restaurant-and-bar", text: "Restaurant & Bar" },
|
||||
{ href: "#meetings-and-conferences", text: "Meetings & Conferences" },
|
||||
{ href: "#wellness-and-exercise", text: "Wellness & Exercise" },
|
||||
{ href: "#activities", text: "Activities" },
|
||||
{ href: "#faq", text: "FAQ" },
|
||||
{ href: HotelHashValues.overview, text: "Overview" },
|
||||
{ href: HotelHashValues.rooms, text: "Rooms" },
|
||||
{ href: HotelHashValues.restaurant, text: "Restaurant & Bar" },
|
||||
{ href: HotelHashValues.meetings, text: "Meetings & Conferences" },
|
||||
{ href: HotelHashValues.wellness, text: "Wellness & Exercise" },
|
||||
{ href: HotelHashValues.activities, text: "Activities" },
|
||||
{ href: HotelHashValues.faq, text: "FAQ" },
|
||||
]
|
||||
return (
|
||||
<nav className={styles.tabsContainer}>
|
||||
{hotelTabLinks.map((link) => {
|
||||
const isActive =
|
||||
hash === link.href || (hash === "" && link.href === "#overview")
|
||||
hash === link.href ||
|
||||
(hash === "" && link.href === HotelHashValues.overview)
|
||||
return (
|
||||
<Link
|
||||
key={link.href}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
export type HotelHashValues =
|
||||
| "#overview"
|
||||
| "#rooms-section"
|
||||
| "#restaurant-and-bar"
|
||||
| "#meetings-and-conferences"
|
||||
| "#wellness-and-exercise"
|
||||
| "#activities"
|
||||
| "#faq"
|
||||
9
types/components/hotelPage/tabNavigation.ts
Normal file
9
types/components/hotelPage/tabNavigation.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export enum HotelHashValues {
|
||||
overview = "#overview",
|
||||
rooms = "#rooms-section",
|
||||
restaurant = "#restaurant-and-bar",
|
||||
meetings = "#meetings-and-conferences",
|
||||
wellness = "#wellness-and-exercise",
|
||||
activities = "#activities",
|
||||
faq = "#faq",
|
||||
}
|
||||
Reference in New Issue
Block a user