w-funnel/src/components/funnel/templates/CouponTemplate/CouponTemplate.stories.tsx
dev.daminik00 b28d22967f story
2025-09-28 16:35:41 +02:00

110 lines
2.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Meta, StoryObj } from "@storybook/nextjs-vite";
import { CouponTemplate } from "./CouponTemplate";
import { fn } from "storybook/test";
import { buildCouponDefaults } from "@/lib/admin/builder/state/defaults/coupon";
import type { CouponScreenDefinition } from "@/lib/funnel/types";
// Получаем дефолтные значения из builder
const defaultScreen = buildCouponDefaults("coupon-screen-story") as CouponScreenDefinition;
/** CouponTemplate - экраны с купонами и промокодами */
const meta: Meta<typeof CouponTemplate> = {
title: "Funnel Templates/CouponTemplate",
component: CouponTemplate,
tags: ["autodocs"],
parameters: {
layout: "fullscreen",
},
args: {
screen: defaultScreen,
onContinue: fn(),
canGoBack: true,
onBack: fn(),
screenProgress: { current: 8, total: 10 },
defaultTexts: {
nextButton: "Next",
continueButton: "Continue"
},
},
argTypes: {
screen: {
control: { type: "object" },
},
screenProgress: {
control: { type: "object" },
},
onContinue: { action: "continue" },
onBack: { action: "back" },
},
};
export default meta;
type Story = StoryObj<typeof meta>;
/** Дефолтный купон экран */
export const Default: Story = {};
/** Купон с показом прогресса */
export const WithProgress: Story = {
args: {
screen: {
...defaultScreen,
header: {
show: true,
showBackButton: true,
showProgress: true, // Показываем прогресс
},
},
},
};
/** Экран без header */
export const WithoutHeader: Story = {
args: {
screen: {
...defaultScreen,
header: {
show: false,
},
},
},
};
/** Купон с другой скидкой */
export const CustomDiscount: Story = {
args: {
screen: {
...defaultScreen,
coupon: {
...defaultScreen.coupon,
offer: {
title: {
text: "50% OFF",
font: "manrope",
weight: "bold",
align: "center",
size: "3xl",
color: "primary",
},
description: {
text: "Скидка на первую покупку",
font: "inter",
weight: "medium",
color: "muted",
align: "center",
size: "md",
},
},
promoCode: {
text: "FIRST50",
font: "geistMono",
weight: "bold",
align: "center",
size: "lg",
color: "accent",
},
},
},
},
};