@xexr/blog-platform 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -342,19 +342,16 @@ export default function ArticlePage({
342
342
  {/* Featured Image */}
343
343
  {imageUrl && (
344
344
  <figure className="article-featured-image mx-auto my-8 w-full max-w-4xl sm:my-12 lg:my-16">
345
- <div className="aspect-[16/9] overflow-hidden rounded-3xl border border-[var(--blog-accent-border)] shadow-[0_24px_80px_rgb(168_85_247_/_0.14)]">
346
- <Image
347
- src={imageUrl}
348
- alt={
349
- article.featuredImageAlt ??
350
- `Featured image for ${article.title}`
351
- }
352
- className="h-full w-full object-cover"
353
- width={800}
354
- height={450}
355
- priority
356
- />
357
- </div>
345
+ <Image
346
+ src={imageUrl}
347
+ alt={
348
+ article.featuredImageAlt ?? `Featured image for ${article.title}`
349
+ }
350
+ className="h-auto w-full rounded-3xl border border-[var(--blog-accent-border)] shadow-[0_24px_80px_rgb(168_85_247_/_0.14)]"
351
+ width={1200}
352
+ height={800}
353
+ priority
354
+ />
358
355
 
359
356
  {hasFeaturedImageMeta && (
360
357
  <figcaption className="text-muted-foreground mt-3 space-y-1 px-2 text-center text-sm leading-relaxed sm:px-0">
@@ -826,7 +823,7 @@ function ArticleCardImage({ src, alt }: { src: string; alt: string }) {
826
823
  alt={alt}
827
824
  width={480}
828
825
  height={270}
829
- className="h-full w-full object-cover transition-transform duration-500 group-hover:scale-105"
826
+ className="h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"
830
827
  />
831
828
  </div>
832
829
  );
@@ -315,7 +315,7 @@ function AuthorArticlePreview({
315
315
  }
316
316
  width={320}
317
317
  height={200}
318
- className="h-full w-full object-cover transition-transform duration-500 group-hover:scale-105"
318
+ className="h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"
319
319
  />
320
320
  </div>
321
321
  )}
@@ -79,6 +79,26 @@ describe("BlogHomePage", () => {
79
79
  expect(html).toContain("Recurring work and routines");
80
80
  });
81
81
 
82
+ it("renders article preview images as clipped cover thumbnails", async () => {
83
+ const html = await renderToHtml(
84
+ React.createElement(BlogHomePage, {
85
+ articles: [
86
+ {
87
+ ...article,
88
+ featuredImage: "https://cdn.example.com/articles/routines.webp",
89
+ featuredImageAlt: "A tidy workspace",
90
+ },
91
+ ],
92
+ }),
93
+ );
94
+
95
+ expect(html).toContain("overflow-hidden rounded-2xl");
96
+ expect(html).toContain(
97
+ "h-full w-full object-cover transition-transform duration-300 group-hover:scale-105",
98
+ );
99
+ expect(html).not.toContain("h-full w-full object-contain");
100
+ });
101
+
82
102
  it("renders the newsletter form when configured", async () => {
83
103
  const html = await renderToHtml(
84
104
  React.createElement(BlogHomePage, {
@@ -229,7 +229,7 @@ function ArticlePreview({
229
229
  {imageUrl && (
230
230
  <Link
231
231
  href={articleUrl}
232
- className="focus-visible:ring-ring relative block aspect-[16/10] w-full overflow-hidden rounded-2xl focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none"
232
+ className="focus-visible:ring-ring relative block aspect-[16/10] w-full overflow-hidden rounded-2xl bg-[var(--blog-accent-bg)] focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none"
233
233
  aria-label={`Read article: ${article.title}`}
234
234
  >
235
235
  <Image
@@ -298,7 +298,7 @@ function ArticlePreview({
298
298
  {imageUrl && (
299
299
  <Link
300
300
  href={articleUrl}
301
- className="focus-visible:ring-ring relative block aspect-[16/10] w-64 shrink-0 overflow-hidden rounded-2xl focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none xl:w-72"
301
+ className="focus-visible:ring-ring relative block aspect-[16/10] w-64 shrink-0 overflow-hidden rounded-2xl bg-[var(--blog-accent-bg)] focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none xl:w-72"
302
302
  aria-label={`Read article: ${article.title}`}
303
303
  >
304
304
  <Image
@@ -76,4 +76,26 @@ describe("Blog topic archive pages", () => {
76
76
  expect(html).toContain("via-[var(--blog-text-accent)]");
77
77
  expect(html).toContain("to-fuchsia-200");
78
78
  });
79
+
80
+ it("renders topic archive article images as clipped cover thumbnails", () => {
81
+ const html = renderToStaticMarkup(
82
+ React.createElement(BlogTopicArchivePage, {
83
+ articles: [
84
+ {
85
+ ...article,
86
+ featuredImage: "https://cdn.example.com/articles/routines.webp",
87
+ featuredImageAlt: "A tidy workspace",
88
+ },
89
+ ],
90
+ topicSlug: "recurring-work-and-routines",
91
+ basePath: "/new-blog",
92
+ }),
93
+ );
94
+
95
+ expect(html).toContain("overflow-hidden rounded-2xl");
96
+ expect(html).toContain(
97
+ "h-full w-full object-cover transition-transform duration-300 group-hover:scale-105",
98
+ );
99
+ expect(html).not.toContain("h-full w-full object-contain");
100
+ });
79
101
  });