Skip to content

Commit

Permalink
feat: replace HTML with YFMWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
niktverd committed Oct 2, 2024
1 parent aba9dc8 commit 7e4727e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/blocks/YFM/YFM.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const YFM = (props: YFMProps) => {
blog: true,
resetPaddings: true,
}}
className={b({'no-list-reset': true})}
contentClassName={b({'no-list-reset': true})}
/>
</Wrapper>
);
Expand Down
12 changes: 8 additions & 4 deletions src/components/PostCard/PostCard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,18 @@ $block: '.#{$namespace}post-card';
}

&__title {
margin-bottom: $indentXXXS;

&_size_s {
@include heading4();
@include add-specificity(&) {
@include heading4();
margin-bottom: $indentXXXS;
}
}

&_size_m {
@include heading2();
@include add-specificity(&) {
@include heading2();
margin-bottom: $indentXXXS;
}
}
}

Expand Down
24 changes: 14 additions & 10 deletions src/components/PostCard/PostCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useContext, useMemo} from 'react';
import {AnalyticsEventsProp, CardBase, HTML, YFMWrapper} from '@gravity-ui/page-constructor';
import {AnalyticsEventsProp, CardBase, YFMWrapper} from '@gravity-ui/page-constructor';
import {useUniqId} from '@gravity-ui/uikit';

import {LikesContext} from '../../contexts/LikesContext';
Expand Down Expand Up @@ -91,17 +91,21 @@ export const PostCard = ({
{tags[0].name}
</div>
)}
{title &&
React.createElement(
titleHeadingLevel,
{className: b('title', {size})},
<span>
<HTML id={titleId}>{title}</HTML>
</span>,
)}
{title && (
<YFMWrapper
contentClassName={b('title', {size})}
content={title}
modifiers={{
blog: true,
blogCard: true,
}}
id={titleId}
variant={titleHeadingLevel}
/>
)}
{description && (
<YFMWrapper
className={b('description')}
contentClassName={b('description')}
content={description}
modifiers={{
blog: size === 'm',
Expand Down

0 comments on commit 7e4727e

Please sign in to comment.