guild_front/src/components/Outstaffing/Outstaffing.js

79 lines
2.5 KiB
JavaScript
Raw Normal View History

import React, { useState } from 'react';
2021-08-17 12:38:12 +03:00
import { useSelector, useDispatch } from 'react-redux';
2021-06-01 15:25:01 +03:00
import style from './Outstaffing.module.css';
import OutstaffingBlock from './OutstaffingBlock';
2021-06-01 17:28:09 +03:00
import TagSelect from '../Select/TagSelect';
2021-08-17 12:38:12 +03:00
import { selectTags, getPositionId, setPositionId } from '../../redux/outstaffingSlice';
2021-07-02 16:02:47 +03:00
import front from '../../images/front_end.png';
import back from '../../images/back_end.png';
import design from '../../images/design.png';
2021-06-01 15:25:01 +03:00
2021-08-12 17:42:29 +03:00
2021-08-17 12:38:12 +03:00
const createSelectPositionHandler = ({ positionId, setPositionId, dispatch }) => id => {
if(id===positionId) {
dispatch(setPositionId(null));
2021-08-12 17:42:29 +03:00
} else {
2021-08-17 12:38:12 +03:00
dispatch(setPositionId(id));
2021-08-12 17:42:29 +03:00
}
}
2021-07-01 14:25:17 +03:00
const Outstaffing = () => {
2021-08-17 12:38:12 +03:00
const dispatch = useDispatch();
const positionId = useSelector(getPositionId)
2021-06-30 17:21:55 +03:00
const tagsArr = useSelector(selectTags);
2021-06-01 15:25:01 +03:00
2021-08-17 12:38:12 +03:00
const onSelectPosition = createSelectPositionHandler({ positionId, setPositionId, dispatch });
2021-06-01 15:25:01 +03:00
return (
<>
<section className={style.outstaffing}>
<div className="row">
<div className="col-12">
<div className={style.outstaffing__title}>
<h2>
<span>Аутстаффинг</span> it-персонала
</h2>
</div>
</div>
</div>
<div className="row">
2021-06-07 17:48:07 +03:00
<div className="col-12 col-xl-4">
2021-06-01 17:28:09 +03:00
<OutstaffingBlock
2021-08-05 16:44:49 +03:00
dataTags={tagsArr && tagsArr.flat().filter((tag) => tag.name === 'skills_front')}
2021-07-02 16:02:47 +03:00
img={front}
2021-08-18 15:56:24 +03:00
header="Frontend"
positionId='2'
2021-08-17 12:38:12 +03:00
isSelected={positionId==='2'}
2021-08-12 17:42:29 +03:00
onSelect={id=>onSelectPosition(id)}
2021-06-01 17:28:09 +03:00
/>
2021-06-01 15:25:01 +03:00
</div>
2021-06-07 17:48:07 +03:00
<div className="col-12 col-xl-4">
2021-06-01 17:28:09 +03:00
<OutstaffingBlock
2021-06-30 17:21:55 +03:00
dataTags={tagsArr.flat().filter((tag) => tag.name === 'skills_back')}
2021-07-02 16:02:47 +03:00
img={back}
2021-08-18 15:56:24 +03:00
header="Backend"
positionId='1'
2021-08-17 12:38:12 +03:00
isSelected={positionId==='1'}
2021-08-12 17:42:29 +03:00
onSelect={id=>onSelectPosition(id)}
2021-06-01 17:28:09 +03:00
/>
2021-06-01 15:25:01 +03:00
</div>
2021-06-07 17:48:07 +03:00
<div className="col-12 col-xl-4">
2021-06-01 17:28:09 +03:00
<OutstaffingBlock
2021-06-30 17:21:55 +03:00
dataTags={tagsArr.flat().filter((tag) => tag.name === 'skills_design')}
2021-07-02 16:02:47 +03:00
img={design}
2021-07-03 17:37:30 +03:00
header="Дизайн"
positionId='5'
2021-08-17 12:38:12 +03:00
isSelected={positionId==='5'}
2021-08-12 17:42:29 +03:00
onSelect={id=>onSelectPosition(id)}
2021-06-01 17:28:09 +03:00
/>
2021-06-01 15:25:01 +03:00
</div>
</div>
</section>
2021-07-01 14:25:17 +03:00
<TagSelect />
2021-06-01 15:25:01 +03:00
</>
);
};
export default Outstaffing;