Skip to content

Commit 5894817

Browse files
committed
Fix blog index page spacing+alignment
1 parent 764f271 commit 5894817

File tree

4 files changed

+52
-71
lines changed

4 files changed

+52
-71
lines changed

src/components/BaseHead.astro

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ interface Props {
1010
image?: string;
1111
}
1212
13-
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
14-
1513
const {
1614
title,
1715
description = SITE_DESCRIPTION,
18-
image = "/blog-placeholder-1.jpg",
16+
image = "/cyberlang-logo.png",
1917
} = Astro.props;
2018
---
2119

@@ -79,9 +77,6 @@ const {
7977
crossorigin
8078
/>
8179

82-
<!-- Canonical URL -->
83-
<link rel="canonical" href={canonicalURL} />
84-
8580
<!-- Primary Meta Tags -->
8681
<!-- For the home page, just show the site title -->
8782
<title>{title ? `${title} | ${SITE_TITLE}` : SITE_TITLE}</title>

src/components/header/mobile/Menu.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import PageLink from "./PageLink.astro";
1212
</nav>
1313
<div id="theme-row" class="dropdown-item">
1414
<label for="theme">Theme:</label>
15-
<select name="theme" id="theme-select">
15+
<select name="theme" id="theme-select" aria-label="Theme picker">
1616
{themes.map(({ name, theme }) => <option value={theme ?? "Sync"}>{name}</option>)}
1717
</select>
1818
</div>

src/consts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// You can import this data from anywhere in your site by using the `import` keyword.
33

44
export const SITE_TITLE = "CYB3RL4NG";
5-
export const SITE_DESCRIPTION = "Website for Team CYB3RL4NG";
5+
export const SITE_DESCRIPTION = "Team CYB3RL4NG's website";
66

77
export const CONTACT_NAME = "Terra Oh";
88
export const CONTACT_EMAIL = "toh12@terpmail.umd.edu";

src/pages/blog/index.astro

Lines changed: 49 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -12,79 +12,65 @@ const posts = (await getCollection("blog")).sort(
1212
<BaseLayout title="Blog">
1313
<h1>Blog</h1>
1414
<p>
15-
This is where we post about our progress and findings.
16-
If you want updates, you can track our <a href={RSS_LINK}>RSS feed</a>.
15+
This is where we post about our progress and findings. If you want updates,
16+
you can track our <a href={RSS_LINK}>RSS feed</a>.
1717
</p>
18-
<ul>
19-
{
20-
posts.map((post) => (
21-
<li>
22-
<h2>
23-
<a href={`/blog/${post.slug}`}>{post.data.title}</a>
24-
</h2>
25-
Posted <FormattedDate date={post.data.pubDate} />
26-
<p>{post.data.description}</p>
27-
</li>
28-
))
29-
}
30-
</ul>
18+
<div class="center-posts-container">
19+
<div class="posts">
20+
{
21+
posts.map((post) => (
22+
<div class="post">
23+
<h2>
24+
<a href={`/blog/${post.slug}`}>{post.data.title}</a>
25+
</h2>
26+
Posted <FormattedDate date={post.data.pubDate} />
27+
<p>{post.data.description}</p>
28+
</div>
29+
))
30+
}
31+
</div>
32+
</div>
3133
</BaseLayout>
3234

33-
<style>
34-
main {
35-
width: 960px;
36-
}
37-
ul {
35+
<style lang="scss">
36+
@import "../../styles/common.scss";
37+
38+
.center-posts-container {
3839
display: flex;
39-
flex-wrap: wrap;
40-
gap: 2rem;
41-
list-style-type: none;
42-
margin: 0;
43-
padding: 0;
44-
}
45-
ul li {
46-
width: calc(50% - 1rem);
47-
}
48-
ul li * {
49-
text-decoration: none;
50-
transition: 0.2s ease;
51-
}
52-
ul li img {
53-
margin-bottom: 0.5rem;
54-
border-radius: 12px;
5540
}
56-
ul li a {
57-
display: block;
58-
}
59-
.title {
60-
margin: 0;
61-
color: rgb(var(--black));
62-
line-height: 1;
63-
}
64-
.date {
65-
margin: 0;
66-
color: rgb(var(--gray));
67-
}
68-
ul li a:hover h4,
69-
ul li a:hover .date {
70-
color: rgb(var(--accent));
41+
42+
.posts {
43+
row-gap: 1rem;
44+
column-gap: 5ch;
45+
46+
margin-left: auto;
47+
margin-right: auto;
7148
}
72-
ul a:hover img {
73-
box-shadow: var(--box-shadow);
49+
50+
.posts {
51+
// Single column for phones
52+
display: flex;
53+
flex-direction: column;
54+
55+
// Two columns for tablets and up
56+
@media (min-width: $tabletMinWidth) {
57+
display: grid;
58+
grid-template-columns: auto auto;
59+
}
7460
}
75-
@media (max-width: 720px) {
76-
ul {
77-
gap: 0.5em;
61+
62+
.post {
63+
width: max-content;
64+
65+
a {
66+
text-decoration: none;
7867
}
79-
ul li {
68+
}
69+
70+
@media (max-width: ($tabletMinWidth - 0.5)) {
71+
.post {
8072
width: 100%;
8173
text-align: center;
8274
}
83-
ul li:first-child {
84-
margin-bottom: 0;
85-
}
86-
ul li:first-child .title {
87-
font-size: 1.563em;
88-
}
8975
}
9076
</style>

0 commit comments

Comments
 (0)