feat: 添加 EmptyPlaceholder 组件并更新相关页面
- 新增 EmptyPlaceholder 组件,用于统一处理空状态提示,提升用户体验。 - 更新多个页面(JsonTools、Jwt、QrCode、Timestamp)以使用 EmptyPlaceholder 组件,简化空状态的实现。 - 更新 README.md,添加 EmptyPlaceholder 组件的说明。
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Copy, Download } from 'lucide-react';
|
||||
import EmptyPlaceholder from '@/components/EmptyPlaceholder';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
@@ -26,17 +27,13 @@ const QrCodePreview = ({
|
||||
// 空状态下的虚线骨架屏
|
||||
if (!qrCodeDataUrl) {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'flex flex-col justify-center items-center min-h-[200px] border border-dashed border-input rounded-xl p-4 bg-muted/40',
|
||||
className,
|
||||
)}
|
||||
<EmptyPlaceholder
|
||||
className={cn('min-h-[200px] p-4', className)}
|
||||
messageClassName="text-sm text-muted-foreground max-w-none"
|
||||
{...props}
|
||||
>
|
||||
<p className="text-sm text-muted-foreground text-center">
|
||||
{placeholderText || '二维码将显示在这里'}
|
||||
</p>
|
||||
</div>
|
||||
{placeholderText || '二维码将显示在这里'}
|
||||
</EmptyPlaceholder>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user