non templatized card disabled

This commit is contained in:
laxmanhalaki 2025-12-30 09:46:17 +05:30
parent b9a8c5bf52
commit c7ffc475f9

View File

@ -59,23 +59,29 @@ export function TemplateSelectionStep({
className="w-full max-w-6xl grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-8" className="w-full max-w-6xl grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-8"
data-testid="template-selection-grid" data-testid="template-selection-grid"
> >
{templates.map((template) => ( {templates.map((template) => {
<motion.div const isComingSoon = template.id === 'existing-template';
key={template.id} const isDisabled = isComingSoon;
whileHover={{ scale: 1.03 }}
whileTap={{ scale: 0.98 }} return (
transition={{ type: "spring", stiffness: 300, damping: 20 }} <motion.div
data-testid={`template-card-${template.id}`} key={template.id}
> whileHover={!isDisabled ? { scale: 1.03 } : {}}
<Card whileTap={!isDisabled ? { scale: 0.98 } : {}}
className={`cursor-pointer h-full transition-all duration-300 border-2 ${ transition={{ type: "spring", stiffness: 300, damping: 20 }}
selectedTemplate?.id === template.id data-testid={`template-card-${template.id}`}
? 'border-blue-500 shadow-xl bg-blue-50/50 ring-2 ring-blue-200'
: 'border-gray-200 hover:border-blue-300 hover:shadow-lg'
}`}
onClick={() => onSelectTemplate(template)}
data-testid={`template-card-${template.id}-clickable`}
> >
<Card
className={`h-full transition-all duration-300 border-2 ${
isDisabled
? 'border-gray-200 bg-gray-50/50 opacity-85 cursor-not-allowed'
: selectedTemplate?.id === template.id
? 'border-blue-500 shadow-xl bg-blue-50/50 ring-2 ring-blue-200 cursor-pointer'
: 'border-gray-200 hover:border-blue-300 hover:shadow-lg cursor-pointer'
}`}
onClick={!isDisabled ? () => onSelectTemplate(template) : undefined}
data-testid={`template-card-${template.id}-clickable`}
>
<CardHeader className="space-y-4 pb-4"> <CardHeader className="space-y-4 pb-4">
<div className="flex items-start justify-between"> <div className="flex items-start justify-between">
<div <div
@ -108,9 +114,20 @@ export function TemplateSelectionStep({
)} )}
</div> </div>
<div className="text-left"> <div className="text-left">
<CardTitle className="text-xl mb-2" data-testid={`template-card-${template.id}-name`}> <div className="flex items-start justify-between gap-2 mb-2">
{template.name} <CardTitle className="text-xl" data-testid={`template-card-${template.id}-name`}>
</CardTitle> {template.name}
</CardTitle>
{isComingSoon && (
<Badge
variant="outline"
className="text-xs bg-yellow-100 text-yellow-700 border-yellow-300 font-semibold"
data-testid={`template-card-${template.id}-coming-soon-badge`}
>
Coming Soon
</Badge>
)}
</div>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Badge variant="secondary" className="text-xs" data-testid={`template-card-${template.id}-category`}> <Badge variant="secondary" className="text-xs" data-testid={`template-card-${template.id}-category`}>
{template.category} {template.category}
@ -140,7 +157,8 @@ export function TemplateSelectionStep({
</CardContent> </CardContent>
</Card> </Card>
</motion.div> </motion.div>
))} );
})}
</div> </div>
{/* Template Details Card */} {/* Template Details Card */}