guild_front/src/components/Sidebar/Sidebar.js

54 lines
1.6 KiB
JavaScript
Raw Normal View History

2021-09-15 17:07:28 +03:00
import React from 'react'
import { Link } from 'react-router-dom'
import { Achievement } from '../Achievement/Achievement'
import maleBig from '../../images/medium_male_big.png'
import './sidebar.scss'
2021-05-27 17:44:11 +03:00
2021-08-11 17:42:56 +03:00
const getYearsString = (years) => {
2021-09-15 17:07:28 +03:00
let yearsString
if (years % 10 === 1) {
yearsString = 'год'
2021-08-11 17:42:56 +03:00
} else if (years === 11 || years === 12 || years === 13 || years === 14) {
2021-09-15 17:07:28 +03:00
yearsString = 'лет'
} else if (years % 10 === 2 || years % 10 === 3 || years % 10 === 4) {
yearsString = 'года'
2021-08-17 17:15:04 +03:00
} else {
2021-09-15 17:07:28 +03:00
yearsString = 'лет'
2021-08-11 17:42:56 +03:00
}
2021-09-15 17:07:28 +03:00
return `${years} ${yearsString}`
2021-08-11 17:42:56 +03:00
}
const Sidebar = ({ candidate }) => {
2021-09-15 17:07:28 +03:00
console.log('c', candidate)
2021-05-27 17:44:11 +03:00
return (
2021-09-15 17:07:28 +03:00
<div className='candidateSidebar'>
<div className='candidateSidebar__info'>
<img src={candidate.photo} alt='' />
{candidate && candidate.years_of_exp && (
<>
<p className='candidateSidebar__experience-title'>Опыт работы</p>
<p className='candidateSidebar__experience'>
{getYearsString(candidate.years_of_exp)}
</p>
</>
)}
<Link to={`/candidate/${candidate.id}/form`}>
<button className='candidateSidebar__select'>
Выбрать к собеседованию
</button>
2021-06-18 17:16:08 +03:00
</Link>
2021-09-15 17:07:28 +03:00
<div className='candidateSidebar__achievements'>
{candidate &&
candidate.achievements &&
candidate.achievements.map((item) => {
return <Achievement achievement={item.achievement} />
})}
</div>
2021-05-27 17:44:11 +03:00
</div>
</div>
2021-09-15 17:07:28 +03:00
)
}
2021-05-27 17:44:11 +03:00
2021-09-15 17:07:28 +03:00
export default Sidebar