Added components for web setup

This commit is contained in:
Ildar Kamalov
2019-01-18 20:17:48 +03:00
committed by Eugene Bujak
parent 71259c5f19
commit 5349ec76fd
31 changed files with 1144 additions and 15 deletions

View File

@@ -0,0 +1,41 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
class Tab extends Component {
handleClick = () => {
this.props.onClick(this.props.label);
}
render() {
const {
activeTab,
label,
} = this.props;
const tabClass = classnames({
tab__control: true,
'tab__control--active': activeTab === label,
});
return (
<div
className={tabClass}
onClick={this.handleClick}
>
<svg className="tab__icon">
<use xlinkHref={`#${label.toLowerCase()}`} />
</svg>
{label}
</div>
);
}
}
Tab.propTypes = {
activeTab: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired,
};
export default Tab;