refactor: change article header layout

This commit is contained in:
Sergey Yarkov 2022-08-05 23:13:14 +03:00
parent b808437567
commit bedf897c63
5 changed files with 56 additions and 69 deletions

View File

@ -1,17 +1,17 @@
import { defineConfig } from 'astro/config'; import { defineConfig } from "astro/config";
import solid from '@astrojs/solid-js'; import solid from "@astrojs/solid-js";
import compress from 'astro-compress'; import compress from "astro-compress";
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
site: 'https://yarkov.tech', site: "https://yarkov.tech",
integrations: [solid(), compress({ img: false })], integrations: [solid(), compress({ img: false, html: false })],
markdown: { markdown: {
syntaxHighlight: 'prism', syntaxHighlight: "prism",
}, },
vite: { vite: {
ssr: { ssr: {
external: ['svgo'], external: ["svgo"],
}, },
}, },
experimental: { experimental: {

View File

@ -21,7 +21,7 @@
& q { & q {
font-style: italic; font-style: italic;
quotes: '«' '»'; quotes: "«" "»";
} }
& h1, & h1,
@ -135,10 +135,16 @@
} }
} }
li::marker { & li {
color: var(--color-blue-500); list-style: disc;
font-size: 1.3rem; & li {
line-height: var(--line-height-none); list-style-type: circle;
}
&::marker {
color: var(--color-blue-500);
font-size: 1.3rem;
line-height: var(--line-height-none);
}
} }
& blockquote { & blockquote {

View File

@ -1,6 +1,6 @@
--- ---
import { DateFormatter } from '@root/utils'; import { DateFormatter } from "@root/utils";
import './ArticlePost.scss'; import "./ArticlePost.scss";
export interface Props { export interface Props {
data: ArticleType; data: ArticleType;
@ -10,33 +10,31 @@ const { data } = Astro.props as Props;
const { title, tags, author, published_at } = data; const { title, tags, author, published_at } = data;
--- ---
<article class='article'> <article class="article">
<header> <header>
<div class='meta'> <div class="tags">
<ul class='list-links'> <ul>
{tags.map((tag) => ( {tags.map((tag) => (
<li> <li>
<a class="btn-link" href={`/articles?tags=${tag.toLocaleLowerCase()}`}> <a href={`/articles?tags=${tag.toLocaleLowerCase()}`}>{`${tag}${tags.at(-1) === tag ? "" : ","}`}</a>
{tag}
</a>
</li> </li>
))} ))}
</ul> </ul>
<div>
<time datetime={published_at}>{DateFormatter.format(new Date(published_at))}</time>
<span>Опубликовал&nbsp;<b>{author}</b></span>
</div>
</div> </div>
<div class='heading'> <div class="heading">
<h1>{title}</h1> <h1>{title}</h1>
</div> </div>
<div class="published">
<time datetime={published_at}>{DateFormatter.format(new Date(published_at))}</time>
<span>{author}</span>
</div>
<div> <div>
<figure> <figure>
<img src='https://picsum.photos/1920/1080' alt='Article Image' /> <img src="https://picsum.photos/1920/1080" alt="Article Image" />
</figure> </figure>
</div> </div>
</header> </header>
<slot></slot> <slot />
<footer> <footer>
<h2>Comments</h2> <h2>Comments</h2>
</footer> </footer>

View File

@ -1,29 +1,7 @@
.article { .article {
& header { & header {
& .meta {
display: flex;
justify-content: space-between;
align-items: flex-end;
column-gap: 5px;
& ul {
max-width: 350px;
}
& div {
display: flex;
flex-direction: column;
text-align: right;
white-space: nowrap;
& time {
text-transform: uppercase;
font-size: var(--font-size-sm);
}
}
}
& .heading { & .heading {
margin-top: 2rem; margin-top: 1.125rem;
& h1 { & h1 {
font-weight: 600; font-weight: 600;
@ -36,6 +14,22 @@
} }
} }
& .tags {
font-size: var(--font-size-sm);
text-transform: uppercase;
& ul {
display: flex;
flex-wrap: wrap;
column-gap: 5px;
row-gap: 7px;
}
}
& .published {
margin-bottom: 1.25em;
color: var(--font-color-gray);
}
& figure { & figure {
margin: 0; margin: 0;
@ -55,24 +49,8 @@
@media screen and (max-width: 560px) { @media screen and (max-width: 560px) {
.article { .article {
& header { & header .heading h1 {
& .heading h1 { font-size: 2rem;
font-size: 2rem;
}
& .meta {
flex-direction: column-reverse;
align-items: flex-start;
& ul {
max-width: 100%;
}
& div {
align-self: flex-end;
margin-bottom: 1.2rem;
}
}
} }
} }
} }

View File

@ -88,6 +88,12 @@ p {
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
} }
ul {
list-style: none;
padding: 0;
margin: 0;
}
h1, h1,
h2, h2,
h3, h3,
@ -101,7 +107,6 @@ input,
textarea { textarea {
-webkit-appearance: none; -webkit-appearance: none;
font-family: var(--font-family-base); font-family: var(--font-family-base);
font-size: 20px;
padding: 8px 15px; padding: 8px 15px;
border-radius: var(--border-radius-md); border-radius: var(--border-radius-md);
background-color: var(--background-inputs-color); background-color: var(--background-inputs-color);