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 Link from "@/components/TempDesignSystem/Link"
|
||||||
import useHash from "@/hooks/useHash"
|
import useHash from "@/hooks/useHash"
|
||||||
|
|
||||||
import { HotelHashValues } from "./types"
|
|
||||||
|
|
||||||
import styles from "./tabNavigation.module.css"
|
import styles from "./tabNavigation.module.css"
|
||||||
|
|
||||||
|
import { HotelHashValues } from "@/types/components/hotelPage/tabNavigation"
|
||||||
|
|
||||||
export default function TabNavigation() {
|
export default function TabNavigation() {
|
||||||
const hash = useHash()
|
const hash = useHash()
|
||||||
const { formatMessage } = useIntl()
|
const { formatMessage } = useIntl()
|
||||||
const hotelTabLinks: { href: HotelHashValues; text: string }[] = [
|
const hotelTabLinks: { href: HotelHashValues; text: string }[] = [
|
||||||
{ href: "#overview", text: "Overview" },
|
{ href: HotelHashValues.overview, text: "Overview" },
|
||||||
{ href: "#rooms-section", text: "Rooms" },
|
{ href: HotelHashValues.rooms, text: "Rooms" },
|
||||||
{ href: "#restaurant-and-bar", text: "Restaurant & Bar" },
|
{ href: HotelHashValues.restaurant, text: "Restaurant & Bar" },
|
||||||
{ href: "#meetings-and-conferences", text: "Meetings & Conferences" },
|
{ href: HotelHashValues.meetings, text: "Meetings & Conferences" },
|
||||||
{ href: "#wellness-and-exercise", text: "Wellness & Exercise" },
|
{ href: HotelHashValues.wellness, text: "Wellness & Exercise" },
|
||||||
{ href: "#activities", text: "Activities" },
|
{ href: HotelHashValues.activities, text: "Activities" },
|
||||||
{ href: "#faq", text: "FAQ" },
|
{ href: HotelHashValues.faq, text: "FAQ" },
|
||||||
]
|
]
|
||||||
return (
|
return (
|
||||||
<nav className={styles.tabsContainer}>
|
<nav className={styles.tabsContainer}>
|
||||||
{hotelTabLinks.map((link) => {
|
{hotelTabLinks.map((link) => {
|
||||||
const isActive =
|
const isActive =
|
||||||
hash === link.href || (hash === "" && link.href === "#overview")
|
hash === link.href ||
|
||||||
|
(hash === "" && link.href === HotelHashValues.overview)
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
key={link.href}
|
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