Skip to content

Commit ff02ea5

Browse files
authored
fix: add transfrom title in html for content item (#713)
* fix: add transfrom title in html for content item * fix: removed duplicate qaAttributes * fix: updated storyBook * fix: inherit line-height for yfm block in title * fix: added yfm class to size_s for title * fix: added correct font-size to yfm * fix: added correct font-size to yfm
1 parent 5c08f12 commit ff02ea5

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

src/components/ContentList/ContentList.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,11 @@ $marginIconSizeL: 1px;
8383
&__item {
8484
display: flex;
8585
}
86+
87+
#{$block}__title {
88+
.yfm {
89+
font-size: inherit;
90+
line-height: inherit;
91+
}
92+
}
8693
}

src/components/ContentList/ContentList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const ContentList = ({list, size = 'l', qa}: ContentListProps & QAProps) => {
4343
React.createElement(
4444
getHeadingLevel(size),
4545
{className: b('title'), 'data-qa': qaAttributes.title},
46-
title,
46+
<YFMWrapper content={title} modifiers={{constructor: true}} />,
4747
)}
4848
{text && (
4949
<YFMWrapper

src/components/ContentList/__stories__/ContentList.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ import * as ContentListStories from './ContentList.stories.tsx';
1111

1212
`list: Array` - An Array of items with icon
1313
- [`icon: string | ImageObjectProps | ReactNode` — Icon](?path=/docs/documentation-types--docs#imageobjectprops---image-property).
14-
- `title?: string` — Title.
14+
- `title?: string` — Title (with YFM support).
1515
- `text?: string` — Text (with YFM support)
1616
</StoryTemplate>

src/components/ContentList/__stories__/ContentList.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import data from './data.json';
1111
const transformList = (item: ContentItemProps) => ({
1212
...item,
1313
text: item?.text && yfmTransform(item.text),
14+
title: item?.title && yfmTransform(item.title),
1415
});
1516

1617
export default {

src/components/ContentList/__stories__/data.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"light": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/icon_1_light.svg",
1212
"dark": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/icon_1_dark.svg"
1313
},
14-
"title": "Default",
14+
"title": "Default [quis nostrud](https://example.com)",
1515
"text": "**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. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
1616
},
1717
{

src/text-transform/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ export const config: BlocksConfig = {
339339
{
340340
fields: ['list'],
341341
transformer: yfmTransformer,
342-
parser: createItemsParser(['text']),
342+
parser: createItemsParser(['title', 'text']),
343343
},
344344
],
345345
[BlockType.InfoBlock]: [

0 commit comments

Comments
 (0)