casualroom/apps/fenghuo/web/lib/articles/constants.ts

59 lines
2.1 KiB
TypeScript
Executable File

import {
IconFileText,
IconEye,
IconEdit,
IconTrash,
IconArchive,
IconFolder,
} from '@tabler/icons-react';
import { SortOption, BatchAction } from './types.js';
// 默认分页大小
export const DEFAULT_PAGE_SIZE = 10;
// 排序选项
export const SORT_OPTIONS: SortOption[] = [
{ value: 'created-desc', label: '创建时间 (新到旧)' },
{ value: 'created-asc', label: '创建时间 (旧到新)' },
{ value: 'published-desc', label: '发布时间 (新到旧)' },
{ value: 'published-asc', label: '发布时间 (旧到新)' },
{ value: 'title-asc', label: '标题 (A-Z)' },
{ value: 'title-desc', label: '标题 (Z-A)' },
{ value: 'views-desc', label: '浏览量 (高到低)' },
{ value: 'views-asc', label: '浏览量 (低到高)' },
];
// 批量操作选项
export const BATCH_ACTIONS: BatchAction[] = [
{ value: 'publish', label: '发布', icon: IconEye },
{ value: 'draft', label: '转为草稿', icon: IconEdit },
{ value: 'archive', label: '归档', icon: IconArchive },
{ value: 'delete', label: '删除', icon: IconTrash },
];
// 状态样式配置
export const STATUS_STYLES = {
published: {
variant: 'default' as const,
label: '已发布',
className: 'bg-primary/10 text-primary border-primary/20 hover:bg-primary/15 dark:bg-primary/20 dark:text-primary-foreground dark:border-primary/30',
},
draft: {
variant: 'secondary' as const,
label: '草稿',
className: 'bg-muted text-muted-foreground border-border hover:bg-muted/80 dark:bg-muted dark:text-muted-foreground dark:border-border',
},
archived: {
variant: 'outline' as const,
label: '已归档',
className: 'bg-card text-foreground border-border hover:bg-muted/50 dark:bg-card dark:text-foreground dark:border-border',
},
deleted: {
variant: 'destructive' as const,
label: '已删除',
className: 'bg-destructive/10 text-destructive border-destructive/20 hover:bg-destructive/15 dark:bg-destructive/20 dark:text-destructive-foreground dark:border-destructive/30',
},
} as const;