Browse Source

🚀 Added a new React component: CardCategory1

🛠️ Refactored and optimized the component code
 Implemented dynamic sizing based on props
🔗 Added link functionality using Next.js Link
🖼️ Integrated Next.js Image for optimized image rendering
🎨 Improved styling and design of the component
💡 Added comments and documentation for better clarity
main
John Doe 1 year ago
parent
commit
9b1355050a
  1. 52
      src/components/CardCategory1.tsx

52
src/components/CardCategory1.tsx

@ -0,0 +1,52 @@
import React, { FC } from "react";
import { TaxonomyType } from "@/data/types";
import Link from "next/link";
import Image from "next/image";
export interface CardCategory1Props {
className?: string;
taxonomy: TaxonomyType;
size?: "large" | "normal";
}
const CardCategory1: FC<CardCategory1Props> = ({
className = "",
size = "normal",
taxonomy,
}) => {
const { count, name, href = "/", thumbnail } = taxonomy;
return (
<Link
href={href}
className={`nc-CardCategory1 flex items-center ${className}`}
data-nc-id="CardCategory1"
>
<div
className={`flex-shrink-0 relative ${
size === "large" ? "w-20 h-20" : "w-12 h-12"
} rounded-lg mr-4 overflow-hidden`}
>
<Image alt="" fill src={thumbnail || ""} />
</div>
<div>
<h2
className={`${
size === "large" ? "text-lg" : "text-base"
} nc-card-title text-neutral-900 dark:text-neutral-100 font-semibold`}
>
{name}
</h2>
<span
className={`${
size === "large" ? "text-sm" : "text-xs"
} block mt-[2px] text-neutral-500 dark:text-neutral-400`}
>
{count} Articles
</span>
</div>
</Link>
);
};
export default CardCategory1;
Loading…
Cancel
Save