You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
984 B
38 lines
984 B
4 years ago
|
import React from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import classnames from 'classnames';
|
||
8 years ago
|
|
||
5 years ago
|
const TabBar = (props) => {
|
||
4 years ago
|
const { tabs = [], onSelect, isActive } = props;
|
||
8 years ago
|
|
||
5 years ago
|
return (
|
||
|
<div className="tab-bar">
|
||
|
{tabs.map(({ key, content, description }) => (
|
||
4 years ago
|
<button
|
||
5 years ago
|
key={key}
|
||
|
className={classnames('tab-bar__tab pointer', {
|
||
|
'tab-bar__tab--active': isActive(key, content),
|
||
|
})}
|
||
|
onClick={() => onSelect(key)}
|
||
|
>
|
||
|
<div className="tab-bar__tab__content">
|
||
|
<div className="tab-bar__tab__content__title">{content}</div>
|
||
4 years ago
|
<div className="tab-bar__tab__content__description">
|
||
|
{description}
|
||
|
</div>
|
||
6 years ago
|
</div>
|
||
5 years ago
|
<div className="tab-bar__tab__caret" />
|
||
4 years ago
|
</button>
|
||
5 years ago
|
))}
|
||
|
</div>
|
||
4 years ago
|
);
|
||
|
};
|
||
8 years ago
|
|
||
7 years ago
|
TabBar.propTypes = {
|
||
7 years ago
|
isActive: PropTypes.func.isRequired,
|
||
7 years ago
|
tabs: PropTypes.array,
|
||
7 years ago
|
onSelect: PropTypes.func,
|
||
4 years ago
|
};
|
||
7 years ago
|
|
||
4 years ago
|
export default TabBar;
|