├── @types └── remark-html.d.ts ├── .env.local.sample ├── next-env.d.ts ├── postcss.config.js ├── types ├── author.ts └── post.ts ├── public ├── favicon │ ├── favicon.ico │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── mstile-150x150.png │ ├── apple-touch-icon.png │ ├── android-chrome-192x192.png │ ├── android-chrome-512x512.png │ ├── browserconfig.xml │ ├── site.webmanifest │ └── safari-pinned-tab.svg └── assets │ └── blog │ ├── authors │ ├── jj.jpeg │ ├── joe.jpeg │ └── tim.jpeg │ ├── preview │ └── cover.jpg │ ├── hello-world │ └── cover.jpg │ ├── last-post │ └── cover.jpeg │ └── dynamic-routing │ └── cover.jpg ├── components ├── section-separator.tsx ├── post-views.tsx ├── container.tsx ├── date-formatter.tsx ├── markdown-styles.module.css ├── header.tsx ├── post-title.tsx ├── post-body.tsx ├── layout.tsx ├── avatar.tsx ├── intro.tsx ├── cover-image.tsx ├── more-stories.tsx ├── post-header.tsx ├── footer.tsx ├── meta.tsx ├── alert.tsx ├── post-preview.tsx └── hero-post.tsx ├── pages ├── _app.tsx ├── _document.tsx ├── api │ ├── page-views-preview.ts │ └── page-views.ts ├── index.tsx └── posts │ └── [slug].tsx ├── lib ├── markdownToHtml.ts ├── constants.ts ├── fetcher.ts └── api.ts ├── .gitignore ├── tsconfig.json ├── tailwind.config.js ├── config └── mongodb.ts ├── package.json ├── styles └── index.css ├── README.md └── _posts ├── preview.md ├── dynamic-routing.md ├── last-post.md └── hello-world.md /@types/remark-html.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'remark-html' 2 | -------------------------------------------------------------------------------- /.env.local.sample: -------------------------------------------------------------------------------- 1 | ## pegue esses dados no Mongo Atlas ;) 2 | MONGODB_URI= 3 | MONGODB_DB= 4 | -------------------------------------------------------------------------------- /next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: ['tailwindcss', 'postcss-preset-env'], 3 | } 4 | -------------------------------------------------------------------------------- /types/author.ts: -------------------------------------------------------------------------------- 1 | type Author = { 2 | name: string 3 | picture: string 4 | } 5 | 6 | export default Author 7 | -------------------------------------------------------------------------------- /public/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rocketseat-content/blog-nextjs-mongodb-vercel/HEAD/public/favicon/favicon.ico -------------------------------------------------------------------------------- /public/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rocketseat-content/blog-nextjs-mongodb-vercel/HEAD/public/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /public/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rocketseat-content/blog-nextjs-mongodb-vercel/HEAD/public/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /public/favicon/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rocketseat-content/blog-nextjs-mongodb-vercel/HEAD/public/favicon/mstile-150x150.png -------------------------------------------------------------------------------- /public/assets/blog/authors/jj.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rocketseat-content/blog-nextjs-mongodb-vercel/HEAD/public/assets/blog/authors/jj.jpeg -------------------------------------------------------------------------------- /public/assets/blog/authors/joe.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rocketseat-content/blog-nextjs-mongodb-vercel/HEAD/public/assets/blog/authors/joe.jpeg -------------------------------------------------------------------------------- /public/assets/blog/authors/tim.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rocketseat-content/blog-nextjs-mongodb-vercel/HEAD/public/assets/blog/authors/tim.jpeg -------------------------------------------------------------------------------- /public/assets/blog/preview/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rocketseat-content/blog-nextjs-mongodb-vercel/HEAD/public/assets/blog/preview/cover.jpg -------------------------------------------------------------------------------- /public/favicon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rocketseat-content/blog-nextjs-mongodb-vercel/HEAD/public/favicon/apple-touch-icon.png -------------------------------------------------------------------------------- /public/assets/blog/hello-world/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rocketseat-content/blog-nextjs-mongodb-vercel/HEAD/public/assets/blog/hello-world/cover.jpg -------------------------------------------------------------------------------- /public/assets/blog/last-post/cover.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rocketseat-content/blog-nextjs-mongodb-vercel/HEAD/public/assets/blog/last-post/cover.jpeg -------------------------------------------------------------------------------- /public/favicon/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rocketseat-content/blog-nextjs-mongodb-vercel/HEAD/public/favicon/android-chrome-192x192.png -------------------------------------------------------------------------------- /public/favicon/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rocketseat-content/blog-nextjs-mongodb-vercel/HEAD/public/favicon/android-chrome-512x512.png -------------------------------------------------------------------------------- /public/assets/blog/dynamic-routing/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rocketseat-content/blog-nextjs-mongodb-vercel/HEAD/public/assets/blog/dynamic-routing/cover.jpg -------------------------------------------------------------------------------- /components/section-separator.tsx: -------------------------------------------------------------------------------- 1 | const SectionSeparator = () => { 2 | return
3 | } 4 | 5 | export default SectionSeparator 6 | -------------------------------------------------------------------------------- /pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import { AppProps } from 'next/app' 2 | import '../styles/index.css' 3 | 4 | export default function MyApp({ Component, pageProps }: AppProps) { 5 | return 6 | } 7 | -------------------------------------------------------------------------------- /lib/markdownToHtml.ts: -------------------------------------------------------------------------------- 1 | import remark from 'remark' 2 | import html from 'remark-html' 3 | 4 | export default async function markdownToHtml(markdown: string) { 5 | const result = await remark().use(html).process(markdown) 6 | return result.toString() 7 | } 8 | -------------------------------------------------------------------------------- /components/post-views.tsx: -------------------------------------------------------------------------------- 1 | import { ReactNode } from "react"; 2 | 3 | type Props = { 4 | children?: ReactNode; 5 | }; 6 | 7 | const PostViews = ({ children }: Props) => { 8 | return {children}; 9 | }; 10 | 11 | export default PostViews; 12 | -------------------------------------------------------------------------------- /types/post.ts: -------------------------------------------------------------------------------- 1 | import Author from './author' 2 | 3 | type PostType = { 4 | slug: string 5 | title: string 6 | date: string 7 | coverImage: string 8 | author: Author 9 | excerpt: string 10 | ogImage: { 11 | url: string 12 | } 13 | content: string 14 | } 15 | 16 | export default PostType 17 | -------------------------------------------------------------------------------- /components/container.tsx: -------------------------------------------------------------------------------- 1 | import { ReactNode, FunctionComponent } from 'react' 2 | 3 | type Props = { 4 | children?: ReactNode 5 | } 6 | 7 | const Container: FunctionComponent = ({ children }: Props) => { 8 | return
{children}
9 | } 10 | 11 | export default Container 12 | -------------------------------------------------------------------------------- /public/favicon/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #000000 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /lib/constants.ts: -------------------------------------------------------------------------------- 1 | export const EXAMPLE_PATH = 'blog-starter-typescript' 2 | export const CMS_NAME = 'Markdown' 3 | export const HOME_OG_IMAGE_URL = 4 | 'https://og-image.now.sh/Next.js%20Blog%20Starter%20Example.png?theme=light&md=1&fontSize=100px&images=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fnextjs-black-logo.svg' 5 | -------------------------------------------------------------------------------- /components/date-formatter.tsx: -------------------------------------------------------------------------------- 1 | import { parseISO, format } from 'date-fns' 2 | 3 | type Props = { 4 | dateString: string 5 | } 6 | 7 | const DateFormatter = ({ dateString }: Props) => { 8 | const date = parseISO(dateString) 9 | return 10 | } 11 | 12 | export default DateFormatter 13 | -------------------------------------------------------------------------------- /components/markdown-styles.module.css: -------------------------------------------------------------------------------- 1 | .markdown { 2 | @apply text-lg leading-relaxed; 3 | } 4 | 5 | .markdown p, 6 | .markdown ul, 7 | .markdown ol, 8 | .markdown blockquote { 9 | @apply my-6; 10 | } 11 | 12 | .markdown h2 { 13 | @apply text-3xl mt-12 mb-4 leading-snug; 14 | } 15 | 16 | .markdown h3 { 17 | @apply text-2xl mt-8 mb-4 leading-snug; 18 | } 19 | -------------------------------------------------------------------------------- /lib/fetcher.ts: -------------------------------------------------------------------------------- 1 | import useSWR from "swr"; 2 | 3 | export function useFetch(url: string, revalidateOnFocus: boolean = false) { 4 | const { data, error } = useSWR(url, async (url) => { 5 | const response = await fetch(url); 6 | const data = await response.json(); 7 | 8 | return data; 9 | }, {revalidateOnFocus }); 10 | 11 | return { data, error }; 12 | } -------------------------------------------------------------------------------- /pages/_document.tsx: -------------------------------------------------------------------------------- 1 | import Document, { Html, Head, Main, NextScript } from 'next/document' 2 | 3 | export default class MyDocument extends Document { 4 | render() { 5 | return ( 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | ) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /components/header.tsx: -------------------------------------------------------------------------------- 1 | import Link from "next/link"; 2 | 3 | const Header = () => { 4 | return ( 5 |

