feat(SW-93): add mocked facility cards

This commit is contained in:
Matilda Landström
2024-08-29 16:51:19 +02:00
parent 7742fc1259
commit 93e54b4ca1
22 changed files with 632 additions and 63 deletions

52
utils/cardTheme.ts Normal file
View File

@@ -0,0 +1,52 @@
import type { ButtonProps } from "@/components/TempDesignSystem/Button/button"
import type { CardProps } from "@/components/TempDesignSystem/Card/card"
import type { LinkProps } from "@/components/TempDesignSystem/Link/link"
export function getTheme(theme: CardProps["theme"]) {
let buttonTheme: ButtonProps["theme"] = "primaryLight"
let primaryLinkColor: LinkProps["color"] = "pale"
let secondaryLinkColor: LinkProps["color"] = "burgundy"
switch (theme) {
case "one":
buttonTheme = "primaryLight"
primaryLinkColor = "pale"
secondaryLinkColor = "burgundy"
break
case "two":
buttonTheme = "secondaryLight"
primaryLinkColor = "pale"
secondaryLinkColor = "burgundy"
break
case "three":
buttonTheme = "tertiaryLight"
primaryLinkColor = "pale"
secondaryLinkColor = "burgundy"
break
case "primaryDark":
buttonTheme = "primaryDark"
primaryLinkColor = "burgundy"
secondaryLinkColor = "pale"
break
case "primaryDim":
buttonTheme = "primaryLight"
primaryLinkColor = "pale"
secondaryLinkColor = "burgundy"
break
case "primaryInverted":
buttonTheme = "primaryLight"
primaryLinkColor = "pale"
secondaryLinkColor = "burgundy"
break
case "primaryStrong" || "image":
buttonTheme = "primaryStrong"
primaryLinkColor = "red"
secondaryLinkColor = "white"
}
return {
buttonTheme: buttonTheme,
primaryLinkColor: primaryLinkColor,
secondaryLinkColor: secondaryLinkColor,
}
}

18
utils/imageCard.ts Normal file
View File

@@ -0,0 +1,18 @@
import type {
Facility,
FacilityCard,
} from "@/types/components/hotelPage/facilities"
export function sortCards(grid: Facility) {
const sortedCards = grid.slice(0).sort((a: FacilityCard, b: FacilityCard) => {
if (!a.backgroundImage && b.backgroundImage) {
return 1
}
if (a.backgroundImage && !b.backgroundImage) {
return -1
}
return 0
})
return { card: sortedCards.pop(), images: sortedCards }
}