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,12 +1,12 @@
|
||||
import type { ComponentProps } from 'react'
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
|
||||
import { fn, expect } from 'storybook/test'
|
||||
import { SelectPaymentMethod } from './index'
|
||||
import { PaymentMethodEnum } from '@scandic-hotels/common/constants/paymentMethod'
|
||||
import { FormDecorator } from '../../../../.storybook/decorators/FormDecorator'
|
||||
import type { ComponentProps } from "react"
|
||||
import type { Meta, StoryObj } from "@storybook/nextjs-vite"
|
||||
import { fn, expect } from "storybook/test"
|
||||
import { SelectPaymentMethod } from "./index"
|
||||
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
|
||||
import { FormDecorator } from "../../../../.storybook/decorators/FormDecorator"
|
||||
|
||||
const meta: Meta<typeof SelectPaymentMethod> = {
|
||||
title: 'Patterns/Form/Payment/SelectCreditCard',
|
||||
title: "Patterns/Form/Payment/SelectCreditCard",
|
||||
component: SelectPaymentMethod,
|
||||
argTypes: {},
|
||||
decorators: [FormDecorator],
|
||||
@@ -18,30 +18,30 @@ type Story = StoryObj<typeof SelectPaymentMethod>
|
||||
|
||||
export const PrimaryDefault: Story = {
|
||||
args: {
|
||||
formName: 'paymentMethod',
|
||||
formName: "paymentMethod",
|
||||
onChange: fn(),
|
||||
paymentMethods: [
|
||||
{
|
||||
id: 'klarna',
|
||||
alias: 'Card 1',
|
||||
id: "klarna",
|
||||
alias: "Card 1",
|
||||
cardType: PaymentMethodEnum.klarna,
|
||||
truncatedNumber: '1234',
|
||||
truncatedNumber: "1234",
|
||||
},
|
||||
{
|
||||
id: 'applePay',
|
||||
alias: 'Card 2',
|
||||
id: "applePay",
|
||||
alias: "Card 2",
|
||||
cardType: PaymentMethodEnum.applePay,
|
||||
truncatedNumber: '1234',
|
||||
truncatedNumber: "1234",
|
||||
},
|
||||
],
|
||||
} satisfies ComponentProps<typeof SelectPaymentMethod>,
|
||||
|
||||
play: async ({ canvas, userEvent, args }) => {
|
||||
const options = await canvas.findAllByRole('radio')
|
||||
const options = await canvas.findAllByRole("radio")
|
||||
expect(options[0]).toBeInTheDocument()
|
||||
|
||||
expect(args.onChange).not.toHaveBeenCalled()
|
||||
await userEvent.click(options[0])
|
||||
expect(args.onChange).toHaveBeenCalledWith('klarna')
|
||||
expect(args.onChange).toHaveBeenCalledWith("klarna")
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { useIntl } from 'react-intl'
|
||||
import { Label } from 'react-aria-components'
|
||||
import { useIntl } from "react-intl"
|
||||
import { Label } from "react-aria-components"
|
||||
|
||||
import { PaymentOptionsGroup } from '../PaymentOption/PaymentOptionsGroup'
|
||||
import { PaymentOption } from '../PaymentOption/PaymentOption'
|
||||
import { Typography } from '../../../components/Typography'
|
||||
import { PaymentOptionsGroup } from "../PaymentOption/PaymentOptionsGroup"
|
||||
import { PaymentOption } from "../PaymentOption/PaymentOption"
|
||||
import { Typography } from "../../../components/Typography"
|
||||
|
||||
import styles from './selectPaymentMethod.module.css'
|
||||
import styles from "./selectPaymentMethod.module.css"
|
||||
|
||||
import {
|
||||
PAYMENT_METHOD_TITLES,
|
||||
PaymentMethodEnum,
|
||||
} from '@scandic-hotels/common/constants/paymentMethod'
|
||||
} from "@scandic-hotels/common/constants/paymentMethod"
|
||||
|
||||
type PaymentMethod = {
|
||||
id: string
|
||||
@@ -39,15 +39,15 @@ export function SelectPaymentMethod({
|
||||
|
||||
const mySavedCardsLabel = paymentMethods.length
|
||||
? intl.formatMessage({
|
||||
id: 'payment.mySavedCards',
|
||||
defaultMessage: 'My saved cards',
|
||||
id: "payment.mySavedCards",
|
||||
defaultMessage: "My saved cards",
|
||||
})
|
||||
: undefined
|
||||
|
||||
const otherCardLabel = paymentMethods.length
|
||||
? intl.formatMessage({
|
||||
id: 'common.other',
|
||||
defaultMessage: 'Other',
|
||||
id: "common.other",
|
||||
defaultMessage: "Other",
|
||||
})
|
||||
: undefined
|
||||
|
||||
@@ -64,8 +64,8 @@ export function SelectPaymentMethod({
|
||||
>
|
||||
<Label className="sr-only">
|
||||
{intl.formatMessage({
|
||||
id: 'enterDetails.guarantee.cardOptions',
|
||||
defaultMessage: 'Card options',
|
||||
id: "enterDetails.guarantee.cardOptions",
|
||||
defaultMessage: "Card options",
|
||||
})}
|
||||
</Label>
|
||||
<Typography variant="Title/Overline/sm">
|
||||
@@ -94,8 +94,8 @@ export function SelectPaymentMethod({
|
||||
value={PaymentMethodEnum.card}
|
||||
type={PaymentMethodEnum.card}
|
||||
label={intl.formatMessage({
|
||||
id: 'common.creditCard',
|
||||
defaultMessage: 'Credit card',
|
||||
id: "common.creditCard",
|
||||
defaultMessage: "Credit card",
|
||||
})}
|
||||
/>
|
||||
</PaymentOptionsGroup>
|
||||
|
||||
Reference in New Issue
Block a user