Skip to content

Commit 94ec05a

Browse files
authored
Merge pull request #39 from ymrl/update_packages
🆙 update packages
2 parents 714b237 + f08e870 commit 94ec05a

File tree

9 files changed

+2306
-1922
lines changed

9 files changed

+2306
-1922
lines changed

.github/workflows/deploy.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ jobs:
2525
env:
2626
URL_PREFIX: a11y-training
2727

28-
- name: Export Next.js app
29-
run: npm run export
30-
3128
- name: Deploy to GitHub Pages
3229
uses: peaceiris/actions-gh-pages@v3
3330
with:

next.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const withMDX = require('@next/mdx')({
1515
const urlPrefix = process.env.URL_PREFIX ? `/${process.env.URL_PREFIX}` : '';
1616

1717
module.exports = withMDX({
18+
output: 'export',
1819
pageExtensions: ['tsx', 'mdx'],
1920
reactStrictMode: true,
2021
assetPrefix: urlPrefix || '/',

package-lock.json

Lines changed: 2254 additions & 1866 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,20 @@
1111
"format": "prettier src --write"
1212
},
1313
"dependencies": {
14-
"@mdx-js/loader": "^2.2.1",
15-
"@mdx-js/react": "^2.2.1",
16-
"@next/mdx": "^11.1.2",
17-
"@types/styled-components": "^5.1.26",
14+
"@mdx-js/loader": "^3.0.1",
15+
"@mdx-js/react": "^3.0.1",
16+
"@next/mdx": "^14.2.3",
1817
"babel-plugin-styled-components": "^2.0.7",
19-
"next": "^12.3.4",
20-
"react": "17.0.2",
21-
"react-dom": "17.0.2",
18+
"next": "^14.2.3",
19+
"react": "^18.3.1",
20+
"react-dom": "^18.3.1",
2221
"react-icons": "^4.3.1",
23-
"styled-components": "^5.3.6"
22+
"styled-components": "^6.1.11"
2423
},
2524
"devDependencies": {
26-
"@types/mdx-js__react": "^1.5.4",
27-
"@types/node": "18.11.18",
28-
"@types/react": "17.0.27",
25+
"@types/node": "^20.14.2",
26+
"@types/react": "^18.3.3",
27+
"@types/styled-components": "^5.1.34",
2928
"@typescript-eslint/eslint-plugin": "^4.33.0",
3029
"eslint": "7.32.0",
3130
"eslint-config-freee-typescript": "0.3.0",

src/components/Layout.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const HeaderTitle = styled.h1`
2525
font-size: 1.2rem;
2626
}
2727
`;
28-
const HeaderTitleLink = styled.a`
28+
const HeaderTitleLink = styled(Link)`
2929
color: #fff;
3030
text-decoration: none;
3131
&:hover {
@@ -73,11 +73,9 @@ export const LayoutFunc: React.ForwardRefRenderFunction<
7373
</Head>
7474
<Header>
7575
<HeaderTitle>
76-
<Link href="/" passHref>
77-
<HeaderTitleLink href="/">
78-
freee Accessibility Training
79-
</HeaderTitleLink>
80-
</Link>
76+
<HeaderTitleLink href="/">
77+
freee Accessibility Training
78+
</HeaderTitleLink>
8179
</HeaderTitle>
8280
</Header>
8381
<Settings />

src/components/NavigationContent.tsx

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ const NavList = styled.ul`
1414
padding: 0 1rem;
1515
`;
1616

17-
const NavLink = styled.a.attrs(({ current }: { current: boolean }) => ({
18-
current,
19-
}))`
17+
const NavLink = styled(Link)<{ $current: boolean }>`
2018
display: block;
2119
padding: 0.25rem 0.5rem;
2220
color: #285ac8;
@@ -33,7 +31,7 @@ const NavLink = styled.a.attrs(({ current }: { current: boolean }) => ({
3331
border-top: 0.25rem solid transparent;
3432
border-bottom: 0.25rem solid transparent;
3533
border-left: 0.5rem solid
36-
${({ current }) => (current ? '#aac8ff' : 'transparent')};
34+
${({ $current }) => ($current ? '#aac8ff' : 'transparent')};
3735
transition: border-color 0.2s;
3836
}
3937
@@ -98,30 +96,26 @@ export const NavigationContent = ({
9896
const current = isCurrent(pathname, n.pathname);
9997
return (
10098
<li key={n.pathname}>
101-
<Link href={n.pathname} passHref>
102-
<NavLink
103-
href={n.pathname}
104-
aria-current={current ? 'page' : undefined}
105-
current={current}
106-
>
107-
{n.title}
108-
</NavLink>
109-
</Link>
99+
<NavLink
100+
href={n.pathname}
101+
aria-current={current ? 'page' : undefined}
102+
$current={current}
103+
>
104+
{n.title}
105+
</NavLink>
110106
{n.children && (
111107
<NavList>
112108
{n.children.map((c) => {
113109
const current = isCurrent(pathname, c.pathname);
114110
return (
115111
<li key={c.pathname}>
116-
<Link href={c.pathname} passHref>
117-
<NavLink
118-
href={c.pathname}
119-
aria-current={current ? 'page' : undefined}
120-
current={current}
121-
>
122-
{c.title}
123-
</NavLink>
124-
</Link>
112+
<NavLink
113+
href={c.pathname}
114+
aria-current={current ? 'page' : undefined}
115+
$current={current}
116+
>
117+
{c.title}
118+
</NavLink>
125119
</li>
126120
);
127121
})}

src/components/Title.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Head from 'next/head';
44
export const Title = ({ children }: { children?: string }): JSX.Element => (
55
<Head>
66
<title>
7-
{children ? `${children} | ` : ''}freee Accessibility Training
7+
{`${children ? `${children} | ` : ''}freee Accessibility Training`}
88
</title>
99
</Head>
1010
);

src/components/contents/ContentsContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const components: React.ComponentProps<typeof MDXProvider>['components'] = {
88
// eslint-disable-next-line @typescript-eslint/no-unused-vars
99
a: ({ href, ref, ...props }) => (
1010
<Link passHref={true} href={href || ''}>
11-
<TextLink {...props} />
11+
<TextLink as="span" {...props} />
1212
</Link>
1313
),
1414
p: P,

src/components/parts/IconButton.tsx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import styled from 'styled-components';
33
import { IconType } from 'react-icons/lib';
44

55
const IconButtonStyle = styled.button<{
6-
pressed?: boolean;
6+
$pressed?: boolean;
77
focusIndicator?: 'browser' | 'specified' | 'none';
88
}>`
99
display: inline-flex;
@@ -23,20 +23,20 @@ const IconButtonStyle = styled.button<{
2323
cursor: pointer;
2424
padding: 0.5rem 1rem;
2525
26-
${({ pressed }) => ({
27-
borderColor: pressed ? '#2864f0' : '#d7d2d2',
28-
background: pressed ? '#2864f0' : '#fff',
29-
color: pressed ? '#fff' : '#323232',
26+
${({ $pressed }) => ({
27+
borderColor: $pressed ? '#2864f0' : '#d7d2d2',
28+
background: $pressed ? '#2864f0' : '#fff',
29+
color: $pressed ? '#fff' : '#323232',
3030
})}
3131
3232
&:hover {
3333
color: #2864f0;
3434
border-color: #2864f0;
3535
background-color: #ebf3ff;
36-
${({ pressed }) => ({
37-
color: pressed ? '#fff' : '#2864f0',
38-
backgroundColor: pressed ? '#285ac8' : '#ebf3ff',
39-
borderColor: pressed ? '#285ac8' : '#2864f0',
36+
${({ $pressed }) => ({
37+
color: $pressed ? '#fff' : '#2864f0',
38+
backgroundColor: $pressed ? '#285ac8' : '#ebf3ff',
39+
borderColor: $pressed ? '#285ac8' : '#2864f0',
4040
})}
4141
}
4242
&:focus-visible {
@@ -68,19 +68,26 @@ export const IconButton = ({
6868
IconComponent,
6969
text,
7070
iconLabel,
71+
as,
72+
pressed,
7173
...props
7274
}: {
7375
IconComponent: IconType;
7476
text?: string;
7577
iconLabel?: string;
76-
} & React.ComponentProps<typeof IconButtonStyle>): JSX.Element => (
77-
<IconButtonStyle {...props}>
78+
as?: React.ElementType;
79+
pressed?: boolean;
80+
} & Omit<
81+
React.ComponentProps<typeof IconButtonStyle>,
82+
'as' | '$pressed'
83+
>): JSX.Element => (
84+
<IconButtonStyle as={as} $pressed={pressed} {...props}>
7885
<span className="icon">
7986
<IconComponent
8087
aria-label={iconLabel}
8188
aria-hidden={iconLabel ? undefined : true}
8289
/>
8390
</span>
84-
{text && <span className="text">{text}</span>}
91+
{text ? <span className="text">{text}</span> : undefined}
8592
</IconButtonStyle>
8693
);

0 commit comments

Comments
 (0)