staff_data/apps/web/src/app/main/path/components/TermInfo.tsx

41 lines
1.2 KiB
TypeScript
Raw Normal View History

2025-02-27 10:23:04 +08:00
import { Tag } from "antd";
import { TaxonomySlug } from "@nice/common";
const TermInfo = ({ path }) => {
console.log('xx',path?.terms);
return <>
{path?.terms && path?.terms?.length > 0 ? (
<div className="flex gap-2 mb-4">
{path?.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;