({
id,
courseId,
}: {
id: string;
courseId: number;
})
| 27 | |
| 28 | // Week-4-1-647987d9b1894c54ba5c822978377910 |
| 29 | export const NotionRenderer = ({ |
| 30 | id, |
| 31 | courseId, |
| 32 | }: { |
| 33 | id: string; |
| 34 | courseId: number; |
| 35 | }) => { |
| 36 | const { resolvedTheme } = useTheme(); |
| 37 | |
| 38 | const [data, setData] = useState(null); |
| 39 | async function main() { |
| 40 | const res = await fetch(`/api/notion?id=${id}`); |
| 41 | const json = await res.json(); |
| 42 | setData(json.recordMap); |
| 43 | } |
| 44 | |
| 45 | useEffect(() => { |
| 46 | main(); |
| 47 | |
| 48 | return () => { |
| 49 | handleMarkAsCompleted(true, courseId); |
| 50 | }; |
| 51 | }, [id]); |
| 52 | |
| 53 | if (!data) { |
| 54 | return <Loader />; |
| 55 | } |
| 56 | |
| 57 | return ( |
| 58 | <div> |
| 59 | {/* <Link href={`/pdf/${id}`} target="_blank"> |
| 60 | <Button size={'lg'} className="gap-2"> |
| 61 | Download |
| 62 | <Download className="size-4" /> |
| 63 | </Button> |
| 64 | </Link> */} |
| 65 | <div> |
| 66 | <style> |
| 67 | {` |
| 68 | :root { |
| 69 | --bg-color: #F8F8F8; |
| 70 | --fg-color: #333333; |
| 71 | } |
| 72 | .dark-mode { |
| 73 | --bg-color: #1A1A1A; |
| 74 | --fg-color: #E0E0E0; |
| 75 | } |
| 76 | .notion { |
| 77 | background-color: var(--bg-color); |
| 78 | color: var(--fg-color); |
| 79 | max-width: 100%; |
| 80 | overflow-wrap: break-word; |
| 81 | word-wrap: break-word; |
| 82 | word-break: break-word; |
| 83 | border-radius: 1rem; |
| 84 | } |
| 85 | .notion-page { |
| 86 | padding: 1rem !important; |
nothing calls this directly
no test coverage detected