feat: hasiera orriko post-en estiloa aldatzen du
This commit is contained in:
1 parent
7f3dfafe9d
commit
02223d254e
7 files changed
+693
-162
No files matched your search
@@ -1,9 +1,10 @@
|
||||
---
|
||||
import type { CollectionEntry } from "astro:content";
|
||||
import Post from "../components/Post.astro";
|
||||
import PostGrid from "./PostGrid.astro";
|
||||
|
||||
interface Props {
|
||||
allPosts: CollectionEntry<'posts'>[]
|
||||
allPosts: CollectionEntry<"posts">[];
|
||||
}
|
||||
|
||||
const { allPosts } = Astro.props;
|
||||
@@ -11,20 +12,14 @@ const { allPosts } = Astro.props;
|
||||
//.sort(() => 0.5 - Math.random()).slice(0, 3);
|
||||
|
||||
let posts = allPosts
|
||||
.sort(
|
||||
(a, b) =>
|
||||
new Date(b.data.updated || b.data.added).valueOf() -
|
||||
new Date(a.data.updated || a.data.added).valueOf(),
|
||||
)
|
||||
.slice(0, 5);
|
||||
.sort(
|
||||
(a, b) =>
|
||||
new Date(b.data.updated || b.data.added).valueOf() -
|
||||
new Date(a.data.updated || a.data.added).valueOf(),
|
||||
)
|
||||
.slice(0, 6);
|
||||
---
|
||||
|
||||
<content>
|
||||
<ul class="posts-list">
|
||||
{
|
||||
posts.map(
|
||||
(post) => <Post post={post} />
|
||||
)
|
||||
}
|
||||
</ul>
|
||||
<PostGrid posts={posts} />
|
||||
</content>
|
||||
@@ -0,0 +1,97 @@
|
||||
---
|
||||
import type { CollectionEntry } from "astro:content";
|
||||
|
||||
interface Props {
|
||||
posts: CollectionEntry<"posts">[];
|
||||
}
|
||||
|
||||
const { posts } = Astro.props;
|
||||
|
||||
function getTiltDegrees() {
|
||||
const degreeCollection = [0.5, 1, 1.5, 2];
|
||||
const randomKey = Math.floor(Math.random() * degreeCollection.length);
|
||||
|
||||
return degreeCollection[randomKey];
|
||||
}
|
||||
---
|
||||
|
||||
<ul class="posts-list">
|
||||
{
|
||||
posts.map(({ data: { slug, title, added: date, description, tags } }) => (
|
||||
<li class="post" style={`--tilt: ${getTiltDegrees()}deg;`}>
|
||||
<a href={`/post/${slug}/`} class="title">
|
||||
{title}
|
||||
</a>
|
||||
<br />
|
||||
{description && <span class="excerpt">{description}</span>}
|
||||
<div>
|
||||
{tags &&
|
||||
tags.map((tag: string) => (
|
||||
<a class="tag" href={`/tag/${tag}`}>
|
||||
#{tag}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
|
||||
<style lang="scss">
|
||||
ul.posts-list,
|
||||
ul.tags-list {
|
||||
padding: unset;
|
||||
list-style-type: none;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 1em;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.post {
|
||||
margin: 0;
|
||||
|
||||
.title {
|
||||
font-size: 1.125em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
border: 2px solid var(--blue);
|
||||
background-color: var(--yellow);
|
||||
padding: 0.5em;
|
||||
border-radius: 0.375em;
|
||||
|
||||
transition: transform 0.1s ease-in-out;
|
||||
|
||||
&:nth-child(even) {
|
||||
transform: rotate(calc(-1 * var(--tilt)));
|
||||
}
|
||||
|
||||
&:nth-child(odd) {
|
||||
transform: rotate(var(--tilt));
|
||||
}
|
||||
|
||||
&:hover {
|
||||
transform: rotate(0);
|
||||
}
|
||||
}
|
||||
|
||||
.tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
.tag {
|
||||
display: inline-block;
|
||||
margin-right: 20px;
|
||||
color: var(--black);
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.tag:hover {
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
+137
-137
@@ -4,55 +4,54 @@
|
||||
License MIT: https://github.com/HermanMartinus/bearblog/blob/master/LICENSE.md
|
||||
*/
|
||||
:root {
|
||||
--white: #f8f5f9;
|
||||
--transwhite: rgba(248, 245, 249, 0.7);
|
||||
--moretranswhite: rgba(248, 245, 249, 0.1);
|
||||
--black: #30252b;
|
||||
--transblack: rgba(48, 37, 43, 0.7);
|
||||
--moretransblack: rgba(48, 37, 43, 0.1);
|
||||
--gray: #6d5a6d;
|
||||
--white: #f8f5f9;
|
||||
--transwhite: rgba(248, 245, 249, 0.7);
|
||||
--moretranswhite: rgba(248, 245, 249, 0.1);
|
||||
--black: #30252b;
|
||||
--transblack: rgba(48, 37, 43, 0.7);
|
||||
--moretransblack: rgba(48, 37, 43, 0.1);
|
||||
--gray: #6d5a6d;
|
||||
|
||||
--highlight: #f1dcff;
|
||||
--red: #f6a7a3;
|
||||
--green: #c5e5c0;
|
||||
--pink: #e7b0e8;
|
||||
--blue: #c3b5f7;
|
||||
--yellow: #fbe4b2;
|
||||
--highlight: #f1dcff;
|
||||
--red: #f6a7a3;
|
||||
--green: #c5e5c0;
|
||||
--pink: #e7b0e8;
|
||||
--blue: #c3b5f7;
|
||||
--yellow: #fbe4b2;
|
||||
}
|
||||
|
||||
|
||||
::selection {
|
||||
background-color: var(--highlight);
|
||||
color: var(--black);
|
||||
background-color: var(--highlight);
|
||||
color: var(--black);
|
||||
}
|
||||
|
||||
body {
|
||||
margin: auto;
|
||||
padding: 20px;
|
||||
max-width: 70ch;
|
||||
background-color: var(--white);
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
color: var(--black);
|
||||
margin: auto;
|
||||
padding: 20px;
|
||||
max-width: 70ch;
|
||||
background-color: var(--white);
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
color: var(--black);
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
padding: 40px;
|
||||
}
|
||||
@media (min-width: 1024px) {
|
||||
padding: 40px;
|
||||
}
|
||||
}
|
||||
html,
|
||||
body,
|
||||
button,
|
||||
code {
|
||||
font-family: "iA Writer Mono", monospace;
|
||||
font-family: "iA Writer Mono", monospace;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
font-size: 18px;
|
||||
}
|
||||
@media (min-width: 1024px) {
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
h1,
|
||||
strong,
|
||||
b {
|
||||
color: var(--black);
|
||||
color: var(--black);
|
||||
}
|
||||
|
||||
body.dark-mode,
|
||||
@@ -61,53 +60,53 @@ body.dark-mode h1,
|
||||
body.dark-mode .go-home,
|
||||
button.dark-mode,
|
||||
button.dark-mode button {
|
||||
background: var(--black);
|
||||
color: var(--white);
|
||||
background: var(--black);
|
||||
color: var(--white);
|
||||
}
|
||||
body.dark-mode nav {
|
||||
background: var(--transblack);
|
||||
background: var(--transblack);
|
||||
}
|
||||
|
||||
.tag-title {
|
||||
font-weight: 400;
|
||||
color: var(--black);
|
||||
font-weight: 400;
|
||||
color: var(--black);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
::selection {
|
||||
background-color: #0f0f0f;
|
||||
color: var(--white);
|
||||
}
|
||||
:root {
|
||||
--gray: #a4a4a4;
|
||||
}
|
||||
html,
|
||||
body,
|
||||
body button,
|
||||
body h1,
|
||||
body strong,
|
||||
body b,
|
||||
body em,
|
||||
body blockquote,
|
||||
body .go-home {
|
||||
background: var(--black);
|
||||
color: var(--white);
|
||||
}
|
||||
body nav {
|
||||
background: var(--transblack);
|
||||
}
|
||||
body code {
|
||||
background-color: var(--moretranswhite);
|
||||
}
|
||||
body a {
|
||||
color: var(--white);
|
||||
}
|
||||
body .tag {
|
||||
color: var(--gray);
|
||||
}
|
||||
.tag-title {
|
||||
color: var(--white);
|
||||
}
|
||||
::selection {
|
||||
background-color: #0f0f0f;
|
||||
color: var(--white);
|
||||
}
|
||||
:root {
|
||||
--gray: #a4a4a4;
|
||||
}
|
||||
html,
|
||||
body,
|
||||
body button,
|
||||
body h1,
|
||||
body strong,
|
||||
body b,
|
||||
body em,
|
||||
body blockquote,
|
||||
body .go-home {
|
||||
background: var(--black);
|
||||
color: var(--white);
|
||||
}
|
||||
body nav {
|
||||
background: var(--transblack);
|
||||
}
|
||||
body code {
|
||||
background-color: var(--moretranswhite);
|
||||
}
|
||||
body a {
|
||||
color: var(--white);
|
||||
}
|
||||
body .tag {
|
||||
color: var(--gray);
|
||||
}
|
||||
.tag-title {
|
||||
color: var(--white);
|
||||
}
|
||||
}
|
||||
|
||||
h2,
|
||||
@@ -115,165 +114,166 @@ h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
color: var(--gray);
|
||||
line-height: 1.1;
|
||||
color: var(--gray);
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
header {
|
||||
position: relative;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--black);
|
||||
text-decoration-thickness: 0.3ex;
|
||||
text-underline-offset: 0.3ex;
|
||||
color: var(--black);
|
||||
text-decoration-thickness: 0.3ex;
|
||||
text-underline-offset: 0.3ex;
|
||||
}
|
||||
|
||||
nav {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
text-align: center;
|
||||
background: var(--transwhite);
|
||||
-webkit-backdrop-filter: blur(1px);
|
||||
backdrop-filter: blur(1px);
|
||||
padding-top: 25px;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
text-align: center;
|
||||
background: var(--transwhite);
|
||||
-webkit-backdrop-filter: blur(1px);
|
||||
backdrop-filter: blur(1px);
|
||||
padding-top: 25px;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
nav a {
|
||||
margin-bottom: 25px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
nav a:not(:last-child) {
|
||||
padding: 0 12px 0 0;
|
||||
padding: 0 12px 0 0;
|
||||
}
|
||||
|
||||
hr {
|
||||
border-top: 1px solid var(--gray);
|
||||
margin: 1rem 0;
|
||||
border-top: 1px solid var(--gray);
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
ul.posts-list,
|
||||
ul.tags-list {
|
||||
padding: unset;
|
||||
list-style-type: none;
|
||||
padding: unset;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.post {
|
||||
margin: 0 0 30px 0;
|
||||
margin: 0 0 30px 0;
|
||||
}
|
||||
|
||||
.post .title {
|
||||
font-size: 1.3em;
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
.tag {
|
||||
display: inline-block;
|
||||
margin-right: 20px;
|
||||
color: var(--black);
|
||||
font-size: 0.8rem;
|
||||
display: inline-block;
|
||||
margin-right: 20px;
|
||||
color: var(--black);
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.tag:hover {
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
font-size: 16px;
|
||||
width: 100%;
|
||||
font-size: 16px;
|
||||
}
|
||||
input {
|
||||
font-size: 16px;
|
||||
font-size: 16px;
|
||||
}
|
||||
main,
|
||||
content {
|
||||
line-height: 1.6;
|
||||
line-height: 1.6;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
code {
|
||||
padding: 2px 5px;
|
||||
background-color: var(--moretransblack);
|
||||
font-weight: bold;
|
||||
padding: 2px 5px;
|
||||
background-color: var(--moretransblack);
|
||||
font-weight: bold;
|
||||
}
|
||||
pre {
|
||||
padding: 1rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
pre > code {
|
||||
all: unset;
|
||||
all: unset;
|
||||
}
|
||||
blockquote {
|
||||
border: 1px solid var(--gray);
|
||||
color: var(--black);
|
||||
padding: 2px 0px 2px 20px;
|
||||
margin: 0px;
|
||||
font-style: italic;
|
||||
border: 1px solid var(--gray);
|
||||
color: var(--black);
|
||||
padding: 2px 0px 2px 20px;
|
||||
margin: 0px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-weight: 400;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-weight: 400;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
h3 {
|
||||
text-align: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.header-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.header-frame {
|
||||
max-width: 350px;
|
||||
max-width: 350px;
|
||||
}
|
||||
|
||||
article :not(.article-title) {
|
||||
line-height: 1.8;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.article-title {
|
||||
font-size: 2em;
|
||||
margin: 0.25em 0;
|
||||
font-size: 2em;
|
||||
margin: 0.25em 0;
|
||||
}
|
||||
|
||||
.blog-post {
|
||||
font-size: clamp(1rem, 0.96rem + 0.22vw, 1.125rem);
|
||||
font-size: clamp(1rem, 0.96rem + 0.22vw, 1.125rem);
|
||||
}
|
||||
|
||||
.blog-post > * + * {
|
||||
margin-block-start: 1em;
|
||||
margin-block-start: 1em;
|
||||
}
|
||||
|
||||
time {
|
||||
font-style: italic;
|
||||
color: var(--gray);
|
||||
font-style: italic;
|
||||
color: var(--gray);
|
||||
}
|
||||
|
||||
ul li time {
|
||||
white-space: nowrap;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
nav a:not(:last-child) {
|
||||
padding: 0;
|
||||
}
|
||||
nav a:not(:last-child) {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user