Each page.tsx was >500 LOC (610/602/596). Extracted React components to _components/ and custom hook to _hooks/ per-route, reducing all three page.tsx orchestrators to 107/229/120 LOC respectively. Zero behavior changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import React from 'react'
|
|
import Link from 'next/link'
|
|
|
|
export function QuickActionCard({
|
|
title,
|
|
description,
|
|
href,
|
|
onClick,
|
|
icon,
|
|
}: {
|
|
title: string
|
|
description: string
|
|
href?: string
|
|
onClick?: () => void
|
|
icon: React.ReactNode
|
|
}) {
|
|
const inner = (
|
|
<>
|
|
<div className="flex-shrink-0 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg text-blue-600 dark:text-blue-400">
|
|
{icon}
|
|
</div>
|
|
<div>
|
|
<h3 className="font-medium text-gray-900 dark:text-white">{title}</h3>
|
|
<p className="text-sm text-gray-500 dark:text-gray-400">{description}</p>
|
|
</div>
|
|
</>
|
|
)
|
|
|
|
if (onClick) {
|
|
return (
|
|
<button
|
|
onClick={onClick}
|
|
className="bg-white dark:bg-gray-800 rounded-lg shadow p-6 hover:shadow-md transition-shadow flex items-start gap-4 w-full text-left"
|
|
>
|
|
{inner}
|
|
</button>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<Link
|
|
href={href!}
|
|
className="bg-white dark:bg-gray-800 rounded-lg shadow p-6 hover:shadow-md transition-shadow flex items-start gap-4"
|
|
>
|
|
{inner}
|
|
</Link>
|
|
)
|
|
}
|