Skip to content

Commit a7f96b3

Browse files
authored
feat: add additional info (#1171)
1 parent 21618af commit a7f96b3

File tree

28 files changed

+38
-2
lines changed

28 files changed

+38
-2
lines changed

src/blocks/Header/Header.scss

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ $block: '.#{$ns}header-block';
55
$backgroundWidth: 1440px;
66

77
#{$block} {
8+
$root: &;
9+
810
position: relative;
911

1012
&_full-width {
@@ -36,6 +38,14 @@ $backgroundWidth: 1440px;
3638
color: var(--g-color-text-light-primary);
3739
}
3840
}
41+
42+
#{$block}__additional-info {
43+
.yfm p {
44+
color: var(
45+
--g-color-text-light-secondary
46+
) !important; /* stylelint-disable-line declaration-no-important */ // the selector that interrupts this color is too big;
47+
}
48+
}
3949
}
4050

4151
&_vertical-offset {
@@ -97,6 +107,17 @@ $backgroundWidth: 1440px;
97107
}
98108
}
99109

110+
&__additional-info {
111+
margin-top: $indentXS;
112+
113+
.yfm p {
114+
@include text-size(body-2);
115+
color: var(
116+
--g-color-text-secondary
117+
) !important; /* stylelint-disable-line declaration-no-important */ // the selector that interrupts this color is too big
118+
}
119+
}
120+
100121
&__buttons {
101122
margin-top: $indentXS;
102123
}
@@ -106,7 +127,7 @@ $backgroundWidth: 1440px;
106127
margin-top: $indentXS;
107128

108129
&:not(:last-child) {
109-
margin-right: $indentXS;
130+
margin-right: $indentXXS;
110131
}
111132
}
112133
}

src/blocks/Header/Header.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export const HeaderBlock = (props: React.PropsWithChildren<HeaderBlockFullProps>
8383
children,
8484
mediaView = 'full',
8585
centered,
86+
additionalInfo,
8687
} = props;
8788
const isMobile = React.useContext(MobileContext);
8889
const theme = useTheme();
@@ -165,6 +166,17 @@ export const HeaderBlock = (props: React.PropsWithChildren<HeaderBlockFullProps>
165166
/>
166167
</div>
167168
)}
169+
{additionalInfo && (
170+
<div className={b('additional-info', {theme: textTheme})}>
171+
<YFMWrapper
172+
content={additionalInfo}
173+
modifiers={{
174+
constructor: true,
175+
constructorTheme: textTheme,
176+
}}
177+
/>
178+
</div>
179+
)}
168180
{buttons && (
169181
<div className={b('buttons')} data-qa="header-buttons">
170182
{buttons.map((button, index) => (

src/blocks/Header/__stories__/Header.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export default {
3838
const DefaultArgs = {
3939
...data.default.content,
4040
description: yfmTransform(data.default.content.description),
41+
additionalInfo: yfmTransform(data.default.content.additionalInfo),
4142
};
4243

4344
const DefaultTemplate: StoryFn<HeaderBlockModel> = (args) => (

src/blocks/Header/__stories__/data.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"type": "header-block",
5353
"title": "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
5454
"description": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
55+
"additionalInfo": "**Ut enim ad minim veniam** ut aliquip ex ea commodo consequat. Duis aute irure [quis nostrud](https://example.com) dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
5556
"buttons": [
5657
{
5758
"text": "Button\r",

src/models/constructor-items/blocks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export interface HeaderBlockProps {
167167
title: string;
168168
overtitle?: string | JSX.Element;
169169
description?: string;
170+
additionalInfo?: string;
170171
buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme' | 'primary' | 'size' | 'extraProps'>[];
171172
width?: HeaderWidth;
172173
/** @deprecated imageSize now depends on width */

src/text-transform/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export const blockHeaderTransformer = [
137137
parser: parseTitle,
138138
},
139139
{
140-
fields: ['description'],
140+
fields: ['description', 'additionalInfo'],
141141
transformer: yfmTransformer,
142142
},
143143
];

0 commit comments

Comments
 (0)