Skip to content

Commit

Permalink
fix(mdx-paragraph): remove nested img and div in p
Browse files Browse the repository at this point in the history
issue #701
close #752
  • Loading branch information
sabertazimi committed Apr 30, 2022
1 parent 14d787e commit de10eb0
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 46 deletions.
7 changes: 3 additions & 4 deletions components/Aside/Aside.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
.admonition div,
.admonition ol,
.admonition ul {
@apply mb-3;
@apply mb-3 !important;
}

.admonition ol li::before {
@apply mr-1;
@apply mr-1 !important;
}

.admonition div:last-child,
.admonition ol:last-child,
.admonition ul:last-child,
.admonition li,
.admonition div p {
.admonition li {
@apply my-0 !important;
}
56 changes: 20 additions & 36 deletions components/ErrorBoundary/__snapshots__/ErrorBoundary.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -40,56 +40,40 @@ exports[`ErrorBoundary should render alert message correctly (snapshot) 1`] = `
role="alert"
>
<div
class="ant-typography"
class="ant-typography mt-0 mb-9 leading-relaxed tracking-wide"
>
<p
class="mt-0 mb-9 leading-relaxed tracking-wide"
<span
class="ant-typography text-xl font-extrabold"
>
<span
class="ant-typography text-xl font-extrabold"
>
Please check the following information:
</span>
</p>
Please check the following information:
</span>
</div>
<div
class="ant-typography"
class="ant-typography mt-0 mb-9 leading-relaxed tracking-wide"
>
<p
class="mt-0 mb-9 leading-relaxed tracking-wide"
<span
class="ant-typography"
>
<span
class="ant-typography"
>
ComponentWithError.
</span>
</p>
ComponentWithError.
</span>
</div>
<div
class="ant-typography"
class="ant-typography mt-0 mb-9 leading-relaxed tracking-wide"
>
<p
class="mt-0 mb-9 leading-relaxed tracking-wide"
<span
class="ant-typography"
>
<span
class="ant-typography"
>
Please check terminal output for further details.
</span>
</p>
Please check terminal output for further details.
</span>
</div>
<div
class="ant-typography"
class="ant-typography mt-0 mb-9 leading-relaxed tracking-wide"
>
<p
class="mt-0 mb-9 leading-relaxed tracking-wide"
<span
class="ant-typography"
>
<span
class="ant-typography"
>
Please reload this page after changing code.
</span>
</p>
Please reload this page after changing code.
</span>
</div>
</div>
</div>
Expand Down
10 changes: 8 additions & 2 deletions components/ImageCard/ImageCard.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import Card from '@components/Card';
import Image from '@components/Image';
import { classNames } from '@components/utils';

interface Props {
src?: string;
title?: string;
alt?: string;
className?: string;
}

const ImageCard = ({ src, title, alt }: Props): JSX.Element => {
const ImageCard = ({ src, title, alt, className }: Props): JSX.Element => {
if (!src) {
return (
<Image
Expand All @@ -20,7 +22,11 @@ const ImageCard = ({ src, title, alt }: Props): JSX.Element => {
}

return (
<Card size="small" cover={<Image src={src} alt={alt} />}>
<Card
size="small"
cover={<Image src={src} alt={alt} />}
className={classNames(className, 'text-center')}
>
<Card.Meta title={title} description={alt} />
</Card>
);
Expand Down
2 changes: 1 addition & 1 deletion components/ImageCard/__snapshots__/ImageCard.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`ImageCard should render local image correctly (snapshot) 1`] = `
<div>
<div
class="ant-card ant-card-bordered ant-card-small"
class="ant-card ant-card-bordered ant-card-small text-center"
>
<div
class="ant-card-cover"
Expand Down
11 changes: 8 additions & 3 deletions components/Paragraph/Paragraph.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { classNames } from '@components/utils';
import { Typography } from 'antd';
import type { ReactNode } from 'react';

interface Props {
children?: ReactNode;
className?: string;
}

const Paragraph = ({ children, ...props }: Props): JSX.Element => (
<Typography.Paragraph {...props}>
<p className="mt-0 mb-9 leading-relaxed tracking-wide">{children}</p>
const Paragraph = ({ children, className, ...props }: Props): JSX.Element => (
<Typography.Paragraph
{...props}
className={classNames(className, 'mt-0 mb-9 leading-relaxed tracking-wide')}
>
{children}
</Typography.Paragraph>
);

Expand Down

0 comments on commit de10eb0

Please sign in to comment.