11import React from "react" ;
2- import mediumZoom from "medium-zoom" ;
32import { BlockMapType , MapPageUrl , MapImageUrl } from "./types" ;
43import { Block } from "./block" ;
5- import { defaultMapImageUrl , defaultMapPageUrl } from "utils" ;
4+ import { defaultMapImageUrl , defaultMapPageUrl } from "./ utils" ;
65
76export interface NotionRendererProps {
87 blockMap : BlockMapType ;
@@ -12,7 +11,6 @@ export interface NotionRendererProps {
1211
1312 currentId ?: string ;
1413 level ?: number ;
15- zoom ?: any ;
1614}
1715
1816export const NotionRenderer : React . FC < NotionRendererProps > = ( {
@@ -33,21 +31,11 @@ export const NotionRenderer: React.FC<NotionRendererProps> = ({
3331 return null ;
3432 }
3533
36- const zoom =
37- props . zoom ||
38- ( typeof window !== "undefined" &&
39- mediumZoom ( {
40- container : ".notion" ,
41- background : "rgba(0, 0, 0, 0.8)" ,
42- margin : getMediumZoomMargin ( )
43- } ) ) ;
44-
4534 return (
4635 < Block
4736 key = { id }
4837 level = { level }
4938 block = { currentBlock }
50- zoom = { zoom }
5139 mapPageUrl = { mapPageUrl }
5240 mapImageUrl = { mapImageUrl }
5341 { ...props }
@@ -57,7 +45,6 @@ export const NotionRenderer: React.FC<NotionRendererProps> = ({
5745 key = { contentId }
5846 currentId = { contentId }
5947 level = { level + 1 }
60- zoom = { zoom }
6148 mapPageUrl = { mapPageUrl }
6249 mapImageUrl = { mapImageUrl }
6350 { ...props }
@@ -66,21 +53,3 @@ export const NotionRenderer: React.FC<NotionRendererProps> = ({
6653 </ Block >
6754 ) ;
6855} ;
69-
70- function getMediumZoomMargin ( ) {
71- const width = window . innerWidth ;
72-
73- if ( width < 500 ) {
74- return 8 ;
75- } else if ( width < 800 ) {
76- return 20 ;
77- } else if ( width < 1280 ) {
78- return 30 ;
79- } else if ( width < 1600 ) {
80- return 40 ;
81- } else if ( width < 1920 ) {
82- return 48 ;
83- } else {
84- return 72 ;
85- }
86- }
0 commit comments