Skip to content

Commit 345b9ab

Browse files
created a component for displaying tags array
1 parent e78234c commit 345b9ab

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type { Tag } from "@/hooks/events";
2+
3+
// this component is responsible for displaying the array of tags
4+
interface TagListProps {
5+
tags: Tag[];
6+
}
7+
8+
export default function TagList({ tags }: TagListProps) {
9+
if (!tags.length) {
10+
return null;
11+
}
12+
return (
13+
<div className="flex flex-wrap gap-2">
14+
{tags.map((tag) => (
15+
<span key={tag.id} className="rounded-full bg-muted px-3 py-1 text-sm">
16+
{tag.name}
17+
</span>
18+
))}
19+
</div>
20+
);
21+
}

0 commit comments

Comments
 (0)