Skip to content

Commit 450bd92

Browse files
committed
Changes
1 parent 7f525f0 commit 450bd92

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+303
-279
lines changed

.gitpod.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ tasks:
1919
gpg --verbose --batch --import <(echo $GNUPG_KEY|base64 -d) &&
2020
echo 'pinentry-mode loopback' >> ~/.gnupg/gpg.conf &&
2121
git config commit.gpgsign true
22+
ports:
23+
- port: 3000
24+
onOpen: notify
2225
vscode:
2326
extensions:
2427
- mutantdino.resourcemonitor

.prettierrc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,14 @@
77
"bracketSpacing": true,
88
"bracketSameLine": false,
99
"arrowParens": "always",
10-
"trailingComma": "none"
10+
"trailingComma": "none",
11+
"importOrder": [
12+
"^(react/(.*)$)|^(react$)|^(next/(.*)$)|^(next$)",
13+
"<THIRD_PARTY_MODULES>",
14+
"^(@/lib/(.*)$)|^(@/components/(.*)$)|^(@/styles/(.*)$)",
15+
"^[./]"
16+
],
17+
"importOrderSeparation": true,
18+
"importOrderSortSpecifiers": true,
19+
"importOrderGroupNamespaceSpecifiers": true
1120
}

components/ErrorPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react'
2-
import { PageHead } from './PageHead'
32

3+
import { PageHead } from './PageHead'
44
import styles from './styles.module.css'
55

66
export const ErrorPage: React.FC<{ statusCode: number }> = ({ statusCode }) => {

components/Footer.tsx

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import * as React from 'react'
2-
import { FaTwitter } from '@react-icons/all-files/fa/FaTwitter'
3-
import { FaZhihu } from '@react-icons/all-files/fa/FaZhihu'
2+
3+
import { FaEnvelopeOpenText } from '@react-icons/all-files/fa/FaEnvelopeOpenText'
44
import { FaGithub } from '@react-icons/all-files/fa/FaGithub'
55
import { FaLinkedin } from '@react-icons/all-files/fa/FaLinkedin'
6-
import { IoSunnyOutline } from '@react-icons/all-files/io5/IoSunnyOutline'
6+
import { FaTwitter } from '@react-icons/all-files/fa/FaTwitter'
7+
import { FaYoutube } from '@react-icons/all-files/fa/FaYoutube'
8+
import { FaZhihu } from '@react-icons/all-files/fa/FaZhihu'
79
import { IoMoonSharp } from '@react-icons/all-files/io5/IoMoonSharp'
10+
import { IoSunnyOutline } from '@react-icons/all-files/io5/IoSunnyOutline'
811

9-
import { useDarkMode } from 'lib/use-dark-mode'
10-
import * as config from 'lib/config'
12+
import * as config from '@/lib/config'
13+
import { useDarkMode } from '@/lib/use-dark-mode'
1114

1215
import styles from './styles.module.css'
1316

@@ -29,14 +32,9 @@ export const FooterImpl: React.FC = () => {
2932
setHasMounted(true)
3033
}, [])
3134

