post_preview with footer

This commit is contained in:
Michal Vanko 2024-07-09 22:16:55 +02:00
parent 1e75744b7b
commit eed3644356
5 changed files with 54 additions and 8 deletions

View File

@ -12,7 +12,7 @@ pub fn description_filter(body: &String) -> ::askama::Result<String> {
let description = body let description = body
.lines() .lines()
.filter(|line| line.starts_with("<p")) .filter(|line| line.starts_with("<p"))
.take(3) .take(2)
.collect::<Vec<&str>>() .collect::<Vec<&str>>()
.join("\n"); .join("\n");
debug!(description); debug!(description);

View File

@ -1,5 +1,5 @@
/* /*
! tailwindcss v3.4.3 | MIT License | https://tailwindcss.com ! tailwindcss v3.4.4 | MIT License | https://tailwindcss.com
*/ */
/* /*
@ -615,6 +615,11 @@ video {
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
} }
.my-5 {
margin-top: 1.25rem;
margin-bottom: 1.25rem;
}
.mb-1 { .mb-1 {
margin-bottom: 0.25rem; margin-bottom: 0.25rem;
} }
@ -683,10 +688,34 @@ video {
flex-grow: 1; flex-grow: 1;
} }
.auto-cols-auto {
grid-auto-columns: auto;
}
.grid-flow-col { .grid-flow-col {
grid-auto-flow: column; grid-auto-flow: column;
} }
.grid-cols-2 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-cols-\[minmax\(0\2c 1fr\)_auto\] {
grid-template-columns: minmax(0,1fr) auto;
}
.grid-cols-\[1fr\2c 2fx\] {
grid-template-columns: 1fr 2fx;
}
.grid-cols-\[1fr_2fx\] {
grid-template-columns: 1fr 2fx;
}
.grid-cols-\[1fr_2fr\] {
grid-template-columns: 1fr 2fr;
}
.grid-rows-3 { .grid-rows-3 {
grid-template-rows: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr));
} }
@ -850,6 +879,10 @@ video {
font-weight: 600; font-weight: 600;
} }
.font-bold {
font-weight: 700;
}
.capitalize { .capitalize {
text-transform: capitalize; text-transform: capitalize;
} }
@ -897,6 +930,10 @@ video {
color: rgb(80 7 36 / var(--tw-text-opacity)); color: rgb(80 7 36 / var(--tw-text-opacity));
} }
.no-underline {
text-decoration-line: none;
}
.drop-shadow-md { .drop-shadow-md {
--tw-drop-shadow: drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06)); --tw-drop-shadow: drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06));
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow); filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);

View File

@ -1,15 +1,23 @@
<article class="grid grid-rows-3 grid-flow-col gap-4"> <article class="grid grid-cols-[1fr_2fr] grid-flow-col gap-4">
<aside class="row-span-3"> <aside class="row-span-3">
<svg aria-hidden="true" class="h-12 w-12 fill-blue-950"> <svg aria-hidden="true" class="h-12 w-12 fill-blue-950">
<use xlink:href="/svg/icons-sprite.svg#mail" /> <use xlink:href="/svg/icons-sprite.svg#mail" />
</svg> </svg>
</aside> </aside>
<header> <header>
<h3 class="text-lg font-medium mb-1">{{post.metadata.title}}</h3> <h3 class="text-lg font-bold mb-1">{{post.metadata.title}}</h3>
</header> </header>
<section class="text-sm leading-5 text-gray-800">{{post.body|description_filter|safe}}</section> <section class="text-base leading-5 text-gray-800">{{post.body|description_filter|safe}}</section>
<footer> <footer class="text-sm">
Footrik <ul class="inline-block">
{% for tag in post.metadata.tags %}
<li class="inline-block">
<a href="/blog/tags/{{tag}}" class="text-pink-950 no-underline">#{{tag|capitalize}}</a>
</li>
{% endfor %}
</ul>
|
<time datetime="{{post.metadata.date}}" class="text-pink-950"> {{post.metadata.date|pretty_date}} </time>
</footer> </footer>
</article> </article>

View File

@ -54,6 +54,7 @@
{% for post in featured_posts %} {% for post in featured_posts %}
<li> <li>
{% include "components/post_preview.html" %} {% include "components/post_preview.html" %}
<hr class="border-blue-950 my-5">
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -8,7 +8,7 @@
{% include "post_tag_list.html" %} {% include "post_tag_list.html" %}
<section class="created-at m-1 text-right text-sm text-gray-600"> <section class="created-at m-1 text-right text-sm text-gray-600">
<span>Published on</span> <span>Published on</span>
<time datetime="{post.metadata.date}"> {{post.metadata.date|pretty_date}} </time> <time datetime="{{post.metadata.date}}"> {{post.metadata.date|pretty_date}} </time>
</section> </section>
</aside> </aside>
</header> </header>