mirror of
https://github.com/yusufipk/teknolojirehberleri.xyz.git
synced 2026-09-11 10:56:08 +00:00
(create) created dummy posts and styled it
This commit is contained in:
+11
-2
@@ -1,3 +1,12 @@
|
||||
export default function Home() {
|
||||
return <div className="homepage"></div>;
|
||||
export default function Home({ posts }) {
|
||||
return (
|
||||
<div className="homepage">
|
||||
<h1 className="homepage_heading-1">Rehberler</h1>
|
||||
<div className="homepage_posts">
|
||||
{posts.slice(0, 20).map((post) => (
|
||||
<li key={post.id}>{post.title}</li>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
+13
-2
@@ -1,7 +1,7 @@
|
||||
import Head from "next/head";
|
||||
import Home from "../commons/home";
|
||||
|
||||
export default function App() {
|
||||
export default function App({ posts }) {
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
@@ -12,7 +12,18 @@ export default function App() {
|
||||
/>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
</Head>
|
||||
<Home />
|
||||
<Home posts={posts} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getStaticProps() {
|
||||
const res = await fetch("https://jsonplaceholder.typicode.com/posts");
|
||||
const posts = await res.json();
|
||||
|
||||
return {
|
||||
props: {
|
||||
posts,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
list-style-type: none;
|
||||
|
||||
li:not(:last-child) {
|
||||
margin-right: 1rem;
|
||||
margin-right: 2.5rem;
|
||||
}
|
||||
|
||||
&-item {
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
.homepage {
|
||||
height: 90vh;
|
||||
font-size: 2rem;
|
||||
list-style-type: none;
|
||||
justify-items: center;
|
||||
|
||||
display: grid;
|
||||
justify-content: center;
|
||||
|
||||
&_heading-1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&_posts {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
width: 50%;
|
||||
min-height: 100vh;
|
||||
|
||||
li {
|
||||
margin-top: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user