feat(app): editor Général, Références and Vertèbres tabs, delete with dependents
This commit is contained in:
1 parent
6aba9711f0
commit
d163b2ce9a
24 files changed
+2239
-12
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import FormField, { fieldDescribedBy } from '@/components/ui/FormField'
|
||||
import Input from '@/components/ui/Input'
|
||||
import Textarea from '@/components/ui/Textarea'
|
||||
|
||||
/**
|
||||
* A controlled field of a creation form: it never commits, the form's own button does
|
||||
* (BDR-050). The committed fields of existing elements are `TextField`.
|
||||
*/
|
||||
export default function DraftField({
|
||||
id,
|
||||
label,
|
||||
value,
|
||||
onChange,
|
||||
multiline,
|
||||
hint,
|
||||
error,
|
||||
}: {
|
||||
id: string
|
||||
label: string
|
||||
value: string
|
||||
onChange: (value: string) => void
|
||||
multiline?: boolean
|
||||
hint?: string
|
||||
error?: string
|
||||
}) {
|
||||
const shared = {
|
||||
id,
|
||||
value,
|
||||
onChange: (e: { target: { value: string } }) => onChange(e.target.value),
|
||||
'aria-invalid': Boolean(error),
|
||||
'aria-describedby': fieldDescribedBy(id, hint, error),
|
||||
}
|
||||
return (
|
||||
<FormField id={id} label={label} hint={hint} error={error}>
|
||||
{multiline ? <Textarea {...shared} /> : <Input {...shared} />}
|
||||
</FormField>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { useT } from '@/i18n/useT'
|
||||
import ActionButton from './ActionButton'
|
||||
|
||||
/** ↑ / ↓ for a list row: one `move` per press; absent while read-only. */
|
||||
export default function MoveButtons({
|
||||
index,
|
||||
count,
|
||||
readOnly,
|
||||
onMove,
|
||||
}: {
|
||||
index: number
|
||||
count: number
|
||||
readOnly: boolean
|
||||
onMove: (position: number) => void
|
||||
}) {
|
||||
const t = useT()
|
||||
return (
|
||||
<>
|
||||
<ActionButton
|
||||
readOnly={readOnly}
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
aria-label={t('editor.action.move_up')}
|
||||
disabled={index === 0}
|
||||
onClick={() => onMove(index - 1)}
|
||||
>
|
||||
↑
|
||||
</ActionButton>
|
||||
<ActionButton
|
||||
readOnly={readOnly}
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
aria-label={t('editor.action.move_down')}
|
||||
disabled={index >= count - 1}
|
||||
onClick={() => onMove(index + 1)}
|
||||
>
|
||||
↓
|
||||
</ActionButton>
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user