morethanadiagnosis-hub/web/components/common/Checkbox.tsx
Claude 1c0680b1de
feat: implement frontend home screen with API navigation
- Built responsive home page with navigation to API docs
- Created feature cards highlighting API capabilities
- Configured Next.js for static export
- Updated nginx to serve frontend static files
- Added nginx service to docker-compose configurations
- Fixed TypeScript issues in auth components

Components updated:
- web/app/page.tsx: Complete home page redesign
- web/components/common/Checkbox.tsx: Support ReactNode labels
- web/components/common/Link.tsx: Add onClick handler support
- web/app/(auth)/reset-password/confirm/page.tsx: Suspense boundary

Infrastructure:
- backend/nginx.conf: Serve static files from /usr/share/nginx/html
- backend/docker-compose.yml: Added nginx service
- backend/docker-compose.prod.yml: Mount frontend build output
- web/next.config.js: Static export configuration

Job ID: MTAD-IMPL-2025-11-18-CL
2025-11-18 05:50:21 +00:00

50 lines
1.5 KiB
TypeScript

'use client'
import React from 'react'
export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
label?: React.ReactNode
error?: string
}
export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
({ label, error, className = '', id, ...props }, ref) => {
const checkboxId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`
const errorId = `${checkboxId}-error`
const hasError = Boolean(error)
const baseStyles = 'h-4 w-4 rounded border-gray-300 text-primary-600 focus:ring-primary-500 dark:border-gray-600 dark:bg-gray-800 dark:ring-offset-gray-900'
const errorStyles = hasError ? 'border-error-500' : ''
return (
<div className="flex items-start">
<div className="flex items-center h-5">
<input
ref={ref}
type="checkbox"
id={checkboxId}
className={`${baseStyles} ${errorStyles} ${className}`.trim()}
aria-invalid={hasError}
aria-describedby={hasError ? errorId : undefined}
{...props}
/>
</div>
{label && (
<div className="ml-3 text-sm">
<label htmlFor={checkboxId} className="text-gray-700 dark:text-gray-200">
{label}
</label>
{error && (
<p className="text-error-500 mt-1" id={errorId} role="alert">
{error}
</p>
)}
</div>
)}
</div>
)
}
)
Checkbox.displayName = 'Checkbox'