Merged in fix/3697-prettier-configs (pull request #3396)
fix(SW-3691): Setup one prettier config for whole repo * Setup prettierrc in root and remove other configs Approved-by: Joakim Jäderberg Approved-by: Linus Flood
This commit is contained in:
@@ -1,32 +1,32 @@
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
import type { VariantProps } from "class-variance-authority"
|
||||
|
||||
import { Theme } from '@scandic-hotels/common/utils/theme'
|
||||
import type { variants as buttonVariants } from '../Button/variants'
|
||||
import type { infoCardVariants } from './variants'
|
||||
import { Theme } from "@scandic-hotels/common/utils/theme"
|
||||
import type { variants as buttonVariants } from "../Button/variants"
|
||||
import type { infoCardVariants } from "./variants"
|
||||
|
||||
type ButtonVariants = VariantProps<typeof buttonVariants>
|
||||
type InfoCardButtonProps = {
|
||||
primaryButton: {
|
||||
variant: ButtonVariants['variant']
|
||||
color: ButtonVariants['color']
|
||||
variant: ButtonVariants["variant"]
|
||||
color: ButtonVariants["color"]
|
||||
}
|
||||
secondaryButton: {
|
||||
variant: ButtonVariants['variant']
|
||||
color: ButtonVariants['color']
|
||||
variant: ButtonVariants["variant"]
|
||||
color: ButtonVariants["color"]
|
||||
}
|
||||
}
|
||||
|
||||
const PRIMARY = { variant: 'Primary', color: 'Primary' } as const
|
||||
const PRIMARY_INVERTED = { variant: 'Primary', color: 'Inverted' } as const
|
||||
const SECONDARY = { variant: 'Secondary', color: 'Primary' } as const
|
||||
const SECONDARY_INVERTED = { variant: 'Secondary', color: 'Inverted' } as const
|
||||
const TERTIARY = { variant: 'Tertiary', color: 'Primary' } as const
|
||||
const PRIMARY = { variant: "Primary", color: "Primary" } as const
|
||||
const PRIMARY_INVERTED = { variant: "Primary", color: "Inverted" } as const
|
||||
const SECONDARY = { variant: "Secondary", color: "Primary" } as const
|
||||
const SECONDARY_INVERTED = { variant: "Secondary", color: "Inverted" } as const
|
||||
const TERTIARY = { variant: "Tertiary", color: "Primary" } as const
|
||||
|
||||
// Determine button variant and color based on card theme and hotel theme.
|
||||
// This is done to avoid low contrast issues and conflicting colors in
|
||||
// certain combinations and according to design guidelines.
|
||||
export function getButtonProps(
|
||||
cardTheme: VariantProps<typeof infoCardVariants>['theme'],
|
||||
cardTheme: VariantProps<typeof infoCardVariants>["theme"],
|
||||
hotelTheme: Theme | null = Theme.scandic
|
||||
): InfoCardButtonProps {
|
||||
let buttonProps: InfoCardButtonProps = {
|
||||
@@ -35,7 +35,7 @@ export function getButtonProps(
|
||||
}
|
||||
|
||||
// Image theme always uses inverted buttons, regardless of hotel theme
|
||||
if (cardTheme === 'Image') {
|
||||
if (cardTheme === "Image") {
|
||||
return {
|
||||
primaryButton: PRIMARY_INVERTED,
|
||||
secondaryButton: SECONDARY_INVERTED,
|
||||
@@ -44,7 +44,7 @@ export function getButtonProps(
|
||||
|
||||
switch (hotelTheme) {
|
||||
case Theme.scandic:
|
||||
if (cardTheme === 'Primary 2' || cardTheme === 'Primary 3') {
|
||||
if (cardTheme === "Primary 2" || cardTheme === "Primary 3") {
|
||||
buttonProps = {
|
||||
primaryButton: PRIMARY_INVERTED,
|
||||
secondaryButton: SECONDARY_INVERTED,
|
||||
@@ -53,10 +53,10 @@ export function getButtonProps(
|
||||
break
|
||||
case Theme.downtownCamper:
|
||||
if (
|
||||
cardTheme === 'Primary 1' ||
|
||||
cardTheme === 'Primary 2' ||
|
||||
cardTheme === 'Primary 3' ||
|
||||
cardTheme === 'Accent'
|
||||
cardTheme === "Primary 1" ||
|
||||
cardTheme === "Primary 2" ||
|
||||
cardTheme === "Primary 3" ||
|
||||
cardTheme === "Accent"
|
||||
) {
|
||||
buttonProps = {
|
||||
primaryButton: PRIMARY_INVERTED,
|
||||
@@ -65,15 +65,15 @@ export function getButtonProps(
|
||||
}
|
||||
break
|
||||
case Theme.haymarket:
|
||||
if (cardTheme === 'Primary 1' || cardTheme === 'White') {
|
||||
if (cardTheme === "Primary 1" || cardTheme === "White") {
|
||||
buttonProps = {
|
||||
primaryButton: PRIMARY,
|
||||
secondaryButton: SECONDARY,
|
||||
}
|
||||
} else if (
|
||||
cardTheme === 'Primary 2' ||
|
||||
cardTheme === 'Primary 3' ||
|
||||
cardTheme === 'Accent'
|
||||
cardTheme === "Primary 2" ||
|
||||
cardTheme === "Primary 3" ||
|
||||
cardTheme === "Accent"
|
||||
) {
|
||||
buttonProps = {
|
||||
primaryButton: PRIMARY_INVERTED,
|
||||
@@ -82,7 +82,7 @@ export function getButtonProps(
|
||||
}
|
||||
break
|
||||
case Theme.scandicGo:
|
||||
if (cardTheme === 'Primary 1' || cardTheme === 'Primary 2') {
|
||||
if (cardTheme === "Primary 1" || cardTheme === "Primary 2") {
|
||||
buttonProps = {
|
||||
primaryButton: PRIMARY_INVERTED,
|
||||
secondaryButton: SECONDARY_INVERTED,
|
||||
@@ -91,16 +91,16 @@ export function getButtonProps(
|
||||
break
|
||||
case Theme.grandHotel:
|
||||
if (
|
||||
cardTheme === 'Primary 2' ||
|
||||
cardTheme === 'Primary 3' ||
|
||||
cardTheme === 'Accent' ||
|
||||
cardTheme === 'White'
|
||||
cardTheme === "Primary 2" ||
|
||||
cardTheme === "Primary 3" ||
|
||||
cardTheme === "Accent" ||
|
||||
cardTheme === "White"
|
||||
) {
|
||||
buttonProps = {
|
||||
primaryButton: PRIMARY,
|
||||
secondaryButton: SECONDARY,
|
||||
}
|
||||
} else if (cardTheme === 'Primary 1') {
|
||||
} else if (cardTheme === "Primary 1") {
|
||||
buttonProps = {
|
||||
primaryButton: PRIMARY_INVERTED,
|
||||
secondaryButton: SECONDARY_INVERTED,
|
||||
@@ -109,9 +109,9 @@ export function getButtonProps(
|
||||
break
|
||||
case Theme.hotelNorge:
|
||||
if (
|
||||
cardTheme === 'Primary 1' ||
|
||||
cardTheme === 'Primary 2' ||
|
||||
cardTheme === 'Primary 3'
|
||||
cardTheme === "Primary 1" ||
|
||||
cardTheme === "Primary 2" ||
|
||||
cardTheme === "Primary 3"
|
||||
) {
|
||||
buttonProps = {
|
||||
primaryButton: PRIMARY_INVERTED,
|
||||
@@ -120,20 +120,20 @@ export function getButtonProps(
|
||||
}
|
||||
break
|
||||
case Theme.marski:
|
||||
if (cardTheme === 'Primary 1') {
|
||||
if (cardTheme === "Primary 1") {
|
||||
buttonProps = {
|
||||
primaryButton: TERTIARY,
|
||||
secondaryButton: SECONDARY_INVERTED,
|
||||
}
|
||||
} else if (cardTheme === 'White') {
|
||||
} else if (cardTheme === "White") {
|
||||
buttonProps = {
|
||||
primaryButton: PRIMARY,
|
||||
secondaryButton: SECONDARY,
|
||||
}
|
||||
} else if (
|
||||
cardTheme === 'Primary 2' ||
|
||||
cardTheme === 'Primary 3' ||
|
||||
cardTheme === 'Accent'
|
||||
cardTheme === "Primary 2" ||
|
||||
cardTheme === "Primary 3" ||
|
||||
cardTheme === "Accent"
|
||||
) {
|
||||
buttonProps = {
|
||||
primaryButton: PRIMARY_INVERTED,
|
||||
@@ -143,15 +143,15 @@ export function getButtonProps(
|
||||
break
|
||||
case Theme.theDock:
|
||||
if (
|
||||
cardTheme === 'Primary 1' ||
|
||||
cardTheme === 'Accent' ||
|
||||
cardTheme === 'White'
|
||||
cardTheme === "Primary 1" ||
|
||||
cardTheme === "Accent" ||
|
||||
cardTheme === "White"
|
||||
) {
|
||||
buttonProps = {
|
||||
primaryButton: PRIMARY,
|
||||
secondaryButton: SECONDARY,
|
||||
}
|
||||
} else if (cardTheme === 'Primary 2' || cardTheme === 'Primary 3') {
|
||||
} else if (cardTheme === "Primary 2" || cardTheme === "Primary 3") {
|
||||
buttonProps = {
|
||||
primaryButton: PRIMARY_INVERTED,
|
||||
secondaryButton: SECONDARY_INVERTED,
|
||||
|
||||
Reference in New Issue
Block a user