Skip to content

Commit 06f3ded

Browse files
committed
test: blackout other article cards
1 parent 6c90ea6 commit 06f3ded

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

app/blog/[...slug]/page.tsx

+11-3
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,21 @@ async function Siblings({ slug }: { slug: string }) {
9797
height={article.image.height}
9898
src={article.image.src}
9999
alt={article.imageAlt}
100+
data-visual-test="blackout"
100101
/>
101102
<PostCardBody>
102103
{article.category && (
103-
<PostCardTag>{article.category}</PostCardTag>
104+
<PostCardTag data-visual-test="blackout">
105+
{article.category}
106+
</PostCardTag>
104107
)}
105-
<PostCardTitle>{article.title}</PostCardTitle>
106-
<PostCardFooter>
108+
<PostCardTitle
109+
classname="line-clamp-2"
110+
data-visual-test="blackout"
111+
>
112+
{article.title}
113+
</PostCardTitle>
114+
<PostCardFooter data-visual-test="blackout">
107115
<PostCardAuthor>{article.author}</PostCardAuthor>
108116
<div className="text-xs text-mauve-10">|</div>
109117
<PostCardDate date={article.date} />

components/PostCard.tsx

+13-15
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { clsx } from "clsx";
21
import Image, { ImageProps } from "next/image";
3-
import type { ComponentProps, ReactNode } from "react";
4-
import { twc } from "react-twc";
2+
import type { ComponentProps } from "react";
3+
import { TwcComponentProps, twc } from "react-twc";
54

6-
export const PostCard = twc.div`rounded-lg border bg-subtle text-left transition duration-300 hover:-translate-y-2 hover:scale-[101%]"`;
5+
export const PostCard = twc.div`rounded-lg border bg-subtle text-left transition duration-300 hover:-translate-y-2 hover:scale-[101%]`;
76

87
export interface PostCardImageProps extends ImageProps {
98
extended?: Boolean;
@@ -52,17 +51,16 @@ export const PostCardTag: React.FC<{ children: React.ReactNode }> = (props) => (
5251
<p className="mb-2 text-xs text-low" {...props} />
5352
);
5453

55-
export const PostCardTitle = ({
56-
extended,
57-
children,
58-
}: {
59-
extended?: Boolean;
60-
children: ReactNode;
61-
}) => (
62-
<h2 className={`mb-2 ${extended ? "text-4xl" : "text-2xl"} font-accent text`}>
63-
{children}
64-
</h2>
65-
);
54+
type PostCardTitleProps = TwcComponentProps<"h2"> & {
55+
extended?: boolean;
56+
classname?: string;
57+
};
58+
59+
export const PostCardTitle = twc.h2<PostCardTitleProps>((props) => [
60+
"mb-2 font-accent",
61+
props.extended ? "text-4xl" : "text-2xl",
62+
props.classname,
63+
]);
6664

6765
export const PostCardDescription = (props: ComponentProps<"div">) => (
6866
<div className="mb-8 leading-normal text-low" {...props} />

0 commit comments

Comments
 (0)