-
Notifications
You must be signed in to change notification settings - Fork 0
/
experienceBox.js
39 lines (36 loc) · 1.32 KB
/
experienceBox.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { useContext } from 'react'
import './experienceBox.css'
import { globalAuthContext } from '../../../state/state.js'
const ExperienceBox = ({ experienceItem, inRemoveMode, deleteExperienceItem, organization, field }) => {
const { signedUserData } = useContext(globalAuthContext)
const handleExperienceDelete = (e) => {
e.preventDefault()
deleteExperienceItem(experienceItem._id, organization._id)
}
return (
<div className='experience-box'>
<div className='experience-box-left-section'>
<p className='experience-box-company-name'>{organization.name}</p>
<img className='experience-box-company-logo' src={organization.logoPath} alt='company-logo' />
</div>
<div className='experience-box-right-section'>
<p className='experience-box-position'>{experienceItem[field.toLowerCase()]}</p>
<p className='experience-box-duration'>
{experienceItem.startYear} - {experienceItem.endYear}
</p>
</div>
{experienceItem.userId === signedUserData._id && (
<button
className='experience-box-remove-button'
onClick={handleExperienceDelete}
style={{
visibility: inRemoveMode ? 'visible' : 'hidden'
}}
>
X
</button>
)}
</div>
)
}
export default ExperienceBox