diff --git a/components/Tabs.js b/components/Tabs.js index 39308d29..6f7497ba 100644 --- a/components/Tabs.js +++ b/components/Tabs.js @@ -37,7 +37,7 @@ const Tabs = ({ className, children }) => { onClick={() => { tabClickHandle(index) }}> - {item?.key || 'undefined_key'} + {item?.key} })} diff --git a/themes/Medium/LayoutSlug.js b/themes/Medium/LayoutSlug.js index 366049e7..79e20588 100644 --- a/themes/Medium/LayoutSlug.js +++ b/themes/Medium/LayoutSlug.js @@ -6,7 +6,13 @@ import 'prismjs/components/prism-javascript' import 'prismjs/components/prism-markup' import 'prismjs/components/prism-python' import 'prismjs/components/prism-typescript' -import { Code, Collection, CollectionRow, Equation, NotionRenderer } from 'react-notion-x' +import { + Code, + Collection, + CollectionRow, + Equation, + NotionRenderer +} from 'react-notion-x' import LayoutBase from './LayoutBase' import Comment from '@/components/Comment' import Image from 'next/image' @@ -17,12 +23,14 @@ import mediumZoom from 'medium-zoom' import React, { useEffect, useRef } from 'react' import ArticleAround from './components/ArticleAround' import Catalog from './components/Catalog' +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' +import { faEye } from '@fortawesome/free-solid-svg-icons' const mapPageUrl = id => { return 'https://www.notion.so/' + id.replace(/-/g, '') } -export const LayoutSlug = (props) => { +export const LayoutSlug = props => { const { post, prev, next } = props const meta = { title: `${post.title} | ${BLOG.TITLE}`, @@ -36,13 +44,18 @@ export const LayoutSlug = (props) => { post.toc = getPageTableOfContents(post, post.blockMap) } const { locale } = useGlobal() - const date = formatDate(post?.date?.start_date || post.createdTime, locale.LOCALE) + const date = formatDate( + post?.date?.start_date || post.createdTime, + locale.LOCALE + ) - const zoom = typeof window !== 'undefined' && mediumZoom({ - container: '.notion-viewport', - background: 'rgba(0, 0, 0, 0.2)', - margin: getMediumZoomMargin() - }) + const zoom = + typeof window !== 'undefined' && + mediumZoom({ + container: '.notion-viewport', + background: 'rgba(0, 0, 0, 0.2)', + margin: getMediumZoomMargin() + }) const zoomRef = useRef(zoom ? zoom.clone() : null) useEffect(() => { @@ -51,62 +64,82 @@ export const LayoutSlug = (props) => { const imgList = container?.getElementsByTagName('img') if (imgList && zoomRef.current) { for (let i = 0; i < imgList.length; i++) { - (zoomRef.current).attach(imgList[i]) + zoomRef.current.attach(imgList[i]) } } }) - const slotRight = post?.toc && post?.toc?.length > 3 &&