diff --git a/app/about/page.tsx b/app/about/page.tsx new file mode 100644 index 0000000..e69de29 diff --git a/app/blog/[...slug]/page.tsx b/app/blog/[...slug]/page.tsx new file mode 100644 index 0000000..0fadc30 --- /dev/null +++ b/app/blog/[...slug]/page.tsx @@ -0,0 +1,4 @@ +export default function BlogPost() { + return
post
+ +} \ No newline at end of file diff --git a/app/blog/loading.tsx b/app/blog/loading.tsx new file mode 100644 index 0000000..9488820 --- /dev/null +++ b/app/blog/loading.tsx @@ -0,0 +1,3 @@ +export default function BlogLoader() { + return
...loading...
+} \ No newline at end of file diff --git a/app/blog/page.tsx b/app/blog/page.tsx new file mode 100644 index 0000000..431fcbd --- /dev/null +++ b/app/blog/page.tsx @@ -0,0 +1,19 @@ +import Link from "next/link" +import { getAllPosts } from "../../lib/cms" + +export default async function Blog() { + const posts = await getAllPosts() + + return ( +
+ {posts.map((post) => ( + // eslint-disable-next-line react/jsx-key + +
+

{post.title}

+
+ + ))} +
+ ) +} \ No newline at end of file diff --git a/app/contact/page.tsx b/app/contact/page.tsx new file mode 100644 index 0000000..80f46ec --- /dev/null +++ b/app/contact/page.tsx @@ -0,0 +1,30 @@ +'use client' + +import { useState } from "react" + +export default function Contact() { + const [email, setEmail] = useState('') + const handleSubmit = async (e: { preventDefault: () => void }) => { + e.preventDefault() + + await fetch('/api/contact', { + method: 'Post', + body: JSON.stringify({ email }), + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json' + } + }) + console.log('hey') + } + + + return
+ +
+ setEmail(e.target.value)}/> + + +
+
+} \ No newline at end of file diff --git a/app/layout.tsx b/app/layout.tsx index dcf6d47..39d45df 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,3 +1,5 @@ +import '../styles/global.css' + export default function RootLayout({ children, }: { diff --git a/app/page.tsx b/app/page.tsx index 8706e65..16979a6 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,5 +1,16 @@ - +import Link from 'next/link' +import styles from '../styles/home.module.css' export default async function Home() { - return
hello
+ return
+
+

Hi, My name is Manel

+
+ Check my blog +
+
+ Contact me +
+
+
} diff --git a/lib/cms.ts b/lib/cms.ts new file mode 100644 index 0000000..edf3c9d --- /dev/null +++ b/lib/cms.ts @@ -0,0 +1,19 @@ +const delay = (time: number | undefined) => { + return new Promise((resolve) => { + setTimeout(() => { + resolve(1) + }, time) + }) +} + +export const getAllPosts = async () => { + await delay(3000) + + return new Array(10).fill(1).map((_, i) => { + return { + title: `This is post ${i}`, + slug: `this-is-post-${i}`, + body:' tiruri tirura' + } + }) +} \ No newline at end of file diff --git a/pages/api/contact.ts b/pages/api/contact.ts new file mode 100644 index 0000000..2625584 --- /dev/null +++ b/pages/api/contact.ts @@ -0,0 +1,9 @@ +export default function handler(req, res) { +//save to DB + + console.log(req.body) + + if (req.method === 'POST') { + res.json({message:"ok"}) + } +} \ No newline at end of file diff --git a/styles/global.css b/styles/global.css index add36fe..770d5de 100644 --- a/styles/global.css +++ b/styles/global.css @@ -1,3 +1,10 @@ +body, html { + margin: 0px; + padding: 0px; + +} + + * { box-sizing: border-box; -} \ No newline at end of file +} diff --git a/styles/home.module.css b/styles/home.module.css new file mode 100644 index 0000000..2bdef19 --- /dev/null +++ b/styles/home.module.css @@ -0,0 +1,9 @@ +.home{ + height: 100vh; + width: 100vw; + background: black; + color: white; + display: flex; + justify-content: center; + align-items: center; +} \ No newline at end of file