guild_front/src/components/Sidebar/Sidebar.js

38 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-05-27 17:44:11 +03:00
import React from 'react';
2021-06-18 17:16:08 +03:00
import { Link } from 'react-router-dom';
2021-07-14 17:13:23 +03:00
import maleBig from '../../images/medium_male_big.png';
2021-05-31 18:23:25 +03:00
import style from './Sidebar.module.css';
2021-05-27 17:44:11 +03:00
2021-08-11 17:42:56 +03:00
const getYearsString = (years) => {
2021-08-17 17:15:04 +03:00
let yearsString;
2021-08-11 17:42:56 +03:00
if (years%10 === 1) {
yearsString = 'год';
} else if (years === 11 || years === 12 || years === 13 || years === 14) {
yearsString = 'лет';
} else if (years%10 === 2 || years%10 === 3 || years%10 === 4) {
yearsString = 'года';
2021-08-17 17:15:04 +03:00
} else {
yearsString = 'лет';
2021-08-11 17:42:56 +03:00
}
return `${years} ${yearsString}`;
}
const Sidebar = ({ candidate }) => {
2021-05-27 17:44:11 +03:00
return (
<div className={style.candidateSidebar}>
<div className={style.candidateSidebar__info}>
2021-08-16 17:56:28 +03:00
<img src={candidate.photo} alt="" />
2021-08-11 17:42:56 +03:00
{ candidate && candidate.years_of_exp && <>
<p className={style.candidateSidebar__info__e}>Опыт работы</p>
<p className={style.candidateSidebar__info__y}>{getYearsString(candidate.years_of_exp)}</p>
</> }
2021-08-17 17:15:04 +03:00
<Link to={`/candidate/${candidate.id}/form`}>
2021-06-18 17:16:08 +03:00
<button className={style.candidateSidebar__info__btn}>Выбрать к собеседованию</button>
</Link>
2021-05-27 17:44:11 +03:00
</div>
</div>
);
};
export default Sidebar;