Skip to content

Commit

Permalink
Post Comments Count: Prevent text-decoration from affecting warning (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw authored Aug 23, 2022
1 parent 8d2ebc5 commit f6eab05
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/block-library/src/post-comments-count/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ export default function PostCommentsCountEdit( {
} );
}, [ postId ] );

const hasPostAndComments = postId && commentsCount !== undefined;
const blockStyles = {
...blockProps.style,
textDecoration: hasPostAndComments
? blockProps.style?.textDecoration
: undefined,
};

return (
<>
<BlockControls group="block">
Expand All @@ -59,8 +67,8 @@ export default function PostCommentsCountEdit( {
} }
/>
</BlockControls>
<div { ...blockProps }>
{ postId && commentsCount !== undefined ? (
<div { ...blockProps } style={ blockStyles }>
{ hasPostAndComments ? (
commentsCount
) : (
<Warning>
Expand Down

0 comments on commit f6eab05

Please sign in to comment.