Skip to content
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

Update blog-starter to App Router #61170

Merged
merged 4 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion examples/blog-starter/@types/remark-html.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion examples/blog-starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This is the existing [blog-starter](https://github.com/vercel/next.js/tree/canary/examples/blog-starter) plus TypeScript.

This example showcases Next.js's [Static Generation](https://nextjs.org/docs/basic-features/pages) feature using Markdown files as the data source.
This example showcases Next.js's [Static Generation](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts) feature using Markdown files as the data source.

The blog posts are stored in `/_posts` as Markdown files with front matter support. Adding a new Markdown file in there will create a new blog post.

Expand Down
23 changes: 0 additions & 23 deletions examples/blog-starter/components/layout.tsx

This file was deleted.

44 changes: 0 additions & 44 deletions examples/blog-starter/components/meta.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions examples/blog-starter/components/section-separator.tsx

This file was deleted.

6 changes: 0 additions & 6 deletions examples/blog-starter/interfaces/author.ts

This file was deleted.

31 changes: 15 additions & 16 deletions examples/blog-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"typecheck": "tsc"
"start": "next start"
},
"dependencies": {
"classnames": "^2.3.1",
"date-fns": "^2.28.0",
"classnames": "^2.5.1",
"date-fns": "^3.3.1",
"gray-matter": "^4.0.3",
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"remark": "^14.0.2",
"remark-html": "^15.0.1",
"typescript": "^4.7.4"
"next": "14.1.0",
"react": "^18",
"react-dom": "^18",
"remark": "^15.0.1",
"remark-html": "^16.0.1"
},
"devDependencies": {
"@types/node": "^18.0.3",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"autoprefixer": "^10.4.7",
"postcss": "^8.4.14",
"tailwindcss": "^3.1.4"
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10.0.1",
"postcss": "^8",
"tailwindcss": "^3.3.0",
"typescript": "^5"
}
}
6 changes: 0 additions & 6 deletions examples/blog-starter/pages/_app.tsx

This file was deleted.

13 changes: 0 additions & 13 deletions examples/blog-starter/pages/_document.tsx

This file was deleted.

56 changes: 0 additions & 56 deletions examples/blog-starter/pages/index.tsx

This file was deleted.

96 changes: 0 additions & 96 deletions examples/blog-starter/pages/posts/[slug].tsx

This file was deleted.

2 changes: 0 additions & 2 deletions examples/blog-starter/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// If you want to use other PostCSS plugins, see the following:
// https://tailwindcss.com/docs/using-with-preprocessors
module.exports = {
plugins: {
tailwindcss: {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Container from "./container";
import Container from "@/app/_components/container";
import { EXAMPLE_PATH } from "@/lib/constants";
import cn from "classnames";
import { EXAMPLE_PATH } from "../lib/constants";

type Props = {
preview?: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Container from "./container";
import { EXAMPLE_PATH } from "../lib/constants";
import Container from "@/app/_components/container";
import { EXAMPLE_PATH } from "@/lib/constants";

const Footer = () => {
export function Footer() {
return (
<footer className="bg-neutral-50 border-t border-neutral-200">
<Container>
Expand All @@ -11,7 +11,7 @@ const Footer = () => {
</h3>
<div className="flex flex-col lg:flex-row justify-center items-center lg:pl-4 lg:w-1/2">
<a
href="https://nextjs.org/docs/basic-features/pages"
href="https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts"
className="mx-3 bg-black hover:bg-white hover:text-black border border-black text-white font-bold py-3 px-12 lg:px-8 duration-200 transition-colors mb-6 lg:mb-0"
>
Read Documentation
Expand All @@ -27,6 +27,6 @@ const Footer = () => {
</Container>
</footer>
);
};
}

export default Footer;
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Avatar from "./avatar";
import DateFormatter from "./date-formatter";
import CoverImage from "./cover-image";
import Avatar from "@/app/_components/avatar";
import CoverImage from "@/app/_components/cover-image";
import { type Author } from "@/interfaces/author";
import Link from "next/link";
import type Author from "../interfaces/author";
import DateFormatter from "./date-formatter";

type Props = {
title: string;
Expand All @@ -13,14 +13,14 @@ type Props = {
slug: string;
};

const HeroPost = ({
export function HeroPost({
title,
coverImage,
date,
excerpt,
author,
slug,
}: Props) => {
}: Props) {
return (
<section>
<div className="mb-8 md:mb-16">
Expand Down Expand Up @@ -48,6 +48,4 @@ const HeroPost = ({
</div>
</section>
);
};

export default HeroPost;
}
Loading
Loading