diff --git a/src/components/asignaturas/detalle/BibliographyItem.tsx b/src/components/asignaturas/detalle/BibliographyItem.tsx new file mode 100644 index 0000000..21c5bde --- /dev/null +++ b/src/components/asignaturas/detalle/BibliographyItem.tsx @@ -0,0 +1,84 @@ +import { useState } from 'react' +import { Textarea } from '@/components/ui/textarea' +import { Button } from '@/components/ui/button' +import { Pencil, BookOpen } from 'lucide-react' +import { cn } from '@/lib/utils' + +type Props = { + value: string + onSave: (value: string) => void +} + +export function BibliographyItem({ value, onSave }: Props) { + const [isEditing, setIsEditing] = useState(false) + const [draft, setDraft] = useState(value) + + function handleCancel() { + setDraft(value) + setIsEditing(false) + } + + function handleSave() { + onSave(draft) + setIsEditing(false) + } + + return ( +
+
+ + +
+ {!isEditing ? ( + <> +

{value}

+ + + + ) : ( + <> +