Skip to content

Commit

Permalink
feat: update to next 13 (nandanmen#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
nandanmen authored Mar 14, 2023
1 parent e7c2ee8 commit 4511530
Show file tree
Hide file tree
Showing 11 changed files with 261 additions and 143 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"language": "mdx",
"scheme": "file"
}
]
],
"typescript.enablePromptUseWorkspaceTsdk": true
}
16 changes: 16 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const metadata = {
title: 'Next.js',
description: 'Generated by Next.js',
}

export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}
40 changes: 16 additions & 24 deletions components/Post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,24 @@ export function Post({ post, children, direction = "left" }: PostProps) {
}).format(new Date(post.editedAt))}
</PostUpdatedText>
<PostTitle whileHover="hover">
{isExternal ? (
<TitleAnchor href={post.slug} direction={direction}>
<Balancer ratio={0.8}>{titleCase(post.title)}</Balancer>
</TitleAnchor>
) : (
<Link href={post.slug} passHref>
<TitleAnchor direction={direction}>
<Balancer ratio={0.8}>{titleCase(post.title)}</Balancer>
</TitleAnchor>
</Link>
)}
<TitleAnchor
as={isExternal ? undefined : Link}
href={post.slug}
direction={direction}
>
<Balancer ratio={0.8}>{titleCase(post.title)}</Balancer>
</TitleAnchor>
</PostTitle>
<PostDescription>{post.description}</PostDescription>
{isExternal ? (
<TitleAnchor small href={post.slug} direction={direction}>
Read now
<BsArrowRight width="12" height="12" />
</TitleAnchor>
) : (
<Link href={post.slug} passHref>
<TitleAnchor small direction={direction}>
Read now
<BsArrowRight width="12" height="12" />
</TitleAnchor>
</Link>
)}
<TitleAnchor
as={isExternal ? undefined : Link}
small
href={post.slug}
direction={direction}
>
Read now
<BsArrowRight width="12" height="12" />
</TitleAnchor>
</PostContent>
<Figure>{children}</Figure>
</PostWrapper>
Expand Down
17 changes: 8 additions & 9 deletions components/layout/ExperimentsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,17 @@ export function ExperimentsPage({ children, page }) {
<ContentWrapper>
<Row as={NavWrapper} css={{ flexDirection: "column", gap: "$4" }}>
<LinkWrapper>
<Link href="/">
<a>NaN</a>
</Link>
<Link href="/">NaN</Link>
</LinkWrapper>
<ExperimentsList>
{experiments.map((experiment) => (
<li key={experiment}>
<Link href={`/experiments/${experiment}`} passHref>
<ExperimentItem active={page === experiment}>
{`${page === experiment ? ">" : ""} ${experiment}`}
</ExperimentItem>
</Link>
<ExperimentItem
href={`/experiments/${experiment}`}
active={page === experiment}
>
{`${page === experiment ? ">" : ""} ${experiment}`}
</ExperimentItem>
</li>
))}
</ExperimentsList>
Expand All @@ -43,7 +42,7 @@ export function ExperimentsPage({ children, page }) {
);
}

const ExperimentItem = styled("a", {
const ExperimentItem = styled(Link, {
color: "$gray11",
variants: {
active: {
Expand Down
4 changes: 1 addition & 3 deletions components/layout/StoriesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ export default function StoriesPage({
<ul>
{group.stories.map((story) => (
<li key={story.name}>
<Link href={`/_stories/${story.name}`}>
<a>{story.name}</a>
</Link>
<Link href={`/_stories/${story.name}`}>{story.name}</Link>
</li>
))}
</ul>
Expand Down
1 change: 1 addition & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const nextConfig = {
swcMinify: true,
experimental: {
forceSwcTransforms: true,
appDir: true,
},
images: {
domains: ["tdzetyetdwbxwkrrdmvi.supabase.co"],
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"gray-matter": "^4.0.3",
"immer": "^9.0.16",
"mdx-bundler": "^9.0.1",
"next": "12.2.3",
"next": "^13",
"next-mdx-remote": "^4.4.1",
"next-themes": "^0.2.0",
"popmotion": "^11.0.5",
"react": "18.2.0",
Expand Down
4 changes: 1 addition & 3 deletions pages/[content].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ export default function PostPage({ content }: { content: Post }) {
<MobileBottomBar headings={headings} />
<Nav>
<h2>
<NextLink href="/">
<a>NaN</a>
</NextLink>
<NextLink href="/">NaN</NextLink>
</h2>
<ul>
{headings.map((heading) => (
Expand Down
11 changes: 9 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@
"~/experiments/*": [
"./experiments/*"
]
}
},
"plugins": [
{
"name": "next"
}
],
"strictNullChecks": false
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
Expand Down
Loading

0 comments on commit 4511530

Please sign in to comment.