refactor: migrate frontend from shadcn/Tailwind to Mantine v9
Reescribe todos los componentes UI para usar Mantine v9 en lugar de shadcn/Tailwind. Elimina cn(), CVA, components.json, theme_provider custom y globals.css con Tailwind. Añade 25+ componentes nuevos (AppShell, AuthForm, DatePickerInput, Dropzone, etc.) y MantineProvider como wrapper estándar del sistema de temas. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import * as React from "react"
|
||||
import { cn } from "../core/cn"
|
||||
import * as React from 'react'
|
||||
import { Box, Text } from '@mantine/core'
|
||||
|
||||
interface FormFieldProps {
|
||||
label?: string
|
||||
@@ -15,26 +15,39 @@ function FormField({ label, helperText, error, children, className }: FormFieldP
|
||||
const helperId = `${id}-helper`
|
||||
const errorId = `${id}-error`
|
||||
|
||||
const describedBy = [helperText ? helperId : null, error ? errorId : null].filter(Boolean).join(" ") || undefined
|
||||
const describedBy = [helperText ? helperId : null, error ? errorId : null].filter(Boolean).join(' ') || undefined
|
||||
|
||||
const childWithProps = React.Children.map(children, (child) => {
|
||||
if (React.isValidElement(child)) {
|
||||
return React.cloneElement(child as React.ReactElement<Record<string, unknown>>, {
|
||||
id: inputId,
|
||||
"aria-invalid": error ? true : undefined,
|
||||
"aria-describedby": describedBy,
|
||||
'aria-invalid': error ? true : undefined,
|
||||
'aria-describedby': describedBy,
|
||||
error: error || undefined,
|
||||
})
|
||||
}
|
||||
return child
|
||||
})
|
||||
|
||||
return (
|
||||
<div className={cn("flex flex-col gap-1.5", className)}>
|
||||
{label && <label htmlFor={inputId} className="text-sm font-medium text-foreground">{label}</label>}
|
||||
<Box className={className}>
|
||||
{label && (
|
||||
<Text component="label" htmlFor={inputId} size="sm" fw={500} mb={4} display="block">
|
||||
{label}
|
||||
</Text>
|
||||
)}
|
||||
{childWithProps}
|
||||
{helperText && !error && <p id={helperId} className="text-sm text-muted-foreground">{helperText}</p>}
|
||||
{error && <p id={errorId} className="text-sm text-destructive">{error}</p>}
|
||||
</div>
|
||||
{helperText && !error && (
|
||||
<Text id={helperId} size="sm" c="dimmed" mt={4}>
|
||||
{helperText}
|
||||
</Text>
|
||||
)}
|
||||
{error && (
|
||||
<Text id={errorId} size="sm" c="red" mt={4}>
|
||||
{error}
|
||||
</Text>
|
||||
)}
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user