Skip to content

Commit 5c08f12

Browse files
authored
feat: added col size for header in icons block (#715)
* feat: added col size for header in icons block * fix: revert block file * fix: use PageConstructor instead of DefaultTemplate for storyBook with colSizes
1 parent af49608 commit 5c08f12

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

src/blocks/Icons/Icons.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ $block: '.#{$ns}icons-block';
3232
width: 100%;
3333
padding-bottom: $indentSM;
3434
text-align: center;
35+
36+
display: flex;
37+
flex-direction: column;
38+
align-items: center;
39+
height: max-content;
3540
}
3641

3742
&__text {

src/blocks/Icons/Icons.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const getItemContent = (item: IconsBlockProps['items'][number]) => (
1717
</Fragment>
1818
);
1919

20-
const Icons = ({title, description, size = 's', items}: IconsBlockProps) => {
20+
const Icons = ({title, description, size = 's', colSizes = {all: 12}, items}: IconsBlockProps) => {
2121
const {hostname} = useContext(LocationContext);
2222
const handleAnalytics = useAnalytics();
2323

@@ -35,7 +35,7 @@ const Icons = ({title, description, size = 's', items}: IconsBlockProps) => {
3535
className={b('header')}
3636
title={title}
3737
subtitle={description}
38-
colSizes={{all: 12}}
38+
colSizes={colSizes}
3939
/>
4040
)}
4141
{items.map((item) => {

src/blocks/Icons/__stories__/Icons.stories.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,35 @@ const SizeTemplate: StoryFn<IconsBlockModel> = (args) => (
3030
</Fragment>
3131
);
3232

33+
const ColSizeTemplate: StoryFn<IconsBlockModel> = (args) => (
34+
<Fragment>
35+
<PageConstructor
36+
content={{
37+
blocks: [
38+
{
39+
...args,
40+
title: 'ColSize 12',
41+
},
42+
{
43+
...args,
44+
title: 'ColSize 8',
45+
colSizes: {all: 8},
46+
},
47+
{
48+
...args,
49+
title: 'ColSize 4',
50+
colSizes: {all: 4},
51+
},
52+
],
53+
}}
54+
/>
55+
</Fragment>
56+
);
57+
3358
export const Default = DefaultTemplate.bind([]);
3459
export const Size = SizeTemplate.bind([]);
3560
export const WithText = WithDescriptionTemplate.bind({});
61+
export const HeaderColSize = ColSizeTemplate.bind({});
3662

3763
const transformedText = yfmTransform(data.withDescription.content.description);
3864

@@ -42,3 +68,7 @@ WithText.args = {
4268
...data.withDescription.content,
4369
description: transformedText,
4470
} as IconsBlockProps;
71+
HeaderColSize.args = {
72+
...data.withDescription.content,
73+
description: transformedText,
74+
} as IconsBlockProps;

src/models/constructor-items/blocks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ export interface IconsBlockProps {
334334
description?: string;
335335
size?: 's' | 'm' | 'l';
336336
items: IconsBlockItemProps[];
337+
colSizes?: GridColumnSizesType;
337338
}
338339

339340
interface ContentLayoutBlockParams {

0 commit comments

Comments
 (0)