Split 1130-LOC document-generator page into _components and _constants modules. page.tsx now 243 LOC (wire-up only). Behavior preserved. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
27 lines
926 B
TypeScript
27 lines
926 B
TypeScript
'use client'
|
|
|
|
import { LicenseType, LICENSE_TYPE_LABELS } from '@/lib/sdk/types'
|
|
|
|
export default function LicenseBadge({
|
|
licenseId,
|
|
small = false,
|
|
}: {
|
|
licenseId: LicenseType | null
|
|
small?: boolean
|
|
}) {
|
|
if (!licenseId) return null
|
|
const colors: Partial<Record<LicenseType, string>> = {
|
|
public_domain: 'bg-green-100 text-green-700 border-green-200',
|
|
cc0: 'bg-green-100 text-green-700 border-green-200',
|
|
unlicense: 'bg-green-100 text-green-700 border-green-200',
|
|
mit: 'bg-blue-100 text-blue-700 border-blue-200',
|
|
cc_by_4: 'bg-purple-100 text-purple-700 border-purple-200',
|
|
reuse_notice: 'bg-orange-100 text-orange-700 border-orange-200',
|
|
}
|
|
return (
|
|
<span className={`${small ? 'px-1.5 py-0.5 text-[10px]' : 'px-2 py-1 text-xs'} rounded border ${colors[licenseId] || 'bg-gray-100 text-gray-600 border-gray-200'}`}>
|
|
{LICENSE_TYPE_LABELS[licenseId] || licenseId}
|
|
</span>
|
|
)
|
|
}
|