import { Tag } from "antd";
import { PostDto, TaxonomySlug } from "@nice/common";

const TermInfo = ({ post }: { post: PostDto }) => {
	console.log("xx", post?.terms);

	return (
		<>
			{post?.terms && post?.terms?.length > 0 ? (
				<div className="flex gap-2 mb-4">
					{post?.terms?.map((term: any) => {
						return (
							<Tag
								key={term.id}
								color={
									term?.taxonomy?.slug ===
									TaxonomySlug.CATEGORY
										? "blue"
										: term?.taxonomy?.slug ===
											  TaxonomySlug.LEVEL
											? "green"
											: "orange"
								}
								className="px-3 py-1 rounded-full  border-0">
								{term.name}
							</Tag>
						);
					})}
				</div>
			) : (
				<div className="flex gap-2 mb-4">
					<Tag
						color={"orange"}
						className="px-3 py-1 rounded-full  border-0">
						{"未设置分类"}
					</Tag>
				</div>
			)}
		</>
	);
};

export default TermInfo;