6 | 7 | Blog da Rocketseat 8 | 9 | . 10 |

11 | ); 12 | }; 13 | 14 | export default Header; 15 | -------------------------------------------------------------------------------- /components/post-title.tsx: -------------------------------------------------------------------------------- 1 | import { ReactNode } from 'react' 2 | 3 | type Props = { 4 | children?: ReactNode 5 | } 6 | 7 | const PostTitle = ({ children }: Props) => { 8 | return ( 9 |

10 | {children} 11 |

12 | ) 13 | } 14 | 15 | export default PostTitle 16 | -------------------------------------------------------------------------------- /components/post-body.tsx: -------------------------------------------------------------------------------- 1 | import markdownStyles from './markdown-styles.module.css' 2 | 3 | type Props = { 4 | content: string 5 | } 6 | 7 | const PostBody = ({ content }: Props) => { 8 | return ( 9 |
10 |
14 |
15 | ) 16 | } 17 | 18 | export default PostBody 19 | -------------------------------------------------------------------------------- /public/favicon/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Next.js", 3 | "short_name": "Next.js", 4 | "icons": [ 5 | { 6 | "src": "/favicons/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/favicons/android-chrome-512x512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | } 15 | ], 16 | "theme_color": "#000000", 17 | "background_color": "#000000", 18 | "display": "standalone" 19 | } 20 | -------------------------------------------------------------------------------- /components/layout.tsx: -------------------------------------------------------------------------------- 1 | import Alert from './alert' 2 | import Footer from './footer' 3 | import Meta from './meta' 4 | 5 | type Props = { 6 | preview?: boolean 7 | children: React.ReactNode 8 | } 9 | 10 | const Layout = ({ preview, children }: Props) => { 11 | return ( 12 | <> 13 | 14 |
15 | 16 |
{children}
17 |
18 |