Skip to content

Commit f77fc5e

Browse files
author
Juli Ovechkina
authored
fix(BlockHeader): add yfm to description, change styles (#105)
* fix(HeaderComponent): add yfm to description * fix: change margin after title, change font-size of description * fix: schemas
1 parent 2136f7b commit f77fc5e

File tree

15 files changed

+111
-131
lines changed

15 files changed

+111
-131
lines changed

CODEOWNERS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
* @gorgeousvlad
1+
* @gorgeousvlad @yuberdysheva
22

33
@aapolkovsky
44
@aeksandla
55
@Lunatic174
6-
@yuberdysheva

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,5 @@
133133
"*.{json,yaml,yml,md}": [
134134
"prettier --write"
135135
]
136-
},
137-
"publishConfig": {
138-
"tag": "alpha"
139136
}
140137
}

src/blocks/CardLayout/schema.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
containerSizesObject,
44
ChildrenCardsProps,
55
BlockBaseProps,
6-
TitleProps,
6+
BlockHeaderProps,
77
} from '../../schema/validators/common';
88

99
export const CardLayoutProps = {
@@ -12,13 +12,7 @@ export const CardLayoutProps = {
1212
properties: {
1313
...BlockBaseProps,
1414
...AnimatableProps,
15-
title: {
16-
oneOf: [{type: 'string', contentType: 'text'}, TitleProps],
17-
},
18-
description: {
19-
type: 'string',
20-
contentType: 'yfm',
21-
},
15+
...BlockHeaderProps,
2216
colSizes: containerSizesObject,
2317
children: ChildrenCardsProps,
2418
},

src/blocks/ExtendedFeatures/schema.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
containerSizesObject,
44
LinkProps,
55
BlockBaseProps,
6-
TitleProps,
6+
BlockHeaderProps,
77
} from '../../schema/validators/common';
88
import {filteredArray} from '../../schema/validators/utils';
99

@@ -37,13 +37,7 @@ export const ExtendedFeaturesBlock = {
3737
properties: {
3838
...BlockBaseProps,
3939
...AnimatableProps,
40-
title: {
41-
oneOf: [{type: 'string', contentType: 'text'}, TitleProps],
42-
},
43-
description: {
44-
type: 'string',
45-
contentType: 'yfm',
46-
},
40+
...BlockHeaderProps,
4741
items: filteredArray(ExtendedFeaturesItem),
4842
colSizes: containerSizesObject,
4943
},

src/blocks/LinkTable/schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {filteredArray} from '../../schema/validators/utils';
2-
import {LinkProps, BlockBaseProps, TitleProps} from '../../schema/validators/common';
2+
import {LinkProps, BlockBaseProps, BlockHeaderProps} from '../../schema/validators/common';
33

44
export const LinkTableBlock = {
55
'link-table-block': {
66
additionalProperties: false,
77
required: ['items'],
88
properties: {
99
...BlockBaseProps,
10-
title: TitleProps,
10+
...BlockHeaderProps,
1111
items: {
1212
type: 'array',
1313
items: filteredArray(LinkProps),

src/blocks/PromoFeaturesBlock/schema.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {AnimatableProps, BlockBaseProps, TitleProps} from '../../schema/validators/common';
1+
import {AnimatableProps, BlockBaseProps, BlockHeaderProps} from '../../schema/validators/common';
22
import {filteredArray} from '../../schema/validators/utils';
33
import {Media} from '../Media/schema';
44

@@ -28,13 +28,7 @@ export const PromoFeaturesBlock = {
2828
properties: {
2929
...BlockBaseProps,
3030
...AnimatableProps,
31-
title: {
32-
oneOf: [{type: 'string', contentType: 'text'}, TitleProps],
33-
},
34-
description: {
35-
type: 'string',
36-
contentType: 'text',
37-
},
31+
...BlockHeaderProps,
3832
theme: {
3933
enum: ['grey', 'default'],
4034
},

src/blocks/Slider/schema.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {
22
BlockBaseProps,
3-
TitleProps,
43
AnimatableProps,
54
ChildrenCardsProps,
65
sliderSizesObject,
76
textSize,
7+
BlockHeaderProps,
88
} from '../../schema/validators/common';
99

1010
const LoadableProps = {
@@ -58,11 +58,6 @@ export const SliderProps = {
5858
arrows: {
5959
type: 'boolean',
6060
},
61-
description: {
62-
type: 'string',
63-
contentType: 'text',
64-
},
65-
title: TitleProps,
6661
randomOrder: {
6762
type: 'boolean',
6863
},
@@ -84,6 +79,7 @@ export const SliderBlock = {
8479
...BlockBaseProps,
8580
...AnimatableProps,
8681
...SliderProps,
82+
...BlockHeaderProps,
8783
},
8884
},
8985
};

src/blocks/Tabs/schema.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
LinkProps,
44
withTheme,
55
BlockBaseProps,
6-
TitleProps,
6+
BlockHeaderProps,
77
MediaProps,
88
containerSizesArray,
99
sizeNumber,
@@ -44,11 +44,7 @@ export const TabsBlock = {
4444
required: ['title', 'items'],
4545
properties: {
4646
...BlockBaseProps,
47-
title: TitleProps,
48-
description: {
49-
type: 'string',
50-
contentType: 'text',
51-
},
47+
...BlockHeaderProps,
5248
tabsColSizes: containerSizesArray.reduce(
5349
(acc, size) => ({...acc, [size]: sizeNumber}),
5450
{},
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
@import '../../../styles/variables.scss';
22
@import '../../../styles/mixins.scss';
33

4-
$block: '.#{$ns}BlockHeader';
4+
$block: '.#{$ns}block-header';
55

66
#{$block} {
77
&__description {
8-
@include text-size(body-2);
8+
.yfm {
9+
@include text-size(body-3);
10+
}
911

10-
margin-top: $indentXS;
12+
margin-top: $indentXXS;
1113

1214
&_titleSize_s {
13-
margin-top: 8px;
14-
}
15-
16-
&_titleSize_l {
17-
@include text-size(body-3);
18-
}
15+
margin-top: $indentXXXS;
1916

20-
a {
21-
@include link();
17+
.yfm {
18+
@include text-size(body-2);
19+
}
2220
}
2321
}
2422
}

src/components/BlockHeader/BlockHeader.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import React from 'react';
33
import {block} from '../../utils';
44
import {BlockHeaderProps as BlockHeaderParams, TitleProps, ClassNameProps} from '../../models';
55
import {Col, GridColumnSizesType} from '../../grid';
6-
import {Title, HTML} from '../';
6+
import {Title} from '../';
7+
import YFMWrapper from '../YFMWrapper/YFMWrapper';
78

89
import './BlockHeader.scss';
910

10-
const b = block('BlockHeader');
11+
const b = block('block-header');
1112

1213
export interface BlockHeaderProps extends BlockHeaderParams {
1314
colSizes?: GridColumnSizesType;
@@ -34,9 +35,9 @@ const BlockHeader = ({
3435
</Col>
3536
)}
3637
{description && (
37-
<Col reset sizes={{all: 12, sm: 8}}>
38+
<Col reset sizes={colSizes}>
3839
<div className={b('description', {titleSize: titleProps?.textSize})}>
39-
<HTML>{description}</HTML>
40+
<YFMWrapper content={description} modifiers={{constructor: true}} />
4041
</div>
4142
</Col>
4243
)}

0 commit comments

Comments
 (0)