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,22 +1,22 @@
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
|
||||
import { Alert } from './index'
|
||||
import { AlertTypeEnum } from '@scandic-hotels/common/constants/alert'
|
||||
import { expect, fn } from 'storybook/test'
|
||||
import type { Meta, StoryObj } from "@storybook/nextjs-vite"
|
||||
import { Alert } from "./index"
|
||||
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
|
||||
import { expect, fn } from "storybook/test"
|
||||
|
||||
const meta: Meta<typeof Alert> = {
|
||||
title: 'Core Components/Alert',
|
||||
title: "Core Components/Alert",
|
||||
component: Alert,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
layout: "centered",
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
tags: ["autodocs"],
|
||||
argTypes: {
|
||||
variant: {
|
||||
control: { type: 'select' },
|
||||
options: ['banner', 'inline'],
|
||||
control: { type: "select" },
|
||||
options: ["banner", "inline"],
|
||||
},
|
||||
type: {
|
||||
control: { type: 'select' },
|
||||
control: { type: "select" },
|
||||
options: Object.values(AlertTypeEnum),
|
||||
},
|
||||
close: {
|
||||
@@ -32,43 +32,43 @@ type Story = StoryObj<typeof meta>
|
||||
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
variant: 'inline',
|
||||
variant: "inline",
|
||||
type: AlertTypeEnum.Info,
|
||||
heading: 'Heading',
|
||||
text: 'Caramels danish jelly-o pudding tart croissant. Pie cotton candy jujubes carrot cake gummies. Apple pie cake chocolate bar halvah tootsie roll bonbon cheesecake. Brownie dessert macaroon bear claw pastry.',
|
||||
heading: "Heading",
|
||||
text: "Caramels danish jelly-o pudding tart croissant. Pie cotton candy jujubes carrot cake gummies. Apple pie cake chocolate bar halvah tootsie roll bonbon cheesecake. Brownie dessert macaroon bear claw pastry.",
|
||||
close: undefined,
|
||||
ariaRole: 'alert',
|
||||
ariaRole: "alert",
|
||||
},
|
||||
play: async ({ canvas }) => {
|
||||
canvas.findByRole('alert')
|
||||
canvas.findByRole("alert")
|
||||
},
|
||||
}
|
||||
|
||||
export const Closable: Story = {
|
||||
args: {
|
||||
variant: 'inline',
|
||||
variant: "inline",
|
||||
type: AlertTypeEnum.Info,
|
||||
heading: 'Heading',
|
||||
text: 'Caramels danish jelly-o pudding tart croissant. Pie cotton candy jujubes carrot cake gummies. Apple pie cake chocolate bar halvah tootsie roll bonbon cheesecake. Brownie dessert macaroon bear claw pastry.',
|
||||
heading: "Heading",
|
||||
text: "Caramels danish jelly-o pudding tart croissant. Pie cotton candy jujubes carrot cake gummies. Apple pie cake chocolate bar halvah tootsie roll bonbon cheesecake. Brownie dessert macaroon bear claw pastry.",
|
||||
close: fn(),
|
||||
},
|
||||
play: async ({ canvas, userEvent, args }) => {
|
||||
await userEvent.click(await canvas.findByRole('button'))
|
||||
await userEvent.click(await canvas.findByRole("button"))
|
||||
expect(args.close).toHaveBeenCalledTimes(1)
|
||||
},
|
||||
}
|
||||
|
||||
export const WithPhonenumber: Story = {
|
||||
args: {
|
||||
variant: 'inline',
|
||||
variant: "inline",
|
||||
type: AlertTypeEnum.Info,
|
||||
heading: 'Heading',
|
||||
text: 'Caramels danish jelly-o pudding tart croissant. Pie cotton candy jujubes carrot cake gummies. Apple pie cake chocolate bar halvah tootsie roll bonbon cheesecake. Brownie dessert macaroon bear claw pastry.',
|
||||
heading: "Heading",
|
||||
text: "Caramels danish jelly-o pudding tart croissant. Pie cotton candy jujubes carrot cake gummies. Apple pie cake chocolate bar halvah tootsie roll bonbon cheesecake. Brownie dessert macaroon bear claw pastry.",
|
||||
close: fn(),
|
||||
phoneContact: {
|
||||
displayText: 'Call us:',
|
||||
phoneNumber: '+4685551234',
|
||||
footnote: 'Available 24/7',
|
||||
displayText: "Call us:",
|
||||
phoneNumber: "+4685551234",
|
||||
footnote: "Available 24/7",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
'use client'
|
||||
"use client"
|
||||
|
||||
import { useState } from 'react'
|
||||
import { useIntl } from 'react-intl'
|
||||
import { useState } from "react"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { Button } from '../../Button'
|
||||
import { MaterialIcon } from '../../Icons/MaterialIcon'
|
||||
import { JsonToHtml } from '../../JsonToHtml/JsonToHtml'
|
||||
import SidePeek from '../../SidePeek'
|
||||
import { Button } from "../../Button"
|
||||
import { MaterialIcon } from "../../Icons/MaterialIcon"
|
||||
import { JsonToHtml } from "../../JsonToHtml/JsonToHtml"
|
||||
import SidePeek from "../../SidePeek"
|
||||
|
||||
import styles from './sidepeek.module.css'
|
||||
import styles from "./sidepeek.module.css"
|
||||
|
||||
import type { AlertSidepeekProps } from './sidepeek'
|
||||
import type { AlertSidepeekProps } from "./sidepeek"
|
||||
|
||||
export default function AlertSidepeek({
|
||||
ctaText,
|
||||
@@ -37,8 +37,8 @@ export default function AlertSidepeek({
|
||||
isOpen={sidePeekIsOpen}
|
||||
handleClose={() => setSidePeekIsOpen(false)}
|
||||
closeLabel={intl.formatMessage({
|
||||
id: 'common.close',
|
||||
defaultMessage: 'Close',
|
||||
id: "common.close",
|
||||
defaultMessage: "Close",
|
||||
})}
|
||||
>
|
||||
<JsonToHtml
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { SidepeekContent } from '@scandic-hotels/common/constants/alert'
|
||||
import type { SidepeekContent } from "@scandic-hotels/common/constants/alert"
|
||||
|
||||
export interface AlertSidepeekProps {
|
||||
ctaText: string
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type {
|
||||
AlertTypeEnum,
|
||||
SidepeekContent,
|
||||
} from '@scandic-hotels/common/constants/alert'
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
import type { AriaRole } from 'react'
|
||||
} from "@scandic-hotels/common/constants/alert"
|
||||
import type { VariantProps } from "class-variance-authority"
|
||||
import type { AriaRole } from "react"
|
||||
|
||||
import type { alertVariants } from './variants'
|
||||
import type { alertVariants } from "./variants"
|
||||
|
||||
export interface AlertProps extends VariantProps<typeof alertVariants> {
|
||||
className?: string
|
||||
@@ -26,5 +26,5 @@ export interface AlertProps extends VariantProps<typeof alertVariants> {
|
||||
} | null
|
||||
close?: () => void
|
||||
ariaRole?: AriaRole
|
||||
ariaLive?: 'off' | 'assertive' | 'polite'
|
||||
ariaLive?: "off" | "assertive" | "polite"
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
'use client'
|
||||
"use client"
|
||||
|
||||
import { Button } from '../Button'
|
||||
import { MaterialIcon } from '../Icons/MaterialIcon'
|
||||
import Link from '../OldDSLink'
|
||||
import { Typography } from '../Typography'
|
||||
import { Button } from "../Button"
|
||||
import { MaterialIcon } from "../Icons/MaterialIcon"
|
||||
import Link from "../OldDSLink"
|
||||
import { Typography } from "../Typography"
|
||||
|
||||
import AlertSidepeek from './Sidepeek'
|
||||
import { IconByAlertType } from './utils'
|
||||
import { alertVariants } from './variants'
|
||||
import AlertSidepeek from "./Sidepeek"
|
||||
import { IconByAlertType } from "./utils"
|
||||
import { alertVariants } from "./variants"
|
||||
|
||||
import styles from './alert.module.css'
|
||||
import styles from "./alert.module.css"
|
||||
|
||||
import type { AlertProps } from './alert'
|
||||
import type { AlertProps } from "./alert"
|
||||
|
||||
export function Alert({
|
||||
className,
|
||||
@@ -61,7 +61,7 @@ export function Alert({
|
||||
<>
|
||||
<span> {phoneContact.displayText} </span>
|
||||
<Link
|
||||
href={`tel:${phoneContact.phoneNumber.replace(/ /g, '')}`}
|
||||
href={`tel:${phoneContact.phoneNumber.replace(/ /g, "")}`}
|
||||
>
|
||||
{phoneContact.phoneNumber}
|
||||
</Link>
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import {
|
||||
MaterialIcon,
|
||||
type MaterialIconSetIconProps,
|
||||
} from '../Icons/MaterialIcon'
|
||||
import { AlertTypeEnum } from '@scandic-hotels/common/constants/alert'
|
||||
} from "../Icons/MaterialIcon"
|
||||
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
|
||||
|
||||
import type { JSX } from 'react'
|
||||
import type { JSX } from "react"
|
||||
|
||||
import type { AlertProps } from './alert'
|
||||
import type { AlertProps } from "./alert"
|
||||
|
||||
interface IconByAlertProps {
|
||||
alertType: AlertTypeEnum
|
||||
variant?: AlertProps['variant']
|
||||
variant?: AlertProps["variant"]
|
||||
}
|
||||
|
||||
export function IconByAlertType({
|
||||
alertType,
|
||||
variant = 'inline',
|
||||
variant = "inline",
|
||||
...props
|
||||
}: IconByAlertProps & MaterialIconSetIconProps): JSX.Element {
|
||||
switch (alertType) {
|
||||
case AlertTypeEnum.Alarm:
|
||||
return (
|
||||
<MaterialIcon
|
||||
color={variant === 'inline' ? 'Icon/Inverted' : 'Icon/Feedback/Error'}
|
||||
color={variant === "inline" ? "Icon/Inverted" : "Icon/Feedback/Error"}
|
||||
isFilled
|
||||
icon="error"
|
||||
{...props}
|
||||
@@ -33,7 +33,7 @@ export function IconByAlertType({
|
||||
<MaterialIcon
|
||||
icon="warning"
|
||||
color={
|
||||
variant === 'inline' ? 'Icon/Inverted' : 'Icon/Feedback/Warning'
|
||||
variant === "inline" ? "Icon/Inverted" : "Icon/Feedback/Warning"
|
||||
}
|
||||
isFilled
|
||||
{...props}
|
||||
@@ -44,7 +44,7 @@ export function IconByAlertType({
|
||||
<MaterialIcon
|
||||
icon="check_circle"
|
||||
color={
|
||||
variant === 'inline' ? 'Icon/Inverted' : 'Icon/Feedback/Success'
|
||||
variant === "inline" ? "Icon/Inverted" : "Icon/Feedback/Success"
|
||||
}
|
||||
isFilled
|
||||
{...props}
|
||||
@@ -55,7 +55,7 @@ export function IconByAlertType({
|
||||
return (
|
||||
<MaterialIcon
|
||||
color={
|
||||
variant === 'inline' ? 'Icon/Inverted' : 'Icon/Feedback/Information'
|
||||
variant === "inline" ? "Icon/Inverted" : "Icon/Feedback/Information"
|
||||
}
|
||||
isFilled
|
||||
icon="info"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { cva } from 'class-variance-authority'
|
||||
import { cva } from "class-variance-authority"
|
||||
|
||||
import { AlertTypeEnum } from '@scandic-hotels/common/constants/alert'
|
||||
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
|
||||
|
||||
import styles from './alert.module.css'
|
||||
import styles from "./alert.module.css"
|
||||
|
||||
export const alertVariants = cva(styles.alert, {
|
||||
variants: {
|
||||
@@ -18,7 +18,7 @@ export const alertVariants = cva(styles.alert, {
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: 'inline',
|
||||
variant: "inline",
|
||||
type: AlertTypeEnum.Info,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user