feat(SW-1435): Added RateCard component to design system * feat(SW-1435): Added new component: RateCard to design system * feat: added reward night points rate card * fix: set svg icon color to "currentColor" to make them more reusable * fix: added click handler for info icon * fix: added selectedRate Approved-by: Arvid Norlin
123 lines
2.5 KiB
TypeScript
123 lines
2.5 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/react'
|
|
|
|
import { RateCard } from './RateCard'
|
|
|
|
const meta: Meta<typeof RateCard> = {
|
|
title: 'Components/RateCard/Points',
|
|
component: RateCard,
|
|
decorators: [
|
|
(Story) => (
|
|
<div style={{ maxWidth: '400px' }}>
|
|
<Story />
|
|
</div>
|
|
),
|
|
],
|
|
argTypes: {
|
|
title: { control: 'text' },
|
|
},
|
|
}
|
|
|
|
export default meta
|
|
|
|
type Story = StoryObj<typeof RateCard>
|
|
|
|
export const Default: Story = {
|
|
args: {
|
|
variant: 'Points',
|
|
title: 'FREE CANCELLATION / PAY LATER',
|
|
bannerText: 'Reward night ∙ Breakfast included',
|
|
rates: [
|
|
{
|
|
points: '20000',
|
|
currency: 'PTS',
|
|
},
|
|
{
|
|
points: '15000',
|
|
currency: 'PTS',
|
|
additionalCurrency: {
|
|
price: '250',
|
|
currency: 'EUR',
|
|
},
|
|
},
|
|
{
|
|
points: '10000',
|
|
currency: 'PTS',
|
|
additionalCurrency: {
|
|
price: '500',
|
|
currency: 'EUR',
|
|
},
|
|
},
|
|
],
|
|
selectedRate: undefined,
|
|
onRateSelect: (value) => console.log(value),
|
|
},
|
|
}
|
|
|
|
export const WithDisabledRates: Story = {
|
|
args: {
|
|
variant: 'Points',
|
|
title: 'FREE CANCELLATION / PAY LATER',
|
|
bannerText: 'Reward night ∙ Breakfast included',
|
|
rates: [
|
|
{
|
|
points: '20000',
|
|
currency: 'PTS',
|
|
isDisabled: true,
|
|
},
|
|
{
|
|
points: '15000',
|
|
currency: 'PTS',
|
|
isDisabled: true,
|
|
additionalCurrency: {
|
|
price: '250',
|
|
currency: 'EUR',
|
|
},
|
|
},
|
|
{
|
|
points: '10000',
|
|
currency: 'PTS',
|
|
additionalCurrency: {
|
|
price: '500',
|
|
currency: 'EUR',
|
|
},
|
|
},
|
|
],
|
|
selectedRate: '2',
|
|
onRateSelect: (value) => console.log(value),
|
|
},
|
|
}
|
|
|
|
export const NotEnoughPoints: Story = {
|
|
args: {
|
|
variant: 'Points',
|
|
title: 'FREE CANCELLATION / PAY LATER',
|
|
bannerText: 'Reward night ∙ Breakfast included',
|
|
rates: [
|
|
{
|
|
points: '20000',
|
|
currency: 'PTS',
|
|
},
|
|
{
|
|
points: '15000',
|
|
currency: 'PTS',
|
|
additionalCurrency: {
|
|
price: '250',
|
|
currency: 'EUR',
|
|
},
|
|
},
|
|
{
|
|
points: '10000',
|
|
currency: 'PTS',
|
|
additionalCurrency: {
|
|
price: '500',
|
|
currency: 'EUR',
|
|
},
|
|
},
|
|
],
|
|
selectedRate: undefined,
|
|
isNotEnoughPoints: true,
|
|
notEnoughPointsText: 'Not enough points',
|
|
onRateSelect: (value) => console.log(value),
|
|
},
|
|
}
|