guild_front/src/components/Outstaffing/OutstaffingBlock.js

45 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-06-02 14:04:26 +03:00
import React from 'react';
2021-06-01 15:25:01 +03:00
import style from './Outstaffing.module.css';
2021-06-15 17:08:06 +03:00
const OutstaffingBlock = ({ dataTags = [], data = {}, onClick, onTabBarClick, selected }) => {
const { header, img, text, name } = data;
2021-06-09 13:12:01 +03:00
let classes;
2021-06-07 17:48:07 +03:00
2021-06-15 17:08:06 +03:00
dataTags.forEach((el) => {
if (el.name === 'skills_back') {
classes = style.back;
} else if (el.name === 'skills_design') {
classes = style.des;
} else if (el.name === 'skills_front') {
classes = style.front;
}
});
2021-06-07 17:48:07 +03:00
2021-06-01 15:25:01 +03:00
return (
<div className={style.outstaffing__box}>
2021-06-07 17:48:07 +03:00
<div
className={`${style.outstaffing__box__img} ${selected ? style.border : null}`}
onClick={() => onTabBarClick(name)}
>
<h3>{header}</h3>
2021-06-09 13:12:01 +03:00
<img className={classes} src={img} alt="img" />
2021-06-07 17:48:07 +03:00
</div>
2021-06-09 13:12:01 +03:00
<div className={`${selected ? style.mobile__block : style.mobile__none}`}>
2021-06-10 18:17:50 +03:00
<p className={style.outstaffing__box__text}>{text}</p>
2021-06-15 17:08:06 +03:00
{dataTags && (
2021-06-07 17:48:07 +03:00
<ul className={style.items}>
2021-06-15 17:08:06 +03:00
{dataTags.map((item) => (
<li key={item.id} onClick={() => onClick(item.value)}>
{item.value}
2021-06-07 17:48:07 +03:00
</li>
))}
</ul>
)}
</div>
2021-06-01 15:25:01 +03:00
</div>
);
};
export default OutstaffingBlock;