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,11 +1,11 @@
|
||||
import { hotelMarkerVariants } from './variants'
|
||||
import { hotelMarkerVariants } from "./variants"
|
||||
|
||||
export default function HotelMarker({
|
||||
className,
|
||||
color,
|
||||
...props
|
||||
}: React.SVGAttributes<HTMLOrSVGElement> & {
|
||||
color?: 'burgundy' | 'white'
|
||||
color?: "burgundy" | "white"
|
||||
}) {
|
||||
const classNames = hotelMarkerVariants({ color, className })
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { cva } from 'class-variance-authority'
|
||||
import { cva } from "class-variance-authority"
|
||||
|
||||
import styles from './hotelMarker.module.css'
|
||||
import styles from "./hotelMarker.module.css"
|
||||
|
||||
export const hotelMarkerVariants = cva(styles.icon, {
|
||||
variants: {
|
||||
@@ -10,6 +10,6 @@ export const hotelMarkerVariants = cva(styles.icon, {
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
color: 'white',
|
||||
color: "white",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
|
||||
import type { Meta, StoryObj } from "@storybook/nextjs-vite"
|
||||
|
||||
import { HotelMarkerByType } from './HotelMarkerByType'
|
||||
import { SignatureHotelEnum } from '@scandic-hotels/common/constants/signatureHotels'
|
||||
import { Typography } from '../../Typography'
|
||||
import { HotelMarkerByType } from "./HotelMarkerByType"
|
||||
import { SignatureHotelEnum } from "@scandic-hotels/common/constants/signatureHotels"
|
||||
import { Typography } from "../../Typography"
|
||||
|
||||
const meta: Meta<typeof HotelMarkerByType> = {
|
||||
title: 'Patterns/Map/Hotel Marker By Type',
|
||||
title: "Patterns/Map/Hotel Marker By Type",
|
||||
component: HotelMarkerByType,
|
||||
argTypes: {
|
||||
hotelType: {
|
||||
control: 'select',
|
||||
options: ['Regular', 'Signature', 'Scandic Go'],
|
||||
description: 'Type of hotel',
|
||||
control: "select",
|
||||
options: ["Regular", "Signature", "Scandic Go"],
|
||||
description: "Type of hotel",
|
||||
table: {
|
||||
type: { summary: "'Regular' | 'Signature' | 'Scandic Go'" },
|
||||
// defaultValue: { summary: 'Regular' },
|
||||
},
|
||||
mapping: {
|
||||
Signature: 'signature',
|
||||
'Scandic Go': 'scandicgo',
|
||||
Regular: 'regular',
|
||||
Signature: "signature",
|
||||
"Scandic Go": "scandicgo",
|
||||
Regular: "regular",
|
||||
},
|
||||
},
|
||||
hotelId: {
|
||||
control: 'select',
|
||||
control: "select",
|
||||
description: 'ID of the hotel (e.g. "879" for Downtown Camper)',
|
||||
options: ['Other', ...Object.keys(SignatureHotelEnum)],
|
||||
options: ["Other", ...Object.keys(SignatureHotelEnum)],
|
||||
mapping: {
|
||||
Other: '',
|
||||
Other: "",
|
||||
...SignatureHotelEnum,
|
||||
},
|
||||
},
|
||||
size: {
|
||||
control: 'select',
|
||||
control: "select",
|
||||
table: {
|
||||
type: { summary: "'large' | 'small'" },
|
||||
},
|
||||
options: ['large', 'small'],
|
||||
options: ["large", "small"],
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -47,17 +47,17 @@ type Story = StoryObj<typeof HotelMarkerByType>
|
||||
|
||||
export const PrimaryDefault: Story = {
|
||||
args: {
|
||||
hotelId: 'Other',
|
||||
hotelType: 'regular',
|
||||
size: 'large',
|
||||
hotelId: "Other",
|
||||
hotelType: "regular",
|
||||
size: "large",
|
||||
},
|
||||
}
|
||||
|
||||
export const ScandicGo: Story = {
|
||||
args: {
|
||||
hotelId: 'Other',
|
||||
hotelType: 'scandicgo',
|
||||
size: 'large',
|
||||
hotelId: "Other",
|
||||
hotelType: "scandicgo",
|
||||
size: "large",
|
||||
},
|
||||
argTypes: {
|
||||
hotelId: {
|
||||
@@ -75,9 +75,9 @@ export const ScandicGo: Story = {
|
||||
|
||||
export const Signature: Story = {
|
||||
args: {
|
||||
hotelId: 'DowntownCamper',
|
||||
hotelType: 'signature',
|
||||
size: 'large',
|
||||
hotelId: "DowntownCamper",
|
||||
hotelType: "signature",
|
||||
size: "large",
|
||||
},
|
||||
argTypes: {
|
||||
hotelType: {
|
||||
@@ -86,10 +86,10 @@ export const Signature: Story = {
|
||||
},
|
||||
},
|
||||
hotelId: {
|
||||
control: 'select',
|
||||
options: ['Other', ...Object.keys(SignatureHotelEnum)],
|
||||
control: "select",
|
||||
options: ["Other", ...Object.keys(SignatureHotelEnum)],
|
||||
mapping: {
|
||||
Other: '',
|
||||
Other: "",
|
||||
...SignatureHotelEnum,
|
||||
},
|
||||
},
|
||||
@@ -98,28 +98,28 @@ export const Signature: Story = {
|
||||
|
||||
const exampleMarkers = [
|
||||
{
|
||||
name: 'Default',
|
||||
hotelId: 'Other',
|
||||
hotelType: 'regular',
|
||||
name: "Default",
|
||||
hotelId: "Other",
|
||||
hotelType: "regular",
|
||||
},
|
||||
{
|
||||
name: 'Scandic Go',
|
||||
hotelId: 'Other',
|
||||
hotelType: 'scandicgo',
|
||||
name: "Scandic Go",
|
||||
hotelId: "Other",
|
||||
hotelType: "scandicgo",
|
||||
},
|
||||
...Object.entries(SignatureHotelEnum).map(
|
||||
([hotelName, hotelId]) =>
|
||||
({
|
||||
name: hotelName,
|
||||
hotelId,
|
||||
hotelType: 'signature',
|
||||
hotelType: "signature",
|
||||
}) as const
|
||||
),
|
||||
] as const
|
||||
|
||||
export const Examples: Story = {
|
||||
args: {
|
||||
size: 'large',
|
||||
size: "large",
|
||||
},
|
||||
argTypes: {
|
||||
hotelType: {
|
||||
@@ -136,8 +136,8 @@ export const Examples: Story = {
|
||||
render: (args) => (
|
||||
<div
|
||||
style={{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: 'repeat(auto-fill, minmax(180px, 1fr))',
|
||||
display: "grid",
|
||||
gridTemplateColumns: "repeat(auto-fill, minmax(180px, 1fr))",
|
||||
gap: 16,
|
||||
}}
|
||||
>
|
||||
@@ -145,14 +145,14 @@ export const Examples: Story = {
|
||||
<div
|
||||
key={ix}
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
gap: 12,
|
||||
padding: 8,
|
||||
borderRadius: 8,
|
||||
background: 'var(--ds-color-surface-subtle, #F2ECE6)',
|
||||
background: "var(--ds-color-surface-subtle, #F2ECE6)",
|
||||
}}
|
||||
>
|
||||
<HotelMarkerByType {...args} {...exampleArgs} />
|
||||
|
||||
@@ -1,32 +1,31 @@
|
||||
import { DowntownCamperMarker } from './HotelMarker/SignatureHotel/DowntownCamper'
|
||||
import { DowntownCamperSmallMarker } from './HotelMarker/SignatureHotel/DowntownCamperSmall'
|
||||
import { GrandHotelMarker } from './HotelMarker/SignatureHotel/GrandHotel'
|
||||
import { GrandHotelSmallMarker } from './HotelMarker/SignatureHotel/GrandHotelSmall'
|
||||
import { HaymarketMarker } from './HotelMarker/SignatureHotel/Haymarket'
|
||||
import { HaymarketSmallMarker } from './HotelMarker/SignatureHotel/HaymarketSmall'
|
||||
import { HotelNorgeMarker } from './HotelMarker/SignatureHotel/HotelNorge'
|
||||
import { HotelNorgeSmallMarker } from './HotelMarker/SignatureHotel/HotelNorgeSmall'
|
||||
import { MarskiMarker } from './HotelMarker/SignatureHotel/Marski'
|
||||
import { MarskiSmallMarker } from './HotelMarker/SignatureHotel/MarskiSmall'
|
||||
import { ScandicMarker } from './HotelMarker/SignatureHotel/Scandic'
|
||||
import { ScandicGoMarker } from './HotelMarker/SignatureHotel/ScandicGo'
|
||||
import { ScandicGoSmallMarker } from './HotelMarker/SignatureHotel/ScandicGoSmall'
|
||||
import { ScandicSmallMarker } from './HotelMarker/SignatureHotel/ScandicSmall'
|
||||
import { TheDockMarker } from './HotelMarker/SignatureHotel/TheDock'
|
||||
import { TheDockSmallMarker } from './HotelMarker/SignatureHotel/TheDockSmall'
|
||||
import { DowntownCamperMarker } from "./HotelMarker/SignatureHotel/DowntownCamper"
|
||||
import { DowntownCamperSmallMarker } from "./HotelMarker/SignatureHotel/DowntownCamperSmall"
|
||||
import { GrandHotelMarker } from "./HotelMarker/SignatureHotel/GrandHotel"
|
||||
import { GrandHotelSmallMarker } from "./HotelMarker/SignatureHotel/GrandHotelSmall"
|
||||
import { HaymarketMarker } from "./HotelMarker/SignatureHotel/Haymarket"
|
||||
import { HaymarketSmallMarker } from "./HotelMarker/SignatureHotel/HaymarketSmall"
|
||||
import { HotelNorgeMarker } from "./HotelMarker/SignatureHotel/HotelNorge"
|
||||
import { HotelNorgeSmallMarker } from "./HotelMarker/SignatureHotel/HotelNorgeSmall"
|
||||
import { MarskiMarker } from "./HotelMarker/SignatureHotel/Marski"
|
||||
import { MarskiSmallMarker } from "./HotelMarker/SignatureHotel/MarskiSmall"
|
||||
import { ScandicMarker } from "./HotelMarker/SignatureHotel/Scandic"
|
||||
import { ScandicGoMarker } from "./HotelMarker/SignatureHotel/ScandicGo"
|
||||
import { ScandicGoSmallMarker } from "./HotelMarker/SignatureHotel/ScandicGoSmall"
|
||||
import { ScandicSmallMarker } from "./HotelMarker/SignatureHotel/ScandicSmall"
|
||||
import { TheDockMarker } from "./HotelMarker/SignatureHotel/TheDock"
|
||||
import { TheDockSmallMarker } from "./HotelMarker/SignatureHotel/TheDockSmall"
|
||||
|
||||
import { SignatureHotelEnum } from '@scandic-hotels/common/constants/signatureHotels'
|
||||
import { SignatureHotelEnum } from "@scandic-hotels/common/constants/signatureHotels"
|
||||
|
||||
import {
|
||||
HotelTypes,
|
||||
type HotelType,
|
||||
} from '@scandic-hotels/common/constants/hotelType'
|
||||
import { MarkerInfo } from '../types'
|
||||
} from "@scandic-hotels/common/constants/hotelType"
|
||||
import { MarkerInfo } from "../types"
|
||||
|
||||
export interface HotelMarkerByTypeProps
|
||||
extends MarkerInfo,
|
||||
React.SVGAttributes<HTMLOrSVGElement> {
|
||||
size?: 'large' | 'small'
|
||||
extends MarkerInfo, React.SVGAttributes<HTMLOrSVGElement> {
|
||||
size?: "large" | "small"
|
||||
}
|
||||
type MarkerComponent = React.ComponentType<
|
||||
React.SVGAttributes<HTMLOrSVGElement>
|
||||
@@ -35,7 +34,7 @@ type MarkerComponent = React.ComponentType<
|
||||
export function HotelMarkerByType({
|
||||
hotelId,
|
||||
hotelType,
|
||||
size = 'large',
|
||||
size = "large",
|
||||
...props
|
||||
}: HotelMarkerByTypeProps) {
|
||||
const sigatureHotelEntry =
|
||||
@@ -55,14 +54,14 @@ export function HotelMarkerByType({
|
||||
return <Cmp {...props} />
|
||||
}
|
||||
|
||||
const defaultMarkers: Record<'large' | 'small', MarkerComponent> = {
|
||||
const defaultMarkers: Record<"large" | "small", MarkerComponent> = {
|
||||
large: ScandicMarker,
|
||||
small: ScandicSmallMarker,
|
||||
}
|
||||
|
||||
const byHotelType: Record<
|
||||
Exclude<HotelType, 'regular' | 'signature'>,
|
||||
Record<'large' | 'small', MarkerComponent>
|
||||
Exclude<HotelType, "regular" | "signature">,
|
||||
Record<"large" | "small", MarkerComponent>
|
||||
> = {
|
||||
[HotelTypes.ScandicGo]: {
|
||||
large: ScandicGoMarker,
|
||||
@@ -72,7 +71,7 @@ const byHotelType: Record<
|
||||
|
||||
const bySignatureHotel: Record<
|
||||
SignatureHotelEnum,
|
||||
Record<'large' | 'small', MarkerComponent>
|
||||
Record<"large" | "small", MarkerComponent>
|
||||
> = {
|
||||
[SignatureHotelEnum.Haymarket]: {
|
||||
large: HaymarketMarker,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { IconByIconName } from '../../../Icons/IconByIconName'
|
||||
import { IconByIconName } from "../../../Icons/IconByIconName"
|
||||
|
||||
import {
|
||||
getIconByPoiGroupAndCategory,
|
||||
type PointOfInterestGroup,
|
||||
} from '../utils'
|
||||
import { poiVariants } from './variants'
|
||||
} from "../utils"
|
||||
import { poiVariants } from "./variants"
|
||||
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
import type { VariantProps } from "class-variance-authority"
|
||||
|
||||
interface PoiMarkerProps extends VariantProps<typeof poiVariants> {
|
||||
group: PointOfInterestGroup
|
||||
@@ -18,8 +18,8 @@ export function PoiMarker({
|
||||
group,
|
||||
categoryName,
|
||||
skipBackground,
|
||||
size = 'small',
|
||||
className = '',
|
||||
size = "small",
|
||||
className = "",
|
||||
}: PoiMarkerProps) {
|
||||
const iconName = getIconByPoiGroupAndCategory(group, categoryName)
|
||||
const classNames = poiVariants({ group, skipBackground, size, className })
|
||||
@@ -28,8 +28,8 @@ export function PoiMarker({
|
||||
<span className={classNames}>
|
||||
<IconByIconName
|
||||
iconName={iconName}
|
||||
color={skipBackground ? 'CurrentColor' : 'Icon/Inverted'}
|
||||
size={size === 'small' ? 16 : size === 'large' ? 24 : 20}
|
||||
color={skipBackground ? "CurrentColor" : "Icon/Inverted"}
|
||||
size={size === "small" ? 16 : size === "large" ? 24 : 20}
|
||||
/>
|
||||
</span>
|
||||
) : null
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { cva } from 'class-variance-authority'
|
||||
import { cva } from "class-variance-authority"
|
||||
|
||||
import type { PointOfInterestGroup } from '../utils'
|
||||
import styles from './poiMarker.module.css'
|
||||
import type { PointOfInterestGroup } from "../utils"
|
||||
import styles from "./poiMarker.module.css"
|
||||
|
||||
export const poiVariants = cva(styles.poiMarker, {
|
||||
variants: {
|
||||
group: {
|
||||
['Attractions']: styles.attractions,
|
||||
['Business']: styles.business,
|
||||
['Location']: styles.location,
|
||||
['Parking']: styles.parking,
|
||||
['Public transport']: styles.publicTransport,
|
||||
['Shopping & Dining']: styles.shoppingDining,
|
||||
["Attractions"]: styles.attractions,
|
||||
["Business"]: styles.business,
|
||||
["Location"]: styles.location,
|
||||
["Parking"]: styles.parking,
|
||||
["Public transport"]: styles.publicTransport,
|
||||
["Shopping & Dining"]: styles.shoppingDining,
|
||||
} satisfies Record<PointOfInterestGroup, string>,
|
||||
skipBackground: {
|
||||
true: styles.skipBackground,
|
||||
false: '',
|
||||
false: "",
|
||||
},
|
||||
size: {
|
||||
small: styles.small,
|
||||
@@ -25,6 +25,6 @@ export const poiVariants = cva(styles.poiMarker, {
|
||||
},
|
||||
defaultVariants: {
|
||||
skipBackground: false,
|
||||
size: 'small',
|
||||
size: "small",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
import { IconName } from '../../Icons/iconName'
|
||||
import { IconName } from "../../Icons/iconName"
|
||||
|
||||
export type PointOfInterestGroup =
|
||||
| 'Public transport'
|
||||
| 'Attractions'
|
||||
| 'Business'
|
||||
| 'Location'
|
||||
| 'Parking'
|
||||
| 'Shopping & Dining'
|
||||
| "Public transport"
|
||||
| "Attractions"
|
||||
| "Business"
|
||||
| "Location"
|
||||
| "Parking"
|
||||
| "Shopping & Dining"
|
||||
|
||||
export function getIconByPoiGroupAndCategory(
|
||||
group: PointOfInterestGroup,
|
||||
category?: string
|
||||
) {
|
||||
switch (group) {
|
||||
case 'Public transport':
|
||||
return category === 'Airport' ? IconName.Airplane : IconName.Train
|
||||
case 'Attractions':
|
||||
return category === 'Museum' ? IconName.Museum : IconName.Camera
|
||||
case 'Business':
|
||||
case "Public transport":
|
||||
return category === "Airport" ? IconName.Airplane : IconName.Train
|
||||
case "Attractions":
|
||||
return category === "Museum" ? IconName.Museum : IconName.Camera
|
||||
case "Business":
|
||||
return IconName.Business
|
||||
case 'Parking':
|
||||
case "Parking":
|
||||
return IconName.Parking
|
||||
case 'Shopping & Dining':
|
||||
return category === 'Restaurant' ? IconName.Restaurant : IconName.Shopping
|
||||
case 'Location':
|
||||
case "Shopping & Dining":
|
||||
return category === "Restaurant" ? IconName.Restaurant : IconName.Shopping
|
||||
case "Location":
|
||||
default:
|
||||
return IconName.Location
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user