feat(BOOK-62): Added new InfoCard component and using that on hotel pages
Approved-by: Bianca Widstam
This commit is contained in:
@@ -64,6 +64,7 @@
|
||||
"./utils/promiseWithTimeout": "./utils/promiseWithTimeout.ts",
|
||||
"./utils/rangeArray": "./utils/rangeArray.ts",
|
||||
"./utils/safeTry": "./utils/safeTry.ts",
|
||||
"./utils/theme": "./utils/theme.ts",
|
||||
"./utils/toCapitalCase": "./utils/toCapitalCase.ts",
|
||||
"./utils/url": "./utils/url.ts",
|
||||
"./utils/zod/*": "./utils/zod/*.ts"
|
||||
|
||||
46
packages/common/utils/theme.ts
Normal file
46
packages/common/utils/theme.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { SignatureHotelEnum } from "@scandic-hotels/common/constants/signatureHotels"
|
||||
import { HotelTypeEnum } from "@scandic-hotels/trpc/enums/hotelType"
|
||||
|
||||
export enum Theme {
|
||||
scandic = "scandic",
|
||||
downtownCamper = "downtown-camper",
|
||||
haymarket = "haymarket",
|
||||
scandicGo = "scandic-go",
|
||||
grandHotel = "grand-hotel",
|
||||
hotelNorge = "hotel-norge",
|
||||
marski = "marski",
|
||||
theDock = "the-dock",
|
||||
}
|
||||
|
||||
export const DEFAULT_THEME = Theme.scandic
|
||||
export const THEMES = Object.values(Theme)
|
||||
|
||||
function getSignatureHotelTheme(hotelId: string) {
|
||||
switch (hotelId) {
|
||||
case SignatureHotelEnum.Haymarket:
|
||||
return Theme.haymarket
|
||||
case SignatureHotelEnum.HotelNorge:
|
||||
return Theme.hotelNorge
|
||||
case SignatureHotelEnum.DowntownCamper:
|
||||
return Theme.downtownCamper
|
||||
case SignatureHotelEnum.GrandHotelOslo:
|
||||
return Theme.grandHotel
|
||||
case SignatureHotelEnum.Marski:
|
||||
return Theme.marski
|
||||
case SignatureHotelEnum.TheDock:
|
||||
return Theme.theDock
|
||||
default:
|
||||
return DEFAULT_THEME
|
||||
}
|
||||
}
|
||||
|
||||
export function getThemeByHotel(hotelId: string, hotelType: string) {
|
||||
if (hotelType === HotelTypeEnum.ScandicGo) {
|
||||
return Theme.scandicGo
|
||||
}
|
||||
if (hotelType === HotelTypeEnum.Signature) {
|
||||
return getSignatureHotelTheme(hotelId)
|
||||
}
|
||||
|
||||
return DEFAULT_THEME
|
||||
}
|
||||
Reference in New Issue
Block a user