Skip to content

Commit

Permalink
fix/notion full screen issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsFlash10 committed Sep 11, 2024
1 parent ccf889b commit d21c856
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
1 change: 0 additions & 1 deletion apps/web/components/BlogAppbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ export const BlogAppbar = ({

useEffect(() => {
const savedView = localStorage.getItem("viewMode");
console.log({ savedView, check: savedView === "legacy" });
setIsLegacyMode(savedView === "legacy");
}, []);

Expand Down
22 changes: 16 additions & 6 deletions apps/web/components/NotionRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
"use client";
import { useMemo } from "react";
import { NotionRenderer as NotionRendererLib } from "react-notion-x";
import { useEffect, useMemo } from "react";
import { NotionComponents, NotionRenderer as NotionRendererLib } from "react-notion-x";
import { useTheme } from "next-themes";
import { useRecoilValue } from "recoil";
import Image from "next/image";
import Link from "next/link";

import { isLegacyViewMode } from "@repo/store";

import CodeBlock from "./CodeBlock";

// Week-4-1-647987d9b1894c54ba5c822978377910
export const NotionRenderer = ({ recordMap }: { recordMap: any }) => {
const { resolvedTheme } = useTheme();
const isDarkMode = resolvedTheme === "dark";

const isLegacyMode = useRecoilValue(isLegacyViewMode);

const components = useMemo(
useEffect(() => {
const elements = document.querySelectorAll(".notion-full-width");
if (elements) {
elements.forEach((e) => {
e.classList.remove("notion-full-width");
});
}
}, []);

const components: Partial<NotionComponents> = useMemo(
() => ({
Code: CodeBlock,
// can add more components that are supported here
Image: Image,
Link: Link,
}),
[]
);
Expand Down

0 comments on commit d21c856

Please sign in to comment.