41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
|
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;
|