aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/PostsList/PostsList.module.scss23
-rw-r--r--src/components/PostsList/PostsList.tsx6
2 files changed, 25 insertions, 4 deletions
diff --git a/src/components/PostsList/PostsList.module.scss b/src/components/PostsList/PostsList.module.scss
index 0b9aa2d..471b172 100644
--- a/src/components/PostsList/PostsList.module.scss
+++ b/src/components/PostsList/PostsList.module.scss
@@ -1,11 +1,32 @@
+@use "@styles/abstracts/mixins" as mix;
@use "@styles/abstracts/placeholders";
.list {
@extend %reset-ordered-list;
- margin: var(--spacing-md) auto;
+ margin: 0 auto var(--spacing-md);
}
li.item {
margin: var(--spacing-md) 0;
+
+ &:first-of-type {
+ margin-top: var(--spacing-sm);
+ }
+}
+
+.section {
+ @include mix.media("screen") {
+ @include mix.dimensions("sm") {
+ display: grid;
+ grid-template-columns: max-content minmax(0, 1fr);
+ align-items: first baseline;
+ gap: var(--spacing-md);
+ }
+ }
+}
+
+.year {
+ position: sticky;
+ top: 0;
}
diff --git a/src/components/PostsList/PostsList.tsx b/src/components/PostsList/PostsList.tsx
index da72032..51698e6 100644
--- a/src/components/PostsList/PostsList.tsx
+++ b/src/components/PostsList/PostsList.tsx
@@ -20,8 +20,8 @@ const PostsList = ({
return years.map((year) => {
return (
- <Fragment key={year}>
- {showYears && <h2>{year}</h2>}
+ <section key={year} className={styles.section}>
+ {showYears && <h2 className={styles.year}>{year}</h2>}
<ol className={styles.list}>
{posts[year].map((post) => {
return (
@@ -31,7 +31,7 @@ const PostsList = ({
);
})}
</ol>
- </Fragment>
+ </section>
);
});
};