website-01/components/admin/TableToolbar.tsx
2026-06-22 14:43:46 +08:00

32 lines
895 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use client';
import { ReactNode } from 'react';
import { cn } from '@/lib/utils';
interface TableToolbarProps {
/** 左侧:搜索/筛选区 */
left?: ReactNode;
/** 右侧:操作按钮区 */
right?: ReactNode;
className?: string;
}
/**
* 标准列表工具条:左侧搜索筛选 + 右侧操作按钮,同一行布局。
* 左侧搜索区强制不换行(保持一行展示);
* 外层保留 flex-wrap极窄屏时右侧操作按钮可降级到下一行。
*/
export function TableToolbar({ left, right, className }: TableToolbarProps) {
return (
<div
className={cn(
'mb-4 flex flex-wrap items-center justify-between gap-2',
className,
)}
>
<div className="flex items-center gap-2 whitespace-nowrap">{left}</div>
{right && <div className="flex items-center gap-2 whitespace-nowrap">{right}</div>}
</div>
);
}