Rev 3719 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
import React from 'react';
import { IconButton, Typography } from '@mui/material';
import Edit from '@mui/icons-material/Edit';
import { useModal } from '@shared/hooks';
import { Card, CardContent, CardHeader } from '@shared/components';
import { TypeForm } from './TypeForm';
export function Type({ uuid, type, types, updateGroup, edit }) {
const { showModal, closeModal } = useModal();
const handleEdit = () => {
showModal(
'Tipo',
<TypeForm
uuid={uuid}
type={type}
types={types}
onSubmit={(newType) => {
updateGroup((prev) => ({ ...prev, group_type: newType }));
closeModal();
}}
/>
);
};
return (
<Card>
<CardHeader
title='Tipo'
renderAction={() => {
if (!edit) return;
return (
<IconButton onClick={handleEdit}>
<Edit />
</IconButton>
);
}}
/>
<CardContent>
<Typography>{type}</Typography>
</CardContent>
</Card>
);
}