32-
// Current year: 2022
33-
const year = `${new Date().getFullYear()}`
34-
3535
return (
3636
<footer className={styles.footer}>
37-
<div className={styles.copyright}>
38-
Copyright {year} {config.author}
39-
</div>
37+
<div className={styles.copyright}>Copyright 2022 {config.author}</div>
4038

4139
<div className={styles.settings}>
4240
{hasMounted && (
@@ -100,6 +98,30 @@ export const FooterImpl: React.FC = () => {
10098
<FaLinkedin />
10199
</a>
102100
)}
101+
102+
{config.newsletter && (
103+
<a
104+
className={styles.newsletter}
105+
href={`${config.newsletter}`}
106+
title={`Newsletter ${config.author}`}
107+
target='_blank'
108+
rel='noopener noreferrer'
109+
>
110+
<FaEnvelopeOpenText />
111+
</a>
112+
)}
113+
114+
{config.youtube && (
115+
<a
116+
className={styles.youtube}
117+
href={`https://www.youtube.com/${config.youtube}`}
118+
title={`YouTube ${config.author}`}
119+
target='_blank'
120+
rel='noopener noreferrer'
121+
>
122+
<FaYoutube />
123+
</a>
124+
)}
103125
</div>
104126
</footer>
105127
)

components/GitHubShareButton.tsx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import * as React from 'react'
2+
3+
import styles from './styles.module.css'
4+
5+
export const GitHubShareButton: React.FC = () => {
6+
return (
7+
<a
8+
href='https://github.com/transitive-bullshit/nextjs-notion-starter-kit'
9+
target='_blank'
10+
rel='noopener noreferrer'
11+
className={styles.githubCorner}
12+
aria-label='View source on GitHub'
13+
>
14+
<svg
15+
width='80'
16+
height='80'
17+
viewBox='0 0 250 250'
18+
style={{
19+
fill: '#70B7FD',
20+
color: '#fff',
21+
position: 'absolute',
22+
zIndex: 1001,
23+
top: 0,
24+
right: 0,
25+
border: 0,
26+
transform: 'scale(1, 1)'
27+
}}
28+
aria-hidden='true'
29+
>
30+
<path d='M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z' />
31+
<path
32+
d='M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2'
33+
fill='currentColor'
34+
style={{
35+
transformOrigin: '130px 106px'
36+
}}
37+
className={styles.octoArm}
38+
/>
39+
40+
<path
41+
d='M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z'
42+
fill='currentColor'
43+
className={styles.octoBody}
44+
/>
45+
</svg>
46+
</a>
47+
)
48+
}

components/Loading.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react'
2-
import { LoadingIcon } from './LoadingIcon'
32

3+
import { LoadingIcon } from './LoadingIcon'
44
import styles from './styles.module.css'
55

66
export const Loading: React.FC = () => (

components/LoadingIcon.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import * as React from 'react'
2+
23
import cs from 'classnames'
4+
35
import styles from './styles.module.css'
46

57
export const LoadingIcon = (props) => {

components/NotionPage.tsx

Lines changed: 21 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,31 @@
11
import * as React from 'react'
2-
import Link from 'next/link'
3-
import Image from 'next/image'
42
import dynamic from 'next/dynamic'
5-
import cs from 'classnames'
3+
import Image from 'next/image'
4+
import Link from 'next/link'
65
import { useRouter } from 'next/router'
7-
import { useSearchParam } from 'react-use'
8-
import BodyClassName from 'react-body-classname'
9-
import { PageBlock } from 'notion-types'
10-
11-
import TweetEmbed from 'react-tweet-embed'
126

13-
// core notion renderer
7+
import cs from 'classnames'
8+
import { PageBlock } from 'notion-types'
9+
import { formatDate, getBlockTitle, getPageProperty } from 'notion-utils'
10+
import BodyClassName from 'react-body-classname'
1411
import { NotionRenderer } from 'react-notion-x'
12+
import TweetEmbed from 'react-tweet-embed'
13+
import { useSearchParam } from 'react-use'
1514

16-
// utils
17-
import { getBlockTitle, getPageProperty, formatDate } from 'notion-utils'
18-
import { mapPageUrl, getCanonicalPageUrl } from 'lib/map-page-url'
19-
import { mapImageUrl } from 'lib/map-image-url'
20-
import { searchNotion } from 'lib/search-notion'
21-
import { useDarkMode } from 'lib/use-dark-mode'
22-
import * as types from 'lib/types'
23-
import * as config from 'lib/config'
15+
import * as config from '@/lib/config'
16+
import * as types from '@/lib/types'
17+
import { mapImageUrl } from '@/lib/map-image-url'
18+
import { getCanonicalPageUrl, mapPageUrl } from '@/lib/map-page-url'
19+
import { searchNotion } from '@/lib/search-notion'
20+
import { useDarkMode } from '@/lib/use-dark-mode'
2421

25-
// components
22+
import { Footer } from './Footer'
23+
// import { GitHubShareButton } from './GitHubShareButton'
2624
import { Loading } from './Loading'
25+
import { NotionPageHeader } from './NotionPageHeader'
2726
import { Page404 } from './Page404'
28-
import { PageHead } from './PageHead'
2927
import { PageAside } from './PageAside'
30-
import { Footer } from './Footer'
31-
import { NotionPageHeader } from './NotionPageHeader'
32-
import { ReactUtterances } from './ReactUtterances'
33-
28+
import { PageHead } from './PageHead'
3429
import styles from './styles.module.css'
3530

3631
// -----------------------------------------------------------------------------
@@ -127,7 +122,7 @@ const propertyDateValue = (
127122
const publishDate = data?.[0]?.[1]?.[0]?.[1]?.start_date
128123

129124
if (publishDate) {
130-
return `Published ${formatDate(publishDate, {
125+
return `${formatDate(publishDate, {
131126
month: 'long'
132127
})}`
133128
}
@@ -236,20 +231,6 @@ export const NotionPage: React.FC<types.PageProps> = ({
236231
const canonicalPageUrl =
237232
!config.isDev && getCanonicalPageUrl(site, recordMap)(pageId)
238233

239-
let comments: React.ReactNode = null
240-
241-
if (block.type === 'page' && block.parent_table === 'collection') {
242-
comments = (
243-
<ReactUtterances
244-
repo='ankurpaulcoder/nooobcoder-blog'
245-
issueMap='issue-term'
246-
issueTerm='title'
247-
label='blog-comment'
248-
theme='github-light'
249-
/>
250-
)
251-
}
252-
253234
const socialImage = mapImageUrl(
254235
getPageProperty<string>('Social Image', block, recordMap) ||
255236
(block as PageBlock).format?.page_cover ||
@@ -296,10 +277,11 @@ export const NotionPage: React.FC<types.PageProps> = ({
296277
mapPageUrl={siteMapPageUrl}
297278
mapImageUrl={mapImageUrl}
298279
searchNotion={config.isSearchEnabled ? searchNotion : null}
299-
pageFooter={comments}
300280
pageAside={pageAside}
301281
footer={footer}
302282
/>
283+
284+
{/* <GitHubShareButton /> */}
303285
</>
304286
)
305287
}

components/NotionPageHeader.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import * as React from 'react'
2-
import cs from 'classnames'
3-
import { IoSunnyOutline } from '@react-icons/all-files/io5/IoSunnyOutline'
4-
import { IoMoonSharp } from '@react-icons/all-files/io5/IoMoonSharp'
5-
import { Header, Breadcrumbs, Search, useNotionContext } from 'react-notion-x'
2+
63
import * as types from 'notion-types'
4+
import { IoMoonSharp } from '@react-icons/all-files/io5/IoMoonSharp'
5+
import { IoSunnyOutline } from '@react-icons/all-files/io5/IoSunnyOutline'
6+
import cs from 'classnames'
7+
import { Breadcrumbs, Header, Search, useNotionContext } from 'react-notion-x'
78

8-
import { useDarkMode } from 'lib/use-dark-mode'
9-
import { navigationStyle, navigationLinks, isSearchEnabled } from 'lib/config'
9+
import { isSearchEnabled, navigationLinks, navigationStyle } from '@/lib/config'
10+
import { useDarkMode } from '@/lib/use-dark-mode'
1011

1112
import styles from './styles.module.css'
1213

components/Page404.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import * as React from 'react'
2-
import * as types from 'lib/types'
3-
import { PageHead } from './PageHead'
42

3+
import * as types from '@/lib/types'
4+
5+
import { PageHead } from './PageHead'
56
import styles from './styles.module.css'
67

78
export const Page404: React.FC<types.PageProps> = ({ site, pageId, error }) => {

0 commit comments

Comments
 (0)