Restyle the frontend as an editorial magazine layout

Centred wordmark over a rule of category links, a lead article above a grid of
cards, centred article headers over a narrow reading column, and a footer split
into columns. Neutral warm-grey palette with a serif display face for headings
and small uppercase labels for metadata.
This commit is contained in:
davide committed 2026-08-25 12:22:05 +02:00
1 parent 005c90f33a
commit 55b70f0805
7 files changed
+499 -175

No files matched your search

+63 -21
View File
@@ -48,19 +48,25 @@ useHead({
<template>
<article v-if="article">
<nav class="breadcrumb muted" aria-label="Breadcrumb">
<NuxtLink to="/blog">Articles</NuxtLink>
<template v-if="article.category">
<span aria-hidden="true"> / </span>
<NuxtLink :to="`/category/${article.category.slug}`">{{ article.category.name }}</NuxtLink>
</template>
</nav>
<header class="article-header">
<nav class="kicker" aria-label="Breadcrumb">
<NuxtLink to="/blog">Articles</NuxtLink>
<template v-if="article.category">
<span aria-hidden="true"> / </span>
<NuxtLink :to="`/category/${article.category.slug}`">
{{ article.category.name }}
</NuxtLink>
</template>
</nav>
<h1>{{ article.title }}</h1>
<h1>{{ article.title }}</h1>
<p class="muted meta">
<time :datetime="isoDate(article.publishedAt)">{{ formatDate(article.publishedAt) }}</time>
</p>
<p class="kicker date">
<time :datetime="isoDate(article.publishedAt)">
{{ formatDate(article.publishedAt) }}
</time>
</p>
</header>
<img
v-if="cover"
@@ -73,30 +79,66 @@ useHead({
<!-- eslint-disable-next-line vue/no-v-html -- rendered server-side from editor Markdown -->
<div class="prose" v-html="article.html" />
<p class="back">
<NuxtLink to="/blog">Back to all articles</NuxtLink>
</p>
</article>
</template>
<style scoped>
article {
max-width: 44rem;
.article-header {
max-width: 46rem;
margin-inline: auto;
text-align: center;
}
.breadcrumb {
font-size: 0.9rem;
.article-header nav a {
text-decoration: none;
}
.article-header nav a:hover {
text-decoration: underline;
text-underline-offset: 0.2em;
}
h1 {
margin: 0.5rem 0 0.25rem;
font-size: clamp(1.8rem, 4vw, 2.6rem);
margin: 1rem 0 0;
font-size: clamp(2rem, 5vw, 3.2rem);
}
.meta {
margin-top: 0;
.date {
margin-top: 1rem;
font-weight: 400;
}
.prose {
margin-inline: auto;
}
.back {
max-width: var(--width-prose);
margin: 4rem auto 0;
padding-top: 2rem;
border-top: 1px solid var(--color-border);
text-align: center;
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.back a {
text-decoration: none;
border-bottom: 1px solid var(--color-ink);
padding-bottom: 0.3rem;
}
.cover {
width: 100%;
margin-block: 1.5rem;
border-radius: var(--radius);
aspect-ratio: 3 / 2;
object-fit: cover;
margin-block: 3rem;
background: var(--color-surface);
}
</style>
+4 -10
View File
@@ -27,7 +27,10 @@ useHead({ link: [{ rel: 'canonical', href: canonical }] })
<template>
<div>
<h1>Articles</h1>
<header class="page-header">
<p class="kicker">The archive</p>
<h1>Articles</h1>
</header>
<p v-if="error">Articles could not be loaded. Please try again later.</p>
@@ -59,12 +62,3 @@ useHead({ link: [{ rel: 'canonical', href: canonical }] })
</div>
</template>
<style scoped>
.pagination {
display: flex;
flex-wrap: wrap;
gap: 1.5rem;
align-items: center;
margin-top: 3rem;
}
</style>
+4 -18
View File
@@ -35,11 +35,10 @@ useHead({ link: [{ rel: 'canonical', href: canonical }] })
<template>
<div>
<p class="breadcrumb muted">
<NuxtLink to="/blog">Articles</NuxtLink>
</p>
<h1>{{ category?.name }}</h1>
<header class="page-header">
<p class="kicker">Category</p>
<h1>{{ category?.name }}</h1>
</header>
<p v-if="error">Articles could not be loaded. Please try again later.</p>
@@ -69,16 +68,3 @@ useHead({ link: [{ rel: 'canonical', href: canonical }] })
</div>
</template>
<style scoped>
.breadcrumb {
font-size: 0.9rem;
}
.pagination {
display: flex;
flex-wrap: wrap;
gap: 1.5rem;
align-items: center;
margin-top: 3rem;
}
</style>
+127 -23
View File
@@ -6,7 +6,12 @@ const { data, error } = await useFetch<Paginated<ArticleSummary>>('/api/articles
query: { page: 1 },
})
const articles = computed(() => data.value?.items.slice(0, 6) ?? [])
/** The newest article leads the page; the next six fill the grid below it. */
const featured = computed(() => data.value?.items[0] ?? null)
const rest = computed(() => data.value?.items.slice(1, 7) ?? [])
const mediaUrl = useMediaUrl()
const featuredCover = computed(() => mediaUrl(featured.value?.cover))
const { public: config } = useRuntimeConfig()
@@ -25,40 +30,139 @@ useSeoMeta({
<template>
<div>
<section class="hero">
<h1>{{ SITE_NAME }}</h1>
<p class="muted">{{ SITE_DESCRIPTION }}</p>
</section>
<h2>Latest articles</h2>
<p v-if="error">Articles could not be loaded. Please try again later.</p>
<p v-else-if="!articles.length">Nothing has been published yet.</p>
<p v-else-if="!featured">Nothing has been published yet.</p>
<ul v-else class="card-grid">
<li v-for="article in articles" :key="article.slug">
<ArticleCard :article="article" />
</li>
</ul>
<template v-else>
<article class="featured">
<NuxtLink class="featured-cover" :to="`/blog/${featured.slug}`" tabindex="-1" aria-hidden="true">
<img
v-if="featuredCover"
:src="featuredCover"
:alt="featured.cover?.alternativeText ?? ''"
:width="featured.cover?.width ?? undefined"
:height="featured.cover?.height ?? undefined"
>
<span v-else class="placeholder" />
</NuxtLink>
<p class="more">
<NuxtLink to="/blog">See all articles</NuxtLink>
</p>
<div class="featured-text">
<p class="kicker">
{{ featured.category ? featured.category.name : 'Latest' }}
</p>
<h1>
<NuxtLink :to="`/blog/${featured.slug}`">{{ featured.title }}</NuxtLink>
</h1>
<p class="kicker date">
<time :datetime="isoDate(featured.publishedAt)">
{{ formatDate(featured.publishedAt) }}
</time>
</p>
<p class="read-more">
<NuxtLink :to="`/blog/${featured.slug}`">Read the article</NuxtLink>
</p>
</div>
</article>
<template v-if="rest.length">
<h2 class="section-heading kicker">More stories</h2>
<ul class="card-grid">
<li v-for="article in rest" :key="article.slug">
<ArticleCard :article="article" />
</li>
</ul>
</template>
<p class="more">
<NuxtLink to="/blog">View all articles</NuxtLink>
</p>
</template>
</div>
</template>
<style scoped>
.hero {
margin-bottom: 3rem;
.featured {
display: grid;
gap: 2.5rem;
align-items: center;
grid-template-columns: 1fr;
}
.hero h1 {
margin-bottom: 0.25rem;
font-size: clamp(2rem, 5vw, 3rem);
@media (min-width: 52rem) {
.featured {
grid-template-columns: 1.35fr 1fr;
gap: 3.5rem;
}
}
.featured-cover {
display: block;
overflow: hidden;
}
.featured-cover img,
.placeholder {
width: 100%;
aspect-ratio: 3 / 2;
object-fit: cover;
background: var(--color-surface);
}
.featured h1 {
margin-top: 0.6rem;
font-size: clamp(2rem, 4.5vw, 3.1rem);
}
.featured h1 a {
text-decoration: none;
}
.featured h1 a:hover {
text-decoration: underline;
text-underline-offset: 0.12em;
}
.date {
margin-top: 1rem;
font-weight: 400;
}
.read-more {
margin-top: 1.75rem;
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.read-more a {
padding-bottom: 0.35rem;
text-decoration: none;
border-bottom: 1px solid var(--color-ink);
}
.more {
margin-top: 2.5rem;
margin-top: 4rem;
text-align: center;
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.more a {
padding: 0.85rem 2.5rem;
text-decoration: none;
border: 1px solid var(--color-ink);
color: var(--color-ink);
display: inline-block;
transition: background 0.2s ease, color 0.2s ease;
}
.more a:hover {
background: var(--color-ink);
color: var(--color-bg);
}
</style>