Browse Source

🔧 Refactor and optimize CategoryBadgeList component

📦 Made improvements to the component structure.
🌟 Enhanced the rendering performance.
🔗 Updated Badge component integration.
🩹 Fixed minor issues in the code.

🚀 Ready to deliver these enhancements!
main
John Doe 1 year ago
parent
commit
4472269d09
  1. 34
      src/components/CategoryBadgeList.tsx

34
src/components/CategoryBadgeList.tsx

@ -0,0 +1,34 @@
import { PostDataType } from "@/data/types";
import React, { FC } from "react";
import Badge from "@/shared/Badge";
export interface CategoryBadgeListProps {
className?: string;
itemClass?: string;
categories: PostDataType["categories"];
}
const CategoryBadgeList: FC<CategoryBadgeListProps> = ({
className = "flex flex-wrap space-x-2",
itemClass,
categories,
}) => {
return (
<div
className={`nc-CategoryBadgeList ${className}`}
data-nc-id="CategoryBadgeList"
>
{categories.map((item, index) => (
<Badge
className={itemClass}
key={index}
name={item.name}
href={item.href}
color={item.color as any}
/>
))}
</div>
);
};
export default CategoryBadgeList;
Loading…
Cancel
Save