Merge branch 'develop' of bitbucket.org:scandic-swap/web into feature/tracking

This commit is contained in:
Linus Flood
2024-10-03 15:18:54 +02:00
99 changed files with 3064 additions and 766 deletions

View File

@@ -1,53 +1,21 @@
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"
export function getTheme(theme: CardProps["theme"]): ButtonProps["theme"] {
switch (theme) {
case "one":
buttonTheme = "primaryLight"
primaryLinkColor = "pale"
secondaryLinkColor = "burgundy"
break
case "two":
buttonTheme = "secondaryLight"
primaryLinkColor = "pale"
secondaryLinkColor = "burgundy"
break
return "secondaryLight"
case "three":
buttonTheme = "tertiaryLight"
primaryLinkColor = "pale"
secondaryLinkColor = "burgundy"
break
return "tertiaryLight"
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
return "primaryDark"
case "primaryStrong":
case "image":
buttonTheme = "primaryStrong"
primaryLinkColor = "red"
secondaryLinkColor = "white"
}
return {
buttonTheme: buttonTheme,
primaryLinkColor: primaryLinkColor,
secondaryLinkColor: secondaryLinkColor,
return "primaryStrong"
case "one":
case "primaryDim":
case "primaryInverted":
default:
return "primaryLight"
}
}

10
utils/debounce.ts Normal file
View File

@@ -0,0 +1,10 @@
export function debounce(func: Function, delay = 300) {
let debounceTimer: ReturnType<typeof setTimeout>
return function () {
// @ts-expect-error this in TypeScript
const context = this
const args = arguments
clearTimeout(debounceTimer)
debounceTimer = setTimeout(() => func.apply(context, args), delay)
}
}

View File

@@ -14,8 +14,14 @@ export function insertResponseToImageVaultAsset(
meta.Name.includes("Title_")
)?.Value
const mediaConversion = response.MediaConversions[0]
const aspectRatio =
mediaConversion.FormatAspectRatio ||
mediaConversion.AspectRatio ||
mediaConversion.Width / mediaConversion.Height
return {
url: response.MediaConversions[0].Url,
url: mediaConversion.Url,
id: response.Id,
meta: {
alt,
@@ -23,9 +29,9 @@ export function insertResponseToImageVaultAsset(
},
title: response.Name,
dimensions: {
width: response.MediaConversions[0].Width,
height: response.MediaConversions[0].Height,
aspectRatio: response.MediaConversions[0].FormatAspectRatio,
width: mediaConversion.Width,
height: mediaConversion.Height,
aspectRatio,
},
}
}