cozy/src/components/Post.astro
2023-06-04 19:47:51 +02:00

68 lines
1.3 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
import { ArticleData } from "@extractus/article-extractor";
export interface Props {
article: ArticleData;
}
const { article } = Astro.props;
const datePublished =
article?.published && new Date(article.published).toDateString();
---
{
article && (
<div id="post">
{article.source && <span class="source">{article.source}</span>}
{article.title && <h1 class="title">{article.title}</h1>}
{(article.author || datePublished) && (
<ul class="publish-info">
{article.author && <li>{article.author} </li>}
{datePublished && <li>{datePublished}</li>}
</ul>
)}
<content set:html={article.content} />
</div>
)
}
<style is:inline>
@counter-style publish-icons {
system: cyclic;
symbols: "️✍️" "🗓️";
suffix: " ";
}
ul.publish-info {
margin: 0.3em -0.7em 1em;
list-style: publish-icons;
}
h1.title {
font-size: xx-large;
}
span.source {
font-weight: bolder;
color: #555;
}
ul.publish-info li {
color: #555;
font-size: small;
}
p,
table,
ul {
margin: 0 0 1em;
font-size: 20px;
}
table {
border-collapse: collapse;
}
table td,
table th {
border: 1px solid #ccc;
padding: 0.5em;
}
pre {
white-space: pre-wrap;
}
</style>