feat: add post footer

This commit is contained in:
log101 2024-05-12 11:45:41 +03:00
parent c0ec392fbf
commit 537fc2300a
7 changed files with 54 additions and 7 deletions

View File

@ -2,3 +2,5 @@
build
coverage
public
src/content/blog/*

View File

@ -9,6 +9,7 @@
align-items: center;
gap: 10px;
color: gray;
font-size: var(--small-desktop);
}
.footer a {

View File

@ -8,10 +8,12 @@ interface Props {
const { post, componentType } = Astro.props;
let showTags, shortSummary, longSummary, fullText;
let showTags, shortSummary, longSummary, fullText, postFooter;
switch (componentType) {
case "full":
postFooter = true;
showTags = true;
fullText = true;
break;
case "long":
@ -30,6 +32,8 @@ const postDateFormatted = post.data.date.toLocaleDateString("tr-TR", {
month: "long",
year: "numeric",
});
const { Content } = await post.render();
---
<style>
@ -46,6 +50,7 @@ const postDateFormatted = post.data.date.toLocaleDateString("tr-TR", {
.post-header {
display: flex;
flex-direction: column;
gap: 4px;
}
.post-category {
@ -103,13 +108,17 @@ const postDateFormatted = post.data.date.toLocaleDateString("tr-TR", {
color: inherit;
font-size: var(--small-desktop);
}
.post-footer {
color: #424242;
font-size: var(--small-desktop);
}
</style>
<div class="post">
<div class="post-header">
<p class="post-category">{post.data.subcategory}</p>
<h4 class="post-title">{post.data.title}</h4>
{shortSummary && <p class="post-summary">{post.data.summary}</p>}
<div class="meta">
{
showTags && (
@ -149,18 +158,29 @@ const postDateFormatted = post.data.date.toLocaleDateString("tr-TR", {
</div>
</div>
</div>
{shortSummary && <p class="post-summary">{post.data.summary}</p>}
{
longSummary && (
<>
<p class="post-long-summary">{post.body.slice(0, 500)}</p>
{post.body.length > 500 && (
<a class="read-more" href={`/${post.slug}`}>
<a
class="read-more"
href={`/category/${post.data.category}/${post.slug}`}
>
Devamını Oku
</a>
)}
</>
)
}
{fullText && <p class="post-text">{post.body}</p>}
{
fullText && (
<div class="post-body">
<Content />
</div>
)
}
{postFooter && <p class="post-footer">{postDateFormatted}</p>}
</div>

View File

@ -0,0 +1,20 @@
---
title: "Bir Komponentin Serüveni: React"
summary: Yazdığınız komponentlere ne olur? Bu yazıda React komponentlerinin serüvenlerine göz atıyoruz!
category: teknik
subcategory: Teknik Yazı
date: 2024-04-01
tags:
- react
- javascript
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ut neque sollicitudin, pretium ipsum lacinia, mattis elit. Fusce in dolor suscipit, rutrum risus vehicula, feugiat ipsum. Sed sit amet enim cursus, efficitur eros eu, dapibus lectus. In nec risus eget nisl sodales bibendum nec sit amet nisl. Nulla a dolor finibus, commodo velit et, aliquam lacus. Nunc cursus ultrices tellus, ut volutpat mauris luctus vitae. Donec tristique sollicitudin est, sed iaculis odio eleifend non.
</br></br>
Fusce posuere non elit in vehicula. Proin facilisis dignissim bibendum. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed posuere mi lectus, at eleifend mi tristique eu. Suspendisse potenti. Nam et eros velit.
</br></br>
Cras viverra sollicitudin neque et bibendum. Pellentesque ultrices mattis venenatis. Nam leo neque, tristique sed arcu vitae, semper rutrum justo. Ut porta orci nec consectetur bibendum. Etiam feugiat pretium lacus, non molestie lorem cursus sed. Nullam a vehicula turpis, nec tristique mauris. Cras euismod, lectus vitae ultricies elementum, ante dolor cursus lorem, at placerat nulla leo eget mauris. Aenean feugiat est ac sem auctor mollis. Maecenas eget interdum leo. Aenean tristique augue sapien, sit amet malesuada nisl molestie sed. Nullam volutpat pellentesque metus, ut mollis odio. Phasellus molestie iaculis lacinia.
</br></br>
Pellentesque vel massa a ipsum volutpat accumsan in vitae eros. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed porttitor non ligula eget congue. Nunc dictum augue in eros mattis, ut varius risus maximus. Etiam augue tortor, rutrum ac quam vitae, iaculis fringilla lacus. Donec ullamcorper nunc non odio eleifend, vel pulvinar neque fermentum. Cras vel cursus metus. Vestibulum volutpat porta urna, aliquam mollis sem placerat nec. Interdum et malesuada fames ac ante ipsum primis in faucibus. Praesent eu dictum odio. Nunc eleifend arcu vulputate, volutpat elit ullamcorper, feugiat sapien. Ut egestas aliquet faucibus. Fusce vitae lectus eu nunc mollis aliquet. Fusce cursus imperdiet auctor.
</br></br>
Vivamus urna arcu, bibendum vitae finibus in, fringilla ut nunc. Praesent fermentum velit non tortor porta, et commodo lectus blandit. Sed non mauris libero. Cras interdum, lorem a dignissim sagittis, diam lorem hendrerit lorem, sit amet porta sapien mauris sed augue. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Proin fringilla urna quis tellus hendrerit mattis. Nulla facilisi. In blandit sapien et lacus sollicitudin, ut elementum ex maximus. Integer efficitur libero eleifend luctus rutrum. Aenean a interdum leo, id blandit ante. Nulla velit dolor, euismod nec tempor ut, lobortis sed orci. Ut euismod tempor turpis ac maximus. Pellentesque odio lectus, malesuada a efficitur ac, placerat vel urna.

View File

@ -34,6 +34,11 @@ const { title } = Astro.props;
sans-serif;
background-color: #f5fffa;
}
* {
margin: 0;
}
body {
display: flex;
justify-content: center;

View File

@ -5,6 +5,7 @@ import Footer from "@/components/Footer.astro";
import Header from "@/components/Header.astro";
import Layout from "@/layouts/Layout.astro";
import "@/styles/home.css";
import Post from "@/components/Post.astro";
export async function getStaticPaths() {
const blogEntries = await getCollection("blog");
@ -20,8 +21,7 @@ const { entry } = Astro.props;
<Layout title="log101">
<di class="container">
<Header />
{entry.body}
<a class="home-all-posts" href="#">Tüm Yayınlar</a>
<Post post={entry} componentType="full" />
<Footer />
</di>
</Layout>

View File

@ -35,7 +35,6 @@ const allTeknikPosts = await getCollection(
.map((p) => <Post post={p} componentType="long" />)
}
</div>
<a class="home-all-posts" href="#">Tüm Yayınlar</a>
<Footer />
</div>
</Layout>