Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6794 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
6794 stevensc 1
import React from 'react'
6905 stevensc 2
import { useLocation } from 'react-router-dom'
3
import AddIcon from '@mui/icons-material/Add'
6794 stevensc 4
import EditIcon from '@mui/icons-material/EditOutlined'
6905 stevensc 5
import IconButton from '@mui/material/IconButton'
6794 stevensc 6
 
7
const ProfileWidget = ({
6905 stevensc 8
  title = '',
9
  addUrl = '',
10
  onAdd = () => {},
11
  onEdit = () => {},
12
  justEdit = false,
13
  children,
6794 stevensc 14
}) => {
6905 stevensc 15
  const { pathname } = useLocation()
16
 
17
  return (
18
    <section className="experience__user-card">
19
      <div className="card__options-container">
20
        <h2>{title}</h2>
21
        {pathname.includes('edit') && (
22
          <div className="card__options-icons">
23
            {!justEdit && (
24
              <IconButton onClick={() => onAdd(title, addUrl)}>
25
                <AddIcon />
26
              </IconButton>
27
            )}
28
            <IconButton onClick={onEdit}>
29
              <EditIcon />
30
            </IconButton>
31
          </div>
32
        )}
33
      </div>
34
      {children}
35
    </section>
36
  )
6794 stevensc 37
}
38
 
6905 stevensc 39
export default ProfileWidget