Procházet zdrojové kódy

Compact blog listing header and remove duplicate language controls

zhangwei123 před 1 měsícem
rodič
revize
c66ce79b5a

+ 14 - 0
docs/editorial/blog-style-verification.md

@@ -20,3 +20,17 @@ Verified on the final source:
 Visual limitation: the real homepage was inspected, but the redesigned blog could not be visually inspected in this environment. Local Chromium launch remains unavailable. Actual SSR snapshots with inline built CSS were prepared outside the repository, but the separate browser explicitly disallowed file URLs; no workaround was attempted. Therefore rendered desktop/mobile layout, 320/390px wrapping and live keyboard interactions remain unverified. Structural CSS checks are not a screenshot or interactive QA pass.
 
 The pre-existing full-lint missing `next/core-web-vitals` configuration remains outside this styling scope. No push or deployment is included. This revision is handed off as a local Git commit/bundle for user review.
+
+## Compact listing refinement (baseline `fa95625`)
+
+The user-provided screenshot was materialized through Library and its actual pixels inspected. The listing header is now a compact left-aligned section header, retaining the same black/white/amber treatment. CSS measurements before → after:
+
+- Desktop panel padding: 40px 48px → 20px 24px; bottom gap: 40px → 24px.
+- Listing h1 size: clamp(30px, 4.2vw, 48px) → clamp(24px, 3vw, 32px); bottom gap: 24px → 12px.
+- Listing eyebrow bottom gap: 24px → 8px; description: 17px → 15px.
+- Mobile panel padding: 28px 20px → 16px; description: 15px → 14px.
+- Removed the separate language row (including its former 32px desktop/24px mobile bottom margin) from the listing and article view. The shared Nav remains the sole language control.
+
+These are source CSS measurements, not measured rendered panel heights or a verified above-the-fold guarantee. Article headings/body typography and article text remain unchanged. Existing translated URL routes and actual-edition hreflang generation remain unchanged; no translated content has been added. The Nav still switches only the site-navigation UI, with an explicit accessible explanation; it does not claim to translate articles.
+
+Focused style/SSR-nav/content checks, nonincremental typecheck, focused lint, production build and the HTTP regression suite passed again (exit 0); independent source and HTTP review also passed. Rendered visual/mobile verification remains unavailable under the documented browser restrictions.

+ 1 - 0
scripts/check-blog-http.mjs

