guild_front/src/components/Outstaffing/Outstaffing.js

97 lines
2.7 KiB
JavaScript
Raw Normal View History

2021-11-30 17:00:58 +03:00
import React, { useState } from 'react'
import { useSelector, useDispatch } from 'react-redux'
import OutstaffingBlock from '../OutstaffingBlock/OutstaffingBlock'
import TagSelect from '../Select/TagSelect'
import {
selectTags,
getPositionId,
setPositionId
} from '../../redux/outstaffingSlice'
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-11-30 17:00:58 +03:00
import './outstaffing.scss'
2021-08-12 17:42:29 +03:00
2021-11-30 17:00:58 +03:00
const createSelectPositionHandler =
({ positionId, setPositionId, dispatch }) =>
(id) => {
if (id === positionId) {
dispatch(setPositionId(null))
} else {
dispatch(setPositionId(id))
}
2021-08-12 17:42:29 +03:00
}
2021-07-01 14:25:17 +03:00
const Outstaffing = () => {
2021-11-30 17:00:58 +03:00
const dispatch = useDispatch()
2021-08-17 12:38:12 +03:00
const positionId = useSelector(getPositionId)
2021-11-30 17:00:58 +03:00
const tagsArr = useSelector(selectTags)
2021-06-01 15:25:01 +03:00
2021-11-30 17:00:58 +03:00
const onSelectPosition = createSelectPositionHandler({
positionId,
setPositionId,
dispatch
})
2021-06-01 15:25:01 +03:00
return (
<>
2021-11-30 17:00:58 +03:00
<section className='outstaffing'>
<div className='row'>
<div className='col-12'>
<div className='outstaffing__title'>
<h2>
<span>Аутстаффинг</span> it-персонала
</h2>
2021-06-01 15:25:01 +03:00
</div>
</div>
2021-11-30 17:00:58 +03:00
</div>
2021-06-01 15:25:01 +03:00
2021-11-30 17:00:58 +03:00
<div className='row'>
<div className='col-12 col-xl-4'>
<OutstaffingBlock
dataTags={
tagsArr &&
tagsArr.flat().filter((tag) => tag.name === 'skills_front')
}
img={front}
header='Frontend'
positionId='2'
isSelected={positionId === '2'}
onSelect={(id) => onSelectPosition(id)}
/>
</div>
<div className='col-12 col-xl-4'>
<OutstaffingBlock
dataTags={
tagsArr &&
tagsArr.flat().filter((tag) => tag.name === 'skills_back')
}
img={back}
header='Backend'
positionId='1'
isSelected={positionId === '1'}
onSelect={(id) => onSelectPosition(id)}
/>
2021-06-01 15:25:01 +03:00
</div>
2021-11-30 17:00:58 +03:00
<div className='col-12 col-xl-4'>
<OutstaffingBlock
dataTags={
tagsArr &&
tagsArr.flat().filter((tag) => tag.name === 'skills_design')
}
img={design}
header='Дизайн'
positionId='5'
isSelected={positionId === '5'}
onSelect={(id) => onSelectPosition(id)}
/>
</div>
</div>
2021-06-01 15:25:01 +03:00
</section>
2021-07-01 14:25:17 +03:00
<TagSelect />
2021-06-01 15:25:01 +03:00
</>
2021-11-30 17:00:58 +03:00
)
}
2021-06-01 15:25:01 +03:00
2021-11-30 17:00:58 +03:00
export default Outstaffing