29 lines
807 B
TypeScript
29 lines
807 B
TypeScript
|
|
import { Badge } from '@nice/ui/components/badge';
|
||
|
|
import { STATUS_STYLES } from '@/lib/articles/constants';
|
||
|
|
import { Article } from '@fenghuo/common';
|
||
|
|
|
||
|
|
interface ArticleStatusBadgeProps {
|
||
|
|
status: Article['status'];
|
||
|
|
isSticky?: boolean;
|
||
|
|
}
|
||
|
|
|
||
|
|
export function ArticleStatusBadge({ status, isSticky = false }: ArticleStatusBadgeProps) {
|
||
|
|
const style = STATUS_STYLES[status];
|
||
|
|
|
||
|
|
return (
|
||
|
|
<div className="flex items-center gap-1.5">
|
||
|
|
{isSticky && (
|
||
|
|
<Badge
|
||
|
|
variant="outline"
|
||
|
|
className="text-xs px-1.5 py-0.5 bg-primary/10 text-primary border-primary/30 dark:bg-primary/20 dark:text-primary-foreground dark:border-primary/40"
|
||
|
|
>
|
||
|
|
置顶
|
||
|
|
</Badge>
|
||
|
|
)}
|
||
|
|
<Badge variant={style.variant} className={`text-xs px-1.5 py-0.5 ${style.className}`}>
|
||
|
|
{style.label}
|
||
|
|
</Badge>
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|