Skip to content

Commit 7aaded3

Browse files
author
berdysheva
committed
fix: add basic card model
1 parent aeb2132 commit 7aaded3

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

src/blocks/CardLayout/__stories__/CardLayout.stories.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import React, {Fragment} from 'react';
22
import {Meta, Story} from '@storybook/react/types-6-0';
33

44
import CardLayout from '../CardLayout';
5-
import {CardLayoutBlockModel, CardLayoutBlockProps, SubBlockModels} from '../../../models';
5+
import {
6+
CardLayoutBlockModel,
7+
CardLayoutBlockProps,
8+
CardWithImageProps,
9+
SubBlockModels,
10+
} from '../../../models';
611
import {PageConstructor} from '../../../containers/PageConstructor';
712

813
import data from './data.json';
@@ -12,7 +17,7 @@ export default {
1217
component: CardLayout,
1318
} as Meta;
1419

15-
const createCardArray = (count: number, card: any) => new Array(count).fill(card);
20+
const createCardArray = (count: number, card: CardWithImageProps) => new Array(count).fill(card);
1621

1722
const DefaultTemplate: Story<CardLayoutBlockModel> = (args) => (
1823
<PageConstructor content={{blocks: [args]}} />

src/blocks/Slider/__stories__/Slider.stories.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
22
import {Meta, Story} from '@storybook/react/types-6-0';
3-
import {SliderBlockModel} from '../../../models';
3+
import {SliderBlockModel, BannerCardModel, BasicCardModel} from '../../../models';
44
import Slider from '../Slider';
5-
import {PageConstructor} from '../../../containers/PageConstructor/PageConstructor';
5+
import {PageConstructor} from '../../../containers/PageConstructor';
66

77
import data from './data.json';
88

@@ -35,25 +35,25 @@ const SlidesToShowTemplate: Story<SliderBlockModel> = (args) => (
3535
...args,
3636
title: data.slidesToShow.one.title,
3737
slidesToShow: data.slidesToShow.one.slidesToShow,
38-
children: data.banners.content.children as any,
38+
children: data.banners.content.children as BannerCardModel[],
3939
},
4040
{
4141
...args,
4242
title: data.slidesToShow.two.title,
4343
slidesToShow: data.slidesToShow.two.slidesToShow,
44-
children: data.default.content.children as any,
44+
children: data.default.content.children as BasicCardModel[],
4545
},
4646
{
4747
...args,
4848
title: data.slidesToShow.three.title,
4949
slidesToShow: data.slidesToShow.three.slidesToShow,
50-
children: data.default.content.children as any,
50+
children: data.default.content.children as BasicCardModel[],
5151
},
5252
{
5353
...args,
5454
title: data.slidesToShow.four.title,
5555
slidesToShow: data.slidesToShow.four.slidesToShow,
56-
children: data.default.content.children as any,
56+
children: data.default.content.children as BasicCardModel[],
5757
},
5858
],
5959
}}

src/models/constructor-items/sub-blocks.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ export type BannerCardModel = {
215215
type: SubBlockType.BannerCard;
216216
} & BannerCardProps;
217217

218+
export type BasicCardModel = {
219+
type: SubBlockType.BasicCard;
220+
} & BasicCardProps;
221+
218222
export type SubBlockModels =
219223
| DividerModel
220224
| CardModel
@@ -227,6 +231,7 @@ export type SubBlockModels =
227231
| CardWithImageModel
228232
| BackgroundCardModel
229233
| HubspotFormModel
230-
| BannerCardModel;
234+
| BannerCardModel
235+
| BasicCardModel;
231236

232237
export type SubBlock = SubBlockModels;

0 commit comments

Comments
 (0)