Skip to content

Merge open PRs from the upstream #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6ac3d3b
@react-icons/all-files hasn't been updated in long time. Replace it w…
onnimonni Nov 1, 2024
bd6ae7f
Run prettier --write to fix the formatting of icons
onnimonni Nov 1, 2024
afd5e91
Use husky to ensure eslint & prettier rules on git commits
onnimonni Nov 1, 2024
be6655d
Refactor social icons to reduce repetition. Thanks @gauravmm and the …
onnimonni Nov 1, 2024
ab8d684
Fix Biome useImportType, useButtonType, noUselessElse and noArrayInde…
onnimonni Nov 1, 2024
83b9d6d
Fix toggleDarkMode button color in dark mode
onnimonni Nov 1, 2024
f993997
Get rid of dangerouslySetInnerHTML in Social image styles with the ex…
onnimonni Nov 1, 2024
3423f03
Define the logos and colors only in one place, remove color duplicati…
onnimonni Nov 1, 2024
948004f
Remove all new social media links to make this pr smaller
onnimonni Nov 1, 2024
6dd515c
Add mastodon which was missing from the original social accounts
onnimonni Nov 1, 2024
631ae7b
Revert "Remove all new social media links to make this pr smaller"
onnimonni Nov 1, 2024
08ff1e2
Add gitlab, instagram, reddit and bugtracker links
onnimonni Nov 1, 2024
3c34de3
Remove unused prefix param from PageSocial and don't interpolate Mast…
onnimonni Nov 1, 2024
2dedfa5
Merge branch 'refactor-social-icons' into add-more-social-links
onnimonni Nov 1, 2024
dcfd122
Enable custom social link background setting and use it for Instagram…
onnimonni Nov 1, 2024
5c85b61
Enable LinkedIn links to company pages too
onnimonni Nov 1, 2024
aa75868
WIP: Continue to refactor Social links and add more fun background
onnimonni Nov 1, 2024
003db38
Use custom footer with links, custom font and static logo in the header
onnimonni Nov 4, 2024
8216b20
Merge social icon refactoring from https://github.com/transitive-bull…
onnimonni Nov 4, 2024
34ee791
Merge branch 'support-linkedin-company-page-link' into merge-social-i…
onnimonni Nov 4, 2024
6400e9a
Merge https://github.com/transitive-bullshit/nextjs-notion-starter-ki…
onnimonni Nov 4, 2024
df76f4f
Merge branch 'add-husky-to-fix-formatting-on-commits' into merge-soci…
onnimonni Nov 4, 2024
7235af1
Fix linter issues
onnimonni Nov 4, 2024
cf89903
Fix Navigation toggle dark mode button in custom navigation
onnimonni Nov 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 54 additions & 105 deletions components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import { FaEnvelopeOpenText } from '@react-icons/all-files/fa/FaEnvelopeOpenText'
import { FaGithub } from '@react-icons/all-files/fa/FaGithub'
import { FaLinkedin } from '@react-icons/all-files/fa/FaLinkedin'
import { FaMastodon } from '@react-icons/all-files/fa/FaMastodon'
import { FaTwitter } from '@react-icons/all-files/fa/FaTwitter'
import { FaYoutube } from '@react-icons/all-files/fa/FaYoutube'
import { FaZhihu } from '@react-icons/all-files/fa/FaZhihu'
import { IoMoonSharp } from '@react-icons/all-files/io5/IoMoonSharp'
import { IoSunnyOutline } from '@react-icons/all-files/io5/IoSunnyOutline'
import cs from 'classnames'
import * as React from 'react'
import { IoMoonSharp, IoSunnyOutline } from 'react-icons/io5'
import { useNotionContext } from 'react-notion-x'

import * as config from '@/lib/config'
import { footerLinks } from '@/lib/config'
import { useDarkMode } from '@/lib/use-dark-mode'

import { PageSocialButtons } from './PageSocial'
import { StaticLogo } from './StaticLogo'
import styles from './styles.module.css'

// TODO: merge the data and icons from PageSocial with the social links in Footer
Expand All @@ -33,110 +29,63 @@ export function FooterImpl() {
setHasMounted(true)
}, [])

const { components, mapPageUrl } = useNotionContext()

return (
<footer className={styles.footer}>
<div className={styles.copyright}>
Copyright {currentYear} {config.author}
</div>
<div className={styles.footerSocial}>
<StaticLogo />

<div className={styles.settings}>
{hasMounted && (
<a
<div className={cs(styles.settings,styles.toggleDarkModeContainer)}>
{hasMounted && (
<button
type="button"
className={styles.toggleDarkMode}
href='#'
role='button'
onClick={onToggleDarkMode}
title='Toggle dark mode'
>
{isDarkMode ? <IoMoonSharp /> : <IoSunnyOutline />}
</a>
)}
</div>

<div className={styles.social}>
{config.twitter && (
<a
className={styles.twitter}
href={`https://twitter.com/${config.twitter}`}
title={`Twitter @${config.twitter}`}
target='_blank'
rel='noopener noreferrer'
>
<FaTwitter />
</a>
)}

{config.mastodon && (
<a
className={styles.mastodon}
href={config.mastodon}
title={`Mastodon ${config.getMastodonHandle()}`}
rel='me'
>
<FaMastodon />
</a>
)}

{config.zhihu && (
<a
className={styles.zhihu}
href={`https://zhihu.com/people/${config.zhihu}`}
title={`Zhihu @${config.zhihu}`}
target='_blank'
rel='noopener noreferrer'
>
<FaZhihu />
</a>
)}

{config.github && (
<a
className={styles.github}
href={`https://github.com/${config.github}`}
title={`GitHub @${config.github}`}
target='_blank'
rel='noopener noreferrer'
>
<FaGithub />
</a>
)}

{config.linkedin && (
<a
className={styles.linkedin}
href={`https://www.linkedin.com/in/${config.linkedin}`}
title={`LinkedIn ${config.author}`}
target='_blank'
rel='noopener noreferrer'
>
<FaLinkedin />
</a>
)}

{config.newsletter && (
<a
className={styles.newsletter}
href={`${config.newsletter}`}
title={`Newsletter ${config.author}`}
target='_blank'
rel='noopener noreferrer'
>
<FaEnvelopeOpenText />
</a>
)}

{config.youtube && (
<a
className={styles.youtube}
href={`https://www.youtube.com/${config.youtube}`}
title={`YouTube ${config.author}`}
target='_blank'
rel='noopener noreferrer'
>
<FaYoutube />
</a>
)}
</button>
)}
</div>
<div className={styles.social}>
<PageSocialButtons iconSize={32} />
</div>
</div>
<div className="SiteInfo">
<div className={styles.siteInfoLinks}>
{footerLinks
?.map((link, index) => {
if (!link.pageId && !link.url) {
return null
}

if (link.pageId) {
return (
<components.PageLink
href={mapPageUrl(link.pageId)}
key={index}
className={cs(styles.navLink, 'breadcrumb', 'button')}
>
{link.title}
</components.PageLink>
)
} else {
return (
<components.Link
href={link.url}
key={index}
className={cs(styles.navLink, 'breadcrumb', 'button')}
>
{link.title}
</components.Link>
)
}
})
.filter(Boolean)}
</div>
<div className={styles.copyright}>© Copyright {currentYear}. All rights reserved.</div>
</div>
</footer>
)
}
Expand Down
41 changes: 21 additions & 20 deletions components/NotionPageHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type * as types from 'notion-types'
import { IoMoonSharp } from '@react-icons/all-files/io5/IoMoonSharp'
import { IoSunnyOutline } from '@react-icons/all-files/io5/IoSunnyOutline'
import cs from 'classnames'
import * as React from 'react'
import { Breadcrumbs, Header, Search, useNotionContext } from 'react-notion-x'
import { IoMoonSharp, IoSunnyOutline } from 'react-icons/io5'
import { Header, Search, useNotionContext } from 'react-notion-x'

import { isSearchEnabled, navigationLinks, navigationStyle } from '@/lib/config'
import { useDarkMode } from '@/lib/use-dark-mode'

import { StaticLogo } from './StaticLogo'
import styles from './styles.module.css'

function ToggleThemeButton() {
Expand All @@ -23,12 +23,13 @@ function ToggleThemeButton() {
}, [toggleDarkMode])

return (
<div
className={cs('breadcrumb', 'button', !hasMounted && styles.hidden)}
<button
type="button"
className={cs('breadcrumb', 'button', styles.toggleDarkMode, !hasMounted && styles.hidden)}
onClick={onToggleTheme}
>
{hasMounted && isDarkMode ? <IoMoonSharp /> : <IoSunnyOutline />}
</div>
</button>
)
}

Expand All @@ -46,11 +47,12 @@ export function NotionPageHeader({
return (
<header className='notion-header'>
<div className='notion-nav-header'>
<Breadcrumbs block={block} rootOnly={true} />

<div className="notion-nav-header-rhs breadcrumbs">
<StaticLogo />
</div>
<div className='notion-nav-header-rhs breadcrumbs'>
{navigationLinks
?.map((link, index) => {
?.map((link) => {
if (!link.pageId && !link.url) {
return null
}
Expand All @@ -59,23 +61,22 @@ export function NotionPageHeader({
return (
<components.PageLink
href={mapPageUrl(link.pageId)}
key={index}
key={`nav-${link.pageId}-${link.title}`}
className={cs(styles.navLink, 'breadcrumb', 'button')}
>
{link.title}
</components.PageLink>
)
} else {
return (
<components.Link
href={link.url}
key={index}
className={cs(styles.navLink, 'breadcrumb', 'button')}
>
{link.title}
</components.Link>
)
}
return (
<components.Link
href={link.url}
key={`nav-${link.url}-${link.title}`}
className={cs(styles.navLink, 'breadcrumb', 'button')}
>
{link.title}
</components.Link>
)
})
.filter(Boolean)}

Expand Down
4 changes: 2 additions & 2 deletions components/PageActions.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AiOutlineRetweet } from '@react-icons/all-files/ai/AiOutlineRetweet'
import { IoHeartOutline } from '@react-icons/all-files/io5/IoHeartOutline'
import { AiOutlineRetweet } from 'react-icons/ai'
import { IoHeartOutline } from 'react-icons/io5'

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

Expand Down
Loading
Loading