@@ -29,6 +29,7 @@ for (const locale of new Set(visible.map(a => a.locale))) {
     assert.equal(alternateCount, variants.length + (variants.some(b => b.locale === 'en') ? 1 : 0), `Unexpected alternate: ${a.path}`);
     assert(!html.includes('nav.blogs'), 'Untranslated key');
     assert(html.includes('data-blog-navigation'), 'Missing shared site navigation wrapper');
+    assert(!html.includes('class="blog-languages"'), 'Duplicate blog language row must be absent');
     for (const target of ['/services', '/slots', '/login']) assert(html.includes(`href="${target}"`), `Missing shared navigation action: ${target}`);
     assert(html.includes('aria-expanded="false"'), 'Mobile menu must SSR closed');
     assert(html.includes('Login / Sign up') && html.includes('Slot Check'), 'Navigation must SSR in English');

+ 9 - 1
scripts/check-blog-style.mjs

@@ -20,7 +20,15 @@ const sharedNav = fs.readFileSync('src/components/Navbar.tsx', 'utf8');
 assert(sharedNav.includes('items-center h-16'), 'Use the existing 64px shared navigation');
 assert(!css.includes('.blog-header'), 'Do not duplicate the shared navigation styles');
 assert(!/\.blog-body a/.test(css), 'Blog CSS must not override shared navigation anchor colors');
-assert.equal(declarations('.blog-hero')['box-shadow'], '8px 8px 0 var(--blog-ink)');
+assert.equal(declarations('.blog-hero')['box-shadow'], 'var(--blog-shadow)');
+assert.equal(declarations('.blog-hero').padding, '20px 24px');
+assert.equal(declarations('.blog-hero')['margin-bottom'], '24px');
+assert.equal(declarations('.blog-hero h1')['font-size'], 'clamp(24px, 3vw, 32px)');
+assert.equal(declarations('.blog-hero h1')['margin-bottom'], '12px');
+assert.equal(declarations('.blog-hero .blog-eyebrow')['margin-bottom'], '8px');
+assert(!css.includes('.blog-languages'), 'No duplicate language-control styling');
+const views = fs.readFileSync('src/components/blog/BlogViews.tsx', 'utf8');
+assert(!views.includes('LanguageLinks') && !views.includes('blog-languages'), 'Use shared Nav instead of duplicate language controls');
 assert.equal(declarations('.blog-main')['scroll-margin-top'], '88px');
 assert.equal(declarations('.blog-footer nav')['overflow-wrap'], 'anywhere');
 assert.equal(declarations('.blog-card').border, 'var(--blog-line)');

+ 1 - 8
src/components/blog/BlogViews.tsx

@@ -1,19 +1,13 @@
 import ReactMarkdown from 'react-markdown';
 import remarkGfm from 'remark-gfm';
 import type { BlogArticle, BlogLocale } from '@/lib/blog/types';
-import { articlePath, visibleLocales, blogPath, visibleArticles, visibleTranslations } from '@/lib/blog/data';
+import { articlePath, blogPath, visibleArticles } from '@/lib/blog/data';
 import { articleSchema } from '@/lib/blog/metadata';
 import { copy } from '@/lib/blog/translations';
 
-function LanguageLinks({ locale, article }: { locale: BlogLocale; article?: BlogArticle }) {
-  const links = article ? visibleTranslations(article).map(a => ({ locale: a.locale, href: articlePath(a) })) : visibleLocales().map(l => ({ locale: l, href: blogPath(l) }));
-  return <nav className="blog-languages" aria-label={copy[locale].language}>{links.map(link => <a key={link.locale} href={link.href} hrefLang={link.locale} lang={link.locale} aria-current={locale === link.locale ? 'page' : undefined}>{copy[link.locale].name}</a>)}</nav>;
-}
-
 export function BlogIndex({ locale }: { locale: BlogLocale }) {
   const t = copy[locale];
   return <>
-    <LanguageLinks locale={locale} />
     <section className="blog-hero"><p className="blog-eyebrow">IRELAND → EUROPE</p><h1>{t.title}</h1><p>{t.description}</p></section>
     <div className="blog-grid">{visibleArticles(locale).map((article, index) => <article key={article.id} className="blog-card">
       <span className="blog-card-number">0{index + 1}</span><h2><a href={articlePath(article)}>{article.title}</a></h2><p>{article.description}</p><a className="blog-read" href={articlePath(article)}>{t.read} <span aria-hidden="true">↗</span></a>
@@ -29,7 +23,6 @@ export function BlogArticleView({ article }: { article: BlogArticle }) {
   const schema = JSON.stringify(articleSchema(article)).replace(/</g, '\\u003c');
   return <>
     <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: schema }} />
-    <LanguageLinks locale={article.locale} article={article} />
     <nav className="blog-breadcrumb" aria-label={t.guides}><a href={blogPath(article.locale)}>{t.guides}</a><span aria-hidden="true"> / </span><span>{article.title}</span></nav>
     <article className="blog-article"><header className="blog-article-header"><p className="blog-eyebrow">IRELAND → {article.destinationLabel}</p><h1>{article.title}</h1><p className="blog-lede">{article.description}</p><p className="blog-reviewed">{t.reviewed}: <time dateTime={article.reviewedAt}>{new Intl.DateTimeFormat(article.locale, { dateStyle: 'long', timeZone: 'UTC' }).format(new Date(`${article.reviewedAt}T00:00:00Z`))}</time></p></header>
       <div className="blog-prose"><ReactMarkdown remarkPlugins={[remarkGfm]} skipHtml>{article.body}</ReactMarkdown></div>

+ 7 - 9
src/components/blog/blog.css

@@ -28,13 +28,12 @@
 .blog-brand strong { font-size: 16px; font-weight: 900; letter-spacing: -.4px; }
 .blog-brand small { margin-top: 4px; font-size: 9px; font-weight: 700; letter-spacing: .9px; color: #737373; }
 .blog-main { scroll-margin-top: 88px; width: 100%; max-width: 1152px; flex-grow: 1; margin: auto; padding: 40px 32px 64px; }
-.blog-languages { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 32px; font-family: var(--blog-mono); font-size: 12px; }
-.blog-languages a { padding: 5px 10px; border: var(--blog-line); background: var(--blog-surface); font-weight: 700; text-decoration: none; }
-.blog-languages a[aria-current=page] { background: var(--blog-accent); box-shadow: 2px 2px 0 var(--blog-ink); }
-.blog-hero { margin-bottom: 40px; padding: 40px 48px; text-align: center; background: var(--blog-surface); border: var(--blog-line); box-shadow: 8px 8px 0 var(--blog-ink); }
+.blog-hero { margin-bottom: 24px; padding: 20px 24px; text-align: left; background: var(--blog-surface); border: var(--blog-line); box-shadow: var(--blog-shadow); }
 .blog-eyebrow { display: inline-block; margin: 0 0 24px; padding: 5px 12px; background: var(--blog-accent); border: var(--blog-line); box-shadow: 3px 3px 0 var(--blog-ink); font-family: var(--blog-mono); font-size: 12px; font-weight: 900; letter-spacing: .6px; }
 .blog-hero h1, .blog-article h1 { margin: 0 0 24px; font-size: clamp(30px, 4.2vw, 48px); font-weight: 900; letter-spacing: -1.2px; line-height: 1.15; text-transform: uppercase; overflow-wrap: anywhere; }
-.blog-hero > p:last-child { max-width: 760px; margin: auto; color: var(--blog-muted); font-size: 17px; }
+.blog-hero .blog-eyebrow { margin-bottom: 8px; padding: 2px 8px; font-size: 10px; line-height: 1.5; }
+.blog-hero h1 { margin-bottom: 12px; font-size: clamp(24px, 3vw, 32px); line-height: 1.2; letter-spacing: -.6px; }
+.blog-hero > p:last-child { max-width: 880px; margin: 0; color: var(--blog-muted); font-size: 15px; line-height: 1.5; }
 .blog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-bottom: 40px; }
 .blog-card { display: flex; flex-direction: column; min-width: 0; padding: 24px; background: var(--blog-surface); border: var(--blog-line); box-shadow: var(--blog-shadow); }
 .blog-card-number { align-self: flex-start; margin-bottom: 20px; padding: 3px 8px; background: var(--blog-accent); border: var(--blog-line); font-family: var(--blog-mono); font-size: 12px; font-weight: 900; }
@@ -96,10 +95,9 @@
 }
 @media (max-width: 639px) {
   .blog-main { scroll-margin-top: 88px; padding: 28px 20px 48px; }
-  .blog-languages { margin-bottom: 24px; }
-  .blog-hero { padding: 28px 20px; box-shadow: var(--blog-shadow); }
-  .blog-hero h1, .blog-article h1 { letter-spacing: -.7px; }
-  .blog-hero > p:last-child { font-size: 15px; }
+  .blog-hero { padding: 16px; }
+  .blog-article h1 { letter-spacing: -.7px; }
+  .blog-hero > p:last-child { font-size: 14px; }
   .blog-card { padding: 22px; }
   .blog-article { padding: 28px 20px; box-shadow: var(--blog-shadow); }
   .blog-notice { padding: 24px 20px; }