Skip to content

Commit 055af03

Browse files
committed
Set aspect-ratio to 4.75 and refactor out a weird selector
1 parent 9531da4 commit 055af03

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/components/blog-page/blog-card.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export function BlogCard({
2323
className,
2424
...rest
2525
}: BlogCardProps) {
26-
2726
return (
2827
<NextLink
2928
href={route}
@@ -35,12 +34,8 @@ export function BlogCard({
3534
)}
3635
{...rest}
3736
>
38-
<BlogCardPicture
39-
frontMatter={frontMatter}
40-
// this weird selector sets background to tags so they look better on top of the picture
41-
className="aspect-[2.23] [&>*>*>*]:bg-neu-0"
42-
>
43-
<BlogTags tags={frontMatter.tags} />
37+
<BlogCardPicture frontMatter={frontMatter} className="aspect-[4.75]">
38+
<BlogTags tags={frontMatter.tags} opaque />
4439
</BlogCardPicture>
4540
<div className="flex grow flex-col border border-neu-200 dark:border-neu-50">
4641
<div className="typography-body-lg grow text-pretty p-4">

src/components/blog-page/blog-tags.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,22 @@ import { Tag } from "@/app/conf/_design-system/tag"
22

33
import { blogTagColors } from "./blog-tag-colors"
44

5-
export function BlogTags({ tags }: { tags: string[] }) {
5+
export function BlogTags({
6+
tags,
7+
opaque,
8+
}: {
9+
tags: string[]
10+
opaque?: boolean
11+
}) {
612
return (
713
<div className="flex gap-2">
814
{tags.map(tag => {
915
const color = blogTagColors[tag]
10-
if (!color) {
16+
if (!color && process.env.NODE_ENV !== "production") {
1117
throw new Error(`No color found for tag: ${tag}`)
1218
}
1319
return (
14-
<Tag color={color} key={tag}>
20+
<Tag className={opaque ? "bg-neu-0" : ""} color={color} key={tag}>
1521
{tag.replaceAll("-", " ")}
1622
</Tag>
1723
)

0 commit comments

Comments
 (0)