import type { Meta, StoryObj } from '@storybook/react';
import React from 'react';
import {
BarChart2,
Bell,
Briefcase,
Download,
FileText,
Globe,
LayoutDashboard,
Lock,
MoreHorizontal,
Package,
Plus,
RefreshCw,
Share2,
Shield,
Sparkles,
Users,
Zap,
} from 'lucide-react';
import { Button } from '../../ui/button';
import { ChartCard, ChartConfig, DashboardBarChart, DashboardLineChart } from '../../ui/chart';
import { ActivityCard } from './ActivityCard';
import { ActivityCardSkeleton } from './ActivityCardSkeleton';
import { FeatureCard } from './FeatureCard';
import { FeatureCardSkeleton } from './FeatureCardSkeleton';
import { NotificationCard } from './NotificationCard';
import { NotificationCardSkeleton } from './NotificationCardSkeleton';
import { ProfileCard } from './ProfileCard';
import { ProfileCardSkeleton } from './ProfileCardSkeleton';
import { ProjectCard } from './ProjectCard';
import { ProjectCardSkeleton } from './ProjectCardSkeleton';
import { QuickActionCard } from './QuickActionCard';
import { QuickActionCardSkeleton } from './QuickActionCardSkeleton';
const meta: Meta = {
title: 'Blocks/Card Patterns',
decorators: [
Story => (
),
],
};
export default meta;
// ─── ActivityCard ─────────────────────────────────────────────────────────────
const ACTIVITY_ITEMS = [
{
id: '1',
user: { name: 'Ana Souza', initials: 'AS' },
action: 'criou o projeto',
target: 'Xertica Dashboard',
time: 'há 2 min',
type: 'create' as const,
},
{
id: '2',
user: { name: 'Bruno Lima', initials: 'BL' },
action: 'atualizou',
target: 'componente Button',
time: 'há 8 min',
type: 'update' as const,
},
{
id: '3',
user: { name: 'Carla Rocha', initials: 'CR' },
action: 'comentou em',
target: 'PR #42',
time: 'há 15 min',
type: 'comment' as const,
},
{
id: '4',
user: { name: 'Diego Ferraz', initials: 'DF' },
action: 'fez deploy de',
target: 'v2.1.0',
time: 'há 1h',
type: 'deploy' as const,
},
{
id: '5',
user: { name: 'Elena Moura', initials: 'EM' },
action: 'removeu',
target: 'badge legado',
time: 'há 2h',
type: 'delete' as const,
},
];
export const Activity: StoryObj = {
render: () => (
}
className="max-w-md"
/>
),
};
// ─── ProfileCard ──────────────────────────────────────────────────────────────
export const Profile: StoryObj = {
render: () => (
),
};
// ─── ProjectCard ──────────────────────────────────────────────────────────────
const MEMBERS = [
{ name: 'Ana', initials: 'AS' },
{ name: 'Bruno', initials: 'BL' },
{ name: 'Carla', initials: 'CR' },
{ name: 'Diego', initials: 'DF' },
{ name: 'Elena', initials: 'EM' },
];
export const Project: StoryObj = {
render: () => (
),
};
// ─── QuickActionCard ──────────────────────────────────────────────────────────
export const QuickActions: StoryObj = {
render: () => (
}
actionLabel="Criar Relatório"
/>
}
actionLabel="Convidar"
actionVariant="outline"
badge="Novo"
badgeVariant="success"
/>
}
actionLabel="Exportar"
actionVariant="secondary"
/>
}
actionLabel="Configurar"
badge="Pro"
badgeVariant="warning"
/>
}
actionLabel="Compartilhar"
actionVariant="outline"
/>
}
actionLabel="Criar Projeto"
badge="Beta"
badgeVariant="info"
/>
),
};
// ─── NotificationCard ─────────────────────────────────────────────────────────
const NOTIFICATIONS = [
{
id: '1',
title: 'Deploy concluído',
message: 'v2.1.0 foi publicado com sucesso em produção.',
time: 'há 2 min',
read: false,
type: 'success' as const,
},
{
id: '2',
title: 'Revisão solicitada',
message: 'Ana pediu revisão no PR #42: Novos tokens de cor.',
time: 'há 10 min',
read: false,
type: 'info' as const,
},
{
id: '3',
title: 'Erro em produção',
message: 'Serviço de auth com falha intermitente — 503.',
time: 'há 1h',
read: false,
type: 'error' as const,
},
{
id: '4',
title: 'Licença expirando',
message: 'Sua licença Pro expira em 7 dias. Renove para continuar.',
time: 'há 3h',
read: true,
type: 'warning' as const,
},
];
export const Notifications: StoryObj = {
render: () => (
{}}
onViewAll={() => {}}
className="max-w-sm"
/>
),
};
// ─── ChartCard ────────────────────────────────────────────────────────────────
const REVENUE_DATA = [
{ month: 'Jan', receita: 18000, despesa: 12000 },
{ month: 'Fev', receita: 22000, despesa: 14000 },
{ month: 'Mar', receita: 19500, despesa: 13500 },
{ month: 'Abr', receita: 27000, despesa: 15000 },
{ month: 'Mai', receita: 31000, despesa: 17500 },
{ month: 'Jun', receita: 28500, despesa: 16000 },
];
const REVENUE_CONFIG: ChartConfig = {
receita: { label: 'Receita', color: 'var(--chart-1)' },
despesa: { label: 'Despesa', color: 'var(--chart-5)' },
};
const CHART_SERIES = [
{ key: 'receita', label: 'Receita' },
{ key: 'despesa', label: 'Despesa' },
];
export const Chart: StoryObj = {
render: () => (
}
footer="Dados atualizados em tempo real via API financeira."
className="max-w-xl w-full"
contentClassName="h-[260px]"
>
),
};
// ─── Dashboard completo ───────────────────────────────────────────────────────
const LINE_DATA = [
{ dia: 'Seg', usuarios: 240 },
{ dia: 'Ter', usuarios: 380 },
{ dia: 'Qua', usuarios: 310 },
{ dia: 'Qui', usuarios: 470 },
{ dia: 'Sex', usuarios: 520 },
{ dia: 'Sáb', usuarios: 290 },
{ dia: 'Dom', usuarios: 180 },
];
const LINE_CONFIG: ChartConfig = {
usuarios: { label: 'Usuários', color: 'var(--chart-1)' },
};
export const DashboardLayout: StoryObj = {
render: () => (
}
actionLabel="Criar"
/>
}
actionLabel="Convidar"
actionVariant="outline"
/>
}
actionLabel="Abrir"
actionVariant="secondary"
badge="Novo"
badgeVariant="success"
/>
),
};
// ─── FeatureCard ──────────────────────────────────────────────────────────────
export const Feature: StoryObj = {
render: () => (
}
color="chart-2"
badge="Novo"
actionLabel="Visualizar"
/>
),
};
export const FeatureColors: StoryObj = {
render: () => (
}
color="primary"
badge="Popular"
badgeVariant="default"
actionLabel="Abrir"
/>
}
color="chart-1"
actionLabel="Explorar"
/>
}
color="chart-2"
badge="Beta"
badgeVariant="warning"
actionLabel="Configurar"
/>
}
color="chart-3"
badge="Pro"
badgeVariant="info"
actionLabel="Ativar"
/>
}
color="chart-4"
actionLabel="Gerenciar"
/>
}
color="chart-5"
actionLabel="Publicar"
/>
),
};
export const FeatureSemanticColors: StoryObj = {
render: () => (
}
color="success"
actionLabel="Configurar"
/>
}
color="info"
actionLabel="Ver Dados"
/>
}
color="warning"
badge="Atenção"
badgeVariant="warning"
actionLabel="Revisar"
/>
}
color="destructive"
badge="Restrito"
badgeVariant="destructive"
actionLabel="Solicitar"
/>
),
};
// ─── Skeletons ────────────────────────────────────────────────────────────────
type SkeletonStory = StoryObj;
/** All card-pattern skeletons side by side to compare proportions with their data counterparts. */
export const SkeletonShowcase: SkeletonStory = {
name: 'Skeletons / All Card Patterns',
render: () => (
),
};
export const ActivitySkeleton: SkeletonStory = {
name: 'Skeletons / ActivityCard',
render: () => (
),
};
export const ProfileSkeleton: SkeletonStory = {
name: 'Skeletons / ProfileCard',
render: () => (
),
};
export const ProjectSkeleton: SkeletonStory = {
name: 'Skeletons / ProjectCard',
render: () => (
),
};
export const NotificationSkeleton: SkeletonStory = {
name: 'Skeletons / NotificationCard',
render: () => (
),
};
export const QuickActionSkeleton: SkeletonStory = {
name: 'Skeletons / QuickActionCard',
render: () => (
),
};
export const FeatureSkeleton: SkeletonStory = {
name: 'Skeletons / FeatureCard',
render: () => (
),
};