Skip to content

Commit 641145f

Browse files
committed
Merge changes from onnimonni#5
2 parents dffcdef + df76f4f commit 641145f

File tree

9 files changed

+411
-56
lines changed

9 files changed

+411
-56
lines changed

components/Footer.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,20 @@ export function FooterImpl() {
3939

4040
<div className={cs(styles.settings,styles.toggleDarkModeContainer)}>
4141
{hasMounted && (
42-
<a
43-
className={styles.toggleDarkMode}
44-
href='#'
45-
role='button'
46-
onClick={onToggleDarkMode}
47-
title='Toggle dark mode'
48-
>
49-
{isDarkMode ? <IoMoonSharp /> : <IoSunnyOutline />}
50-
</a>
42+
<button
43+
type="button"
44+
className={styles.toggleDarkMode}
45+
onClick={onToggleDarkMode}
46+
title='Toggle dark mode'
47+
>
48+
{isDarkMode ? <IoMoonSharp /> : <IoSunnyOutline />}
49+
</button>
5150
)}
5251
</div>
5352
<div className={styles.social}>
5453
<PageSocialButtons iconSize={32} />
5554
</div>
5655
</div>
57-
5856
<div className="SiteInfo">
5957
<div className={styles.siteInfoLinks}>
6058
{footerLinks

components/NotionPageHeader.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ function ToggleThemeButton() {
2323
}, [toggleDarkMode])
2424

2525
return (
26-
<div
26+
<button
27+
type="button"
2728
className={cs('breadcrumb', 'button', !hasMounted && styles.hidden)}
2829
onClick={onToggleTheme}
2930
>
3031
{hasMounted && isDarkMode ? <IoMoonSharp /> : <IoSunnyOutline />}
31-
</div>
32+
</button>
3233
)
3334
}
3435

@@ -60,23 +61,22 @@ export function NotionPageHeader({
6061
return (
6162
<components.PageLink
6263
href={mapPageUrl(link.pageId)}
63-
key={index}
64+
key={`nav-${link.pageId}-${link.title}`}
6465
className={cs(styles.navLink, 'breadcrumb', 'button')}
6566
>
6667
{link.title}
6768
</components.PageLink>
6869
)
69-
} else {
70-
return (
71-
<components.Link
72-
href={link.url}
73-
key={index}
74-
className={cs(styles.navLink, 'breadcrumb', 'button')}
75-
>
76-
{link.title}
77-
</components.Link>
78-
)
7970
}
71+
return (
72+
<components.Link
73+
href={link.url}
74+
key={`nav-${link.url}-${link.title}`}
75+
className={cs(styles.navLink, 'breadcrumb', 'button')}
76+
>
77+
{link.title}
78+
</components.Link>
79+
)
8080
})
8181
.filter(Boolean)}
8282

components/PageSocial.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import styles from './PageSocial.module.css'
77
import { FaGithub, FaInstagram, FaLinkedin, FaMastodon, FaReddit, FaTwitter, FaYoutube } from 'react-icons/fa'
88
import { FaXTwitter, FaGitlab, FaEnvelopeOpenText } from 'react-icons/fa6'
99
import { IoIosBug } from 'react-icons/io'
10+
import { getLinkedInURLFromInput } from '@/lib/social-helpers'
1011

1112
interface SocialLink {
1213
name: string
@@ -65,7 +66,7 @@ export const socialLinks: SocialLink[] = [
6566

6667
config.linkedin && {
6768
name: 'linkedin',
68-
href: `https://www.linkedin.com/in/${config.linkedin}`,
69+
href: getLinkedInURLFromInput(config.linkedin),
6970
title: `LinkedIn ${config.author}`,
7071
color: "#ffffff",
7172
background: "#0077b5",

components/styles.module.css

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
user-select: none;
8282
}
8383

84-
.settings a,
84+
.settings button,
8585
.social a {
8686
cursor: pointer;
8787
font-size: 2em;
@@ -91,18 +91,20 @@
9191
transition: color 250ms ease-out;
9292
}
9393

94-
.settings a:last-of-type,
94+
.settings button:last-of-type,
9595
.social a:last-of-type {
9696
margin-right: 0;
9797
}
9898

99-
.settings a:hover,
99+
.settings button:hover,
100100
.social a:hover {
101101
transition: color 50ms ease-out;
102102
}
103103

104-
.toggleDarkMode:hover {
105-
color: #2795e9;
104+
.settings button {
105+
/* Reset default button styles */
106+
background: none;
107+
border: none;
106108
}
107109

108110
.comments {

lib/preview-images.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import ky from 'ky'
22
import lqip from 'lqip-modern'
3-
import {
4-
type ExtendedRecordMap,
5-
type PreviewImage,
6-
type PreviewImageMap
3+
import type {
4+
ExtendedRecordMap,
5+
PreviewImage,
6+
PreviewImageMap
77
} from 'notion-types'
88
import { getPageImageUrls, normalizeUrl } from 'notion-utils'
99
import pMap from 'p-map'

lib/social-helpers.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export function getLinkedInURLFromInput(userOrCompany: string): string {
2+
if (userOrCompany.startsWith('company/')) {
3+
return `https://www.linkedin.com/${userOrCompany}`
4+
}
5+
6+
return `https://www.linkedin.com/in/${userOrCompany}`
7+
}

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
"analyze:browser": "cross-env BUNDLE_ANALYZE=browser next build",
2828
"test": "run-p test:*",
2929
"test:lint": "eslint .",
30-
"test:prettier": "prettier '**/*.{js,jsx,ts,tsx}' --check"
30+
"test:prettier": "prettier '**/*.{js,jsx,ts,tsx}' --check",
31+
"prepare": "husky install",
32+
"pre-commit": "lint-staged"
3133
},
3234
"dependencies": {
3335
"@fisch0920/use-dark-mode": "^2.4.0",
@@ -66,7 +68,15 @@
6668
"eslint": "^8.57.1",
6769
"npm-run-all2": "^7.0.1",
6870
"prettier": "^3.3.3",
69-
"typescript": "^5.6.3"
71+
"typescript": "^5.6.3",
72+
"husky": "^8.0.1",
73+
"lint-staged": "^12.3.6"
74+
},
75+
"lint-staged": {
76+
"*.{ts,tsx}": [
77+
"prettier --write",
78+
"eslint --fix"
79+
]
7080
},
7181
"overrides": {
7282
"cacheable-request": {

0 commit comments

Comments
 (0)