guild_front/src/components/Outstaffing/Outstaffing.js

79 lines
2.6 KiB
JavaScript
Raw Normal View History

2021-06-07 17:48:07 +03:00
import React, { useState } from 'react';
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-06-01 15:25:01 +03:00
2021-06-15 17:08:06 +03:00
const Outstaffing = ({ onhandleTabBar, selected, tabs, tags }) => {
2021-06-01 17:28:09 +03:00
const [selectedItems, setSelectedItems] = useState([]);
2021-06-01 15:25:01 +03:00
2021-06-02 14:04:26 +03:00
const handleBlockClick = (item) => {
if (!selectedItems.find((el) => item === el.value)) {
setSelectedItems([...selectedItems, { value: item, label: item }]);
2021-06-01 17:28:09 +03:00
}
2021-06-01 15:25:01 +03:00
};
const handleSubmit = () => {
2021-06-01 17:28:09 +03:00
const filterItems = JSON.stringify(selectedItems.map((item) => item.value));
2021-06-01 15:25:01 +03:00
alert(`Back-end: ${filterItems}`);
2021-06-01 17:28:09 +03:00
setSelectedItems([]);
2021-06-01 15:25:01 +03:00
};
return (
<>
<section className={style.outstaffing}>
<div className="container">
<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-06-07 17:48:07 +03:00
data={tabs.find((item) => item.name === 'Frontend')}
2021-06-15 17:08:06 +03:00
dataTags={tags.flat().filter((tag) => tag.name === 'skills_front')}
2021-06-02 14:04:26 +03:00
onClick={(item) => handleBlockClick(item)}
2021-06-07 17:48:07 +03:00
onTabBarClick={(name) => onhandleTabBar(name)}
selected={selected === 'Frontend'}
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-07 17:48:07 +03:00
data={tabs.find((item) => item.name === 'Backend')}
2021-06-15 17:08:06 +03:00
dataTags={tags.flat().filter((tag) => tag.name === 'skills_back')}
2021-06-02 14:04:26 +03:00
onClick={(item) => handleBlockClick(item)}
2021-06-07 17:48:07 +03:00
onTabBarClick={(name) => onhandleTabBar(name)}
selected={selected === 'Backend'}
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-07 17:48:07 +03:00
data={tabs.find((item) => item.name === 'Design')}
2021-06-15 17:08:06 +03:00
dataTags={tags.flat().filter((tag) => tag.name === 'skills_design')}
2021-06-02 14:04:26 +03:00
onClick={(item) => handleBlockClick(item)}
2021-06-07 17:48:07 +03:00
onTabBarClick={(name) => onhandleTabBar(name)}
selected={selected === 'Design'}
2021-06-01 17:28:09 +03:00
/>
2021-06-01 15:25:01 +03:00
</div>
</div>
</div>
</section>
2021-06-01 17:28:09 +03:00
<TagSelect
2021-06-15 17:08:06 +03:00
options={tags}
2021-06-01 17:28:09 +03:00
selectedItems={selectedItems}
tagSubmit={handleSubmit}
setSelectedItems={setSelectedItems}
/>
2021-06-01 15:25:01 +03:00
</>
);
};
export default Outstaffing;