Skip to content

Commit

Permalink
Add basic support page page link blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
n6g7 committed Sep 16, 2020
1 parent 2112efe commit 011d40f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/react/lib/Block.tsx
@@ -1,6 +1,7 @@
import React from "react";
import debug from "debug";
import { BlockValues, TextSection, TextModifier } from "@notion-cms/types";
import NotionLink from "./NotionLink";

const log = debug("notion-cms:react");

Expand All @@ -19,6 +20,12 @@ const applyModifier = (
return <em>{children}</em>;
case "a":
return <a href={mod[1]}>{children}</a>;
case "p":
return (
<NotionLink pageId={mod[1]}>
Page <code>{mod[1]}</code>
</NotionLink>
);
default:
log('Ignoring unknown text modifier "%s": %O', mod[0], mod);
return children;
Expand Down
2 changes: 1 addition & 1 deletion packages/types/lib/index.ts
Expand Up @@ -66,7 +66,7 @@ export interface PageBlockValues extends BaseBlockValues {
};
}

export type TextModifier = ["b"] | ["i"] | ["a", string];
export type TextModifier = ["b"] | ["i"] | ["a", string] | ["p", UUID];
export type TextSection = [string, TextModifier[]];

interface TextBlockValues<T extends BaseBlockValues["type"] = "text">
Expand Down

0 comments on commit 011d40f

Please sign in to comment.