-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug/#32 BlockTypes: かなるs TypeBlocks マージ
- かなるs方法の方ではネストされた - Number/BulletedListItem, Paragraph が鍵。 BlockTypeにblock.childrenを記述した。 - ジェネリクスBlockWithChildrenを記述した ## Feature - Ram Gorila 会話
- Loading branch information
Showing
18 changed files
with
80 additions
and
34 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
src/components/notion/blocks/BulletedListItem/BulletedListItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
import type { BulletedListItemBlockObjectResponse } from '@notionhq/client/build/src/api-endpoints'; | ||
import type { FC } from 'react'; | ||
import type { BlockWithChildren } from '~/types/notion'; | ||
|
||
import { NotionBlock } from '~/components/notion'; | ||
import { RichText } from '~/components/notion/RichText'; | ||
|
||
type Props = { | ||
block: BulletedListItemBlockObjectResponse; | ||
block: BlockWithChildren<BulletedListItemBlockObjectResponse>; | ||
}; | ||
|
||
export const BulletedListItem: FC<Props> = ({ block }) => { | ||
export const BulletedListItem: FC<Props> = ({ block }: Props) => { | ||
return ( | ||
<li className="sp:text-sm"> | ||
<RichText text={block.bulleted_list_item.rich_text} /> | ||
{block.children?.map((child) => ( | ||
<NotionBlock block={child} key={child.id} /> | ||
))} | ||
</li> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
src/components/notion/blocks/NumberedListItem/NumberedListItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
import type { NumberedListItemBlockObjectResponse } from '@notionhq/client/build/src/api-endpoints'; | ||
import type { FC } from 'react'; | ||
import type { BlockWithChildren } from "~/types/notion"; | ||
|
||
import { NotionBlock } from '~/components/notion'; | ||
import { RichText } from '~/components/notion/RichText'; | ||
|
||
type Props = { | ||
block: NumberedListItemBlockObjectResponse; | ||
block: BlockWithChildren<NumberedListItemBlockObjectResponse>; | ||
}; | ||
|
||
export const NumberedListItem: FC<Props> = ({ block }) => { | ||
export const NumberedListItem: FC<Props> = ({ block }: Props) => { | ||
return ( | ||
<li className="pl-2 list-decimal sp:text-sm"> | ||
<RichText text={block.numbered_list_item.rich_text} /> | ||
{block.children?.map((child) => ( | ||
<NotionBlock block={child} key={child.id} /> | ||
))} | ||
</li> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,27 @@ | ||
import type { ParagraphBlockObjectResponse } from '@notionhq/client/build/src/api-endpoints'; | ||
import type { FC } from 'react'; | ||
import type { BlockWithChildren } from '~/types/notion'; | ||
|
||
import { NotionBlock } from '~/components/notion'; | ||
import { RichText } from '~/components/notion/RichText'; | ||
|
||
type Props = { | ||
block: ParagraphBlockObjectResponse; | ||
block: BlockWithChildren<ParagraphBlockObjectResponse>; | ||
}; | ||
|
||
export const Paragraph: FC<Props> = ({ block }) => { | ||
export const Paragraph: FC<Props> = ({ block }: Props) => { | ||
return ( | ||
<div> | ||
<RichText text={block.paragraph.rich_text} /> | ||
</div> | ||
<> | ||
<p className="mt-1 min-h-[18px]"> | ||
<RichText text={block.paragraph.rich_text} /> | ||
</p> | ||
{block.children && ( | ||
<div className="ml-4"> | ||
{block.children.map((child) => ( | ||
<NotionBlock block={child} key={child.id} /> | ||
))} | ||
</div> | ||
)} | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters