Skip to content

Commit 2b09aea

Browse files
committed
feat: add empty rich text component and adjust toggle icon styles
1 parent 93f3fcb commit 2b09aea

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

packages/notion-to-jsx/src/components/Renderer/components/Code/CodeBlock.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const CodeBlock = ({ code, language, caption }: Props) => {
5555
{tokens.map((token, i) => renderToken(token, i))}
5656
</code>
5757
</pre>
58-
{caption && (
58+
{caption && caption.length > 0 && (
5959
<figcaption>
6060
<MemoizedRichText richTexts={caption} />
6161
</figcaption>

packages/notion-to-jsx/src/components/Renderer/components/RichText/RichTexts.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ReactNode } from 'react';
2-
import { richText, link } from './styles.css';
2+
import { richText, link, emptyRichText } from './styles.css';
33

44
// 지원하는 Notion 색상 타입 정의
55
type NotionColor =
@@ -63,7 +63,13 @@ export interface RichTextProps {
6363
richTexts: RichTextItem[];
6464
}
6565

66+
const EmptyRichText = () => <div className={emptyRichText} />;
67+
6668
const RichTexts = ({ richTexts }: RichTextProps) => {
69+
if (richTexts.length === 0) {
70+
return <EmptyRichText />;
71+
}
72+
6773
return (
6874
<>
6975
{richTexts.map((text, index) => {

packages/notion-to-jsx/src/components/Renderer/components/RichText/styles.css.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,7 @@ export const link = style({
8989
wordBreak: 'break-word',
9090
overflowWrap: 'break-word',
9191
});
92+
93+
export const emptyRichText = style({
94+
height: vars.spacing.lg,
95+
});

packages/notion-to-jsx/src/components/Renderer/components/Toggle/styles.css.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ export const toggleIcon = style({
2525
alignItems: 'center',
2626
justifyContent: 'center',
2727
transition: 'transform 0.2s ease',
28-
width: '1.2rem',
29-
height: '1.2rem',
3028
});
3129

3230
export const toggleIconOpen = style({

0 commit comments

Comments
 (0)