add news post
This commit is contained in:
@@ -15,12 +15,24 @@ const { post, pageInfo } = Astro.props;
|
||||
{post ? (
|
||||
<div class="article-wrapper">
|
||||
<article class="news-single">
|
||||
|
||||
<div class="article_info">
|
||||
<div class="publication__data">{post.date && <time>{new Date(post.date).toLocaleDateString('ru-RU')}</time>}</div>
|
||||
<span class="author"><Author post={post} separator=", " /></span>
|
||||
</div>
|
||||
<div class="publication__data">
|
||||
{post.date && (
|
||||
<time datetime={new Date(post.date).toISOString()}>
|
||||
{new Date(post.date).toLocaleDateString('ru-RU')}
|
||||
</time>
|
||||
)}
|
||||
</div>
|
||||
<span class="divider" aria-hidden="true"></span>
|
||||
<div class="publication__author">
|
||||
<Author post={post} separator=", " />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<h1>{post.title}</h1>
|
||||
{post.secondaryTitle && <p class="secondary-title">{post.secondaryTitle}</p>}
|
||||
{post.secondaryTitle && <h2 class="secondary-title">{post.secondaryTitle}</h2>}
|
||||
|
||||
{post.featuredImage?.node?.sourceUrl && (
|
||||
<figure class="featured-image">
|
||||
@@ -46,17 +58,20 @@ const { post, pageInfo } = Astro.props;
|
||||
)}
|
||||
|
||||
{post.content && <div set:html={post.content} />}
|
||||
|
||||
<Subscribe />
|
||||
</article>
|
||||
|
||||
<ShareButtons url={post.uri} title={post.title} />
|
||||
|
||||
<Subscribe />
|
||||
|
||||
</div>
|
||||
) : (
|
||||
<div>Новость не найдена</div>
|
||||
)}
|
||||
|
||||
<style>
|
||||
|
||||
.article-wrapper {
|
||||
position: relative;
|
||||
max-width: 75%;
|
||||
@@ -69,29 +84,42 @@ const { post, pageInfo } = Astro.props;
|
||||
margin: 0 0 0.625rem;
|
||||
}
|
||||
|
||||
.secondary-title {
|
||||
font-size: 1.25rem;
|
||||
line-height: 1.4;
|
||||
color: #666;
|
||||
margin: 0.5rem 0 1rem;
|
||||
font-weight: 400;
|
||||
.news-single h2{
|
||||
font-size: 1.5rem;
|
||||
line-height: 1.1;
|
||||
margin: 2.0625rem 0 .375rem;
|
||||
}
|
||||
|
||||
.news-single :global(p a) {
|
||||
color: #0d6efd;
|
||||
}
|
||||
|
||||
.article_info{
|
||||
|
||||
.article_info {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
gap: .475rem; /* одинаковое расстояние с обеих сторон от черты */
|
||||
margin-top: 1.9375rem;
|
||||
margin-bottom: .9375rem;
|
||||
font-size: 0.875rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.publication__data::after{
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
height: 12px;
|
||||
margin-top: -6px;
|
||||
border-left: 1px solid grey;
|
||||
.divider {
|
||||
display: block;
|
||||
width: 1px;
|
||||
height: 12px;
|
||||
background-color: #999;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.publication__author :global(a){
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.featured-image {
|
||||
margin: 1.5rem 0;
|
||||
width: 100%;
|
||||
|
||||
Reference in New Issue
Block a user