import { Meta, StoryObj } from '@storybook/react-webpack5'; import { useTheme } from '@wise/components-theming'; import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator'; import { withVariantConfig } from '../../../.storybook/helpers'; import Body from '../../Body'; import Title from '../../Title'; import CardContainer from '..'; import type { CardContainerProps, CardContainerSpotlight } from '..'; const meta: Meta = { component: CardContainer, tags: ['!autodocs', '!manifest'], title: 'Layouts/CardContainer/Tests', }; export default meta; type Story = StoryObj; const SPOTLIGHTS: (CardContainerSpotlight | undefined)[] = [undefined, 'active', 'inactive']; const ThemeTitle = () => { const { theme, screenMode } = useTheme(); return ( {theme} / {screenMode} ); }; /** Fills the content area, so a padding-none card's corners show the clipping. */ const FullBleedContent = () => (
); /** * Every spotlight against every theme, with and without padding. Without padding, the content * should be clipped to the rounded corners, and the `inactive` dashed stroke should stay whole. * * The `active` spotlight's resting shadow is only applied in the light `personal`, `business` and * `platform` themes; every `dark`, `bright-green` and `forest-green` column should show a flat * surface. */ export const AllVariants: Story = { ...withVariantConfig([ 'default', 'dark', 'bright-green', 'forest-green', 'business', 'business--bright-green', 'business--forest-green', 'platform', 'platform--forest-green', ]), render: () => (
{SPOTLIGHTS.map((spotlight) => ( Spotlight: {spotlight ?? 'not set'} Second line, to show the content stacks flush. ))} {SPOTLIGHTS.map((spotlight) => ( ))}
), }; /** * The inactive spotlight's dashed stroke and the padding should mirror in RTL. Without padding, * the text should start at the inline-start edge. */ export const RTLDiff: Story = { render: () => { const i18n = useRtlDiffI18n(); return (
{SPOTLIGHTS.map((spotlight) => ( {i18n.content} ))} {SPOTLIGHTS.map((spotlight) => ( {i18n.content} ))}
); }, ...withRTLDiff({ i18n: { content: { en: 'Your virtual card is ready to use.', ar: 'بطاقتك الافتراضية جاهزة للاستخدام.', }, }, }), };