Proyectos de Subversion LeadersLinked - SPA

Rev

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 { IndustryForm } from './IndustryForm';

export function Industry({ uuid, industry, industries, updateGroup, edit }) {
  const { showModal, closeModal } = useModal();

  const handleEdit = () => {
    showModal(
      'Industria',
      <IndustryForm
        uuid={uuid}
        industry={industry}
        industries={industries}
        onSubmit={(newIndustry) => {
          updateGroup((prev) => ({ ...prev, industry: newIndustry }));
          closeModal();
        }}
      />
    );
  };

  return (
    <Card>
      <CardHeader
        title='Industria'
        renderAction={() => {
          if (!edit) return;
          return (
            <IconButton onClick={handleEdit}>
              <Edit />
            </IconButton>
          );
        }}
      />

      <CardContent>
        <Typography>{industry}</Typography>
      </CardContent>
    </Card>
  );
}

export default Industry;