From 052405e8c80f5af1097909718cf447fb280fb61a Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Fri, 15 Jan 2021 15:44:34 -0500 Subject: [PATCH] feat: fixes and styling --- lib/notion.ts | 4 +++- lib/types.ts | 8 -------- package.json | 6 +++--- pages/_app.tsx | 8 +++++--- styles/global.css | 4 ---- styles/notion.css | 4 ++++ yarn.lock | 28 ++++++++++++++-------------- 7 files changed, 29 insertions(+), 33 deletions(-) create mode 100644 styles/notion.css diff --git a/lib/notion.ts b/lib/notion.ts index 0dfdb1e..a217ba8 100644 --- a/lib/notion.ts +++ b/lib/notion.ts @@ -10,7 +10,9 @@ const notion = new NotionAPI({ export default notion export async function getPage(pageId: string): Promise { - const recordMap = await notion.getPage(pageId) + const recordMap = await notion.getPage(pageId, { + fetchParents: false + }) const blockIds = Object.keys(recordMap.block) const imageUrls: string[] = blockIds diff --git a/lib/types.ts b/lib/types.ts index 661e3ac..8dbe42b 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -50,14 +50,6 @@ export interface SiteMap { pageIds: string[] } -export interface Breadcrumb { - block: Block - active: boolean - pageId: string - title: string - icon: string -} - export interface PreviewImage { url: string originalWidth: number diff --git a/package.json b/package.json index 02ec45c..35f76ec 100644 --- a/package.json +++ b/package.json @@ -33,15 +33,15 @@ "is-url-superb": "^5.0.0", "lqip-modern": "^1.1.3", "next": "^10.0.6-canary.2", - "notion-client": "^3.0.0", + "notion-client": "^3.0.1", "notion-types": "^3.0.0", - "notion-utils": "^3.0.0", + "notion-utils": "^3.0.1", "p-map": "^4.0.0", "p-memoize": "^4.0.0", "react": "17.0.1", "react-body-classname": "^1.3.1", "react-dom": "17.0.1", - "react-notion-x": "^3.0.0", + "react-notion-x": "^3.0.1", "react-use": "^15.3.3" }, "devDependencies": { diff --git a/pages/_app.tsx b/pages/_app.tsx index c33e674..de8a421 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -13,8 +13,10 @@ import 'rc-dropdown/assets/index.css' // used for rendering equations (optional) // import 'katex/dist/katex.min.css' -import * as React from 'react' -import { useEffect } from 'react' +// global style overrides for notion +import 'styles/notion.css' + +import React from 'react' import { useRouter } from 'next/router' import { bootstrap } from 'lib/bootstrap-client' import { fathomId, fathomConfig } from 'lib/config' @@ -27,7 +29,7 @@ if (typeof window !== 'undefined') { export default function App({ Component, pageProps }) { const router = useRouter() - useEffect(() => { + React.useEffect(() => { if (fathomId) { Fathom.load(fathomId, fathomConfig) diff --git a/styles/global.css b/styles/global.css index 8cb0b8b..d449324 100644 --- a/styles/global.css +++ b/styles/global.css @@ -18,7 +18,3 @@ html { body { overflow-y: hidden; } - -.notion-page { - margin: 0 12px; -} diff --git a/styles/notion.css b/styles/notion.css new file mode 100644 index 0000000..25792da --- /dev/null +++ b/styles/notion.css @@ -0,0 +1,4 @@ +.notion-page { + margin: 0 12px; + width: 728px; +} diff --git a/yarn.lock b/yarn.lock index 50726b4..5f0c72c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4297,14 +4297,14 @@ normalize-url@^4.1.0: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.0.tgz#453354087e6ca96957bd8f5baf753f5982142129" integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ== -notion-client@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/notion-client/-/notion-client-3.0.0.tgz#46718092620874f5b11972debf36244951fa017a" - integrity sha512-ZDyh2+P47mkTAe92COhsC/smiKrC5wuBOjPU6PsGU9hjqgM1ZMoQ4DJsoe88Bn8ZcU3Nr5idiJluXKwLdjfYxA== +notion-client@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/notion-client/-/notion-client-3.0.1.tgz#3e446928a3744bb4a8118a8773b06184d9739011" + integrity sha512-GBzSUIoAxtGUp0AkvCh/ucKy6bXwHu/BsB7ri+L8W3iGJQ0DVQgvNJODMNZie/fkWwFVdlYy5Qzl87D06JGDnw== dependencies: node-fetch "^2.6.1" notion-types "^3.0.0" - notion-utils "^3.0.0" + notion-utils "^3.0.1" p-map "^4.0.0" notion-types@^3.0.0: @@ -4312,10 +4312,10 @@ notion-types@^3.0.0: resolved "https://registry.yarnpkg.com/notion-types/-/notion-types-3.0.0.tgz#498a018338556eff71d8ea6d104992525573191f" integrity sha512-Wq/xUmf9YAZI0riZrDf5oL58N+4J4ydHqguMkr6V1YZsXnLUEYlV7GUsCzhYwehOBjGKV4ocD7FiWOSi54IUOw== -notion-utils@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/notion-utils/-/notion-utils-3.0.0.tgz#f2eb1734f50aa70ed30ed82023ec0f5a0bb41255" - integrity sha512-r3ohJcwAWvr4DR/MKQf5nvlpx8uHgC17dWtBAtyk+xxyDesDltPQ+nT7B5YWwGKdUFKiad1HMqL1yGmM8+TGAw== +notion-utils@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/notion-utils/-/notion-utils-3.0.1.tgz#31b4e5eeb42588453019330c11e523d79f63b4cf" + integrity sha512-sXgRWkxN2BscU6wPVrYApOnNqiA4JvUpt0MfRlV5xUYmw/9xqiDYmiipN/BtUM7TkAx6p96kXFk3xm4ZU06GPg== dependencies: notion-types "^3.0.0" p-queue "^6.6.1" @@ -5109,10 +5109,10 @@ react-modal@^3.11.2: react-lifecycles-compat "^3.0.0" warning "^4.0.3" -react-notion-x@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/react-notion-x/-/react-notion-x-3.0.0.tgz#210e5e93980cf57c63babf9205afd2003e6a0390" - integrity sha512-do/djGJuYHOEWjg1kAE0qNkYhjJPQpRtfgeyLtFsokAITlaeYxVLOrl5LLVC5GybFbvydqy3ZwkwWOKA7g+1Cw== +react-notion-x@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/react-notion-x/-/react-notion-x-3.0.1.tgz#db0fe7de8398f4e67e830ffad17533ae2dc15aab" + integrity sha512-sgNzWQNEzX+nI3nDIkMASDXHaPPSrlvvWXTvN8H/LgG39tm+3CTICaSmbm+ZYC+HNEwPwlXGXFG6AtvM+nWXCw== dependencies: "@matejmazur/react-katex" "^3.1.3" date-fns "^2.15.0" @@ -5122,7 +5122,7 @@ react-notion-x@^3.0.0: lodash.throttle "^4.1.1" medium-zoom "^1.0.6" notion-types "^3.0.0" - notion-utils "^3.0.0" + notion-utils "^3.0.1" prismjs "^1.20.0" rc-dropdown "^3.1.2" rc-menu "^8.5.2"