chore: create a IntroSectionProps type

This commit is contained in:
Chuma McPhoy
2024-07-08 12:36:38 +02:00
parent 295e009e77
commit aff27f64a7
4 changed files with 26 additions and 15 deletions

View File

@@ -19,21 +19,22 @@ export default async function HotelPage({ lang }: LangParams) {
hotelId: hotelPageIdentifierData.hotel_page_id,
language: lang,
})
const hotelAttributes = hotelPageData.data.attributes
return (
<main className={styles.pageContainer}>
<div className={styles.introContainer}>
<IntroSection
hotelName={hotelPageData.data.attributes.name}
hotelName={hotelAttributes.name}
hotelDescription={
hotelPageData.data.attributes.hotelContent.texts.descriptions.short
hotelAttributes.hotelContent.texts.descriptions.short
}
location={hotelPageData.data.attributes.location}
address={hotelPageData.data.attributes.address}
tripAdvisor={hotelPageData.data.attributes.ratings.tripAdvisor}
location={hotelAttributes.location}
address={hotelAttributes.address}
tripAdvisor={hotelAttributes.ratings.tripAdvisor}
/>
<AmenitiesList
detailedFacilities={hotelPageData.data.attributes.detailedFacilities}
detailedFacilities={hotelAttributes.detailedFacilities}
/>
</div>
</main>

View File

@@ -7,9 +7,9 @@ import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
import Title from "@/components/TempDesignSystem/Text/Title"
import { getIntl } from "@/i18n"
import styles from "./introSection.module.css"
import { IntroSectionProps } from "./types"
import { HotelAddress, HotelData, HotelLocation } from "@/types/hotel"
import styles from "./introSection.module.css"
export default async function IntroSection({
hotelName,
@@ -17,13 +17,7 @@ export default async function IntroSection({
location,
address,
tripAdvisor,
}: {
hotelName: HotelData["data"]["attributes"]["name"]
hotelDescription: HotelData["data"]["attributes"]["hotelContent"]["texts"]["descriptions"]["short"]
location: HotelLocation
address: HotelAddress
tripAdvisor: HotelData["data"]["attributes"]["ratings"]["tripAdvisor"]
}) {
}: IntroSectionProps) {
const intl = await getIntl()
const { formatMessage } = intl
const { streetAddress, city } = address

View File

@@ -0,0 +1,14 @@
import {
HotelAddress,
HotelData,
HotelLocation,
HotelTripAdvisor,
} from "@/types/hotel"
export type IntroSectionProps = {
hotelName: HotelData["data"]["attributes"]["name"]
hotelDescription: HotelData["data"]["attributes"]["hotelContent"]["texts"]["descriptions"]["short"]
location: HotelLocation
address: HotelAddress
tripAdvisor: HotelTripAdvisor
}