Skip to content

Commit

Permalink
fix: codeblock component was printing code to screen.. weird (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
slackermorris authored Jun 29, 2023
1 parent 2bbc102 commit 6c8a4d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion app/components/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const CodeBlock = ({
</code>
</pre>
<P styleProps={["italic"]}>{caption}</P>
<div>{code}</div>
</div>
);
};
Expand Down
6 changes: 3 additions & 3 deletions app/routes/braindumps.list.$braindumpId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ type LoaderData = {
};

export const loader: LoaderFunction = async ({ params }) => {

/* 1. retrieve the Notion Page equivalent of this Braindump */
const response: Page = await notionClient.pages.retrieve({
page_id: params.braindumpId,
Expand Down Expand Up @@ -306,12 +305,13 @@ const useNotionInterpretBlocks = (
return null;

case "code":
// todo: throw an error if a code block is missing a caption
return (
<CodeBlock
key={block.id}
content={{
caption: block.code.caption[0].plain_text,
...(block.code.caption[0] && {
caption: block.code.caption[0].plain_text,
}),
code: block.code.rich_text[0].plain_text,
}}
/>
Expand Down

0 comments on commit 6c8a4d6

Please sign in to comment.