Files
web/packages/design-system/lib/components/RateCard/Points/Points.stories.tsx
Joakim Jäderberg f531c7a49f Merged in feature/storybook-tests (pull request #2623)
Feature/storybook tests

* feature: add interaction tests for storybook and upgrade storybook@9

* add a11y testing for storybook

* Merge branch 'master' of bitbucket.org:scandic-swap/web into feature/storybook-tests

* Test and build only required packages

* .

* .

* .

* .

* .

* .

* .

* disable playwright tests in netlify ci

* .

* debug out process.env

* don't run playwright on CI

* remove unused netlify-plugin-playwright-cache

* .

* .

* .

* .

* .

* .

* remove turbo dependancy to design-system#test

* merge

* merge


Approved-by: Anton Gunnarsson
2025-08-14 06:25:08 +00:00

158 lines
3.5 KiB
TypeScript

import type { Meta, StoryObj } from '@storybook/react-vite'
import PointsRateCard from '.'
const meta: Meta<typeof PointsRateCard> = {
title: 'Components/RateCard/Points',
component: PointsRateCard,
decorators: [
(Story) => (
<div style={{ maxWidth: '400px' }}>
<Story />
</div>
),
],
argTypes: {
rateTitle: { control: 'text' },
paymentTerm: { control: 'text' },
bannerText: { control: 'text' },
rates: { control: 'object' },
selectedRate: { control: 'text' },
onRateSelect: { action: 'onRateSelect' },
isNotEnoughPoints: { control: 'boolean' },
notEnoughPointsText: { control: 'text' },
rateTermDetails: { control: 'object' },
},
}
export default meta
type Story = StoryObj<typeof PointsRateCard>
export const Default: Story = {
args: {
rateTitle: 'FREE CANCELLATION',
paymentTerm: 'PAY LATER',
bannerText: 'Reward night ∙ Breakfast included',
rates: [
{
points: '20000',
currency: 'PTS',
rateCode: 'REDNIGHT7',
},
{
points: '15000',
currency: 'PTS',
additionalPrice: {
price: '250',
currency: 'EUR',
},
rateCode: 'REDNIGHT7A',
},
{
points: '10000',
currency: 'PTS',
additionalPrice: {
price: '500',
currency: 'EUR',
},
rateCode: 'REDNIGHT7B',
},
],
selectedRate: undefined,
onRateSelect: (value) => console.log(value),
rateTermDetails: [
{
title: 'Rate definition 1',
terms: ['term 1', 'term 2', 'term 3'],
},
],
},
}
export const WithDisabledRates: Story = {
args: {
rateTitle: 'FREE CANCELLATION',
paymentTerm: 'PAY LATER',
bannerText: 'Reward night ∙ Breakfast included',
rates: [
{
points: '20000',
currency: 'PTS',
isDisabled: true,
rateCode: 'REDNIGHT7',
},
{
points: '15000',
currency: 'PTS',
isDisabled: true,
additionalPrice: {
price: '250',
currency: 'EUR',
},
rateCode: 'REDNIGHT7A',
},
{
points: '10000',
currency: 'PTS',
additionalPrice: {
price: '500',
currency: 'EUR',
},
rateCode: 'REDNIGHT7B',
},
],
selectedRate: '2',
onRateSelect: (value) => console.log(value),
rateTermDetails: [
{
title: 'Rate definition 1',
terms: ['term 1', 'term 2', 'term 3'],
},
],
},
}
export const NotEnoughPoints: Story = {
args: {
rateTitle: 'FREE CANCELLATION',
paymentTerm: 'PAY LATER',
bannerText: 'Reward night ∙ Breakfast included',
rates: [
{
points: '20000',
currency: 'PTS',
rateCode: 'REDNIGHT7',
},
{
points: '15000',
currency: 'PTS',
additionalPrice: {
price: '250',
currency: 'EUR',
},
rateCode: 'REDNIGHT7A',
},
{
points: '10000',
currency: 'PTS',
additionalPrice: {
price: '500',
currency: 'EUR',
},
rateCode: 'REDNIGHT7B',
},
],
selectedRate: undefined,
isNotEnoughPoints: true,
notEnoughPointsText: 'Not enough points',
onRateSelect: (value) => console.log(value),
rateTermDetails: [
{
title: 'Rate definition 1',
terms: ['term 1', 'term 2', 'term 3'],
},
],
},
}