2020-09-03 02:38:29 +03:00
|
|
|
import * as React from "react";
|
|
|
|
import * as Constants from "~/common/constants";
|
|
|
|
|
|
|
|
import { css } from "@emotion/react";
|
|
|
|
|
|
|
|
const STYLES_TAB_GROUP = css`
|
2020-09-10 06:28:48 +03:00
|
|
|
margin: 44px 0px 24px 0px;
|
2020-09-03 02:38:29 +03:00
|
|
|
padding: 0 0 0 2px;
|
|
|
|
display: flex;
|
|
|
|
align-items: flex-start;
|
|
|
|
flex-direction: row;
|
|
|
|
box-sizing: border-box;
|
|
|
|
width: 100%;
|
2020-10-01 03:41:53 +03:00
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
|
|
@media (max-width: ${Constants.sizes.mobile}px) {
|
|
|
|
margin: 24px 0px 24px 0px;
|
|
|
|
}
|
2020-09-03 02:38:29 +03:00
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_TAB = css`
|
|
|
|
padding: 8px 8px 8px 0px;
|
|
|
|
margin-right: 24px;
|
|
|
|
display: inline-block;
|
2020-09-04 07:16:19 +03:00
|
|
|
font-family: ${Constants.font.medium};
|
2020-09-11 00:03:51 +03:00
|
|
|
font-size: ${Constants.typescale.lvl2};
|
2020-09-03 02:38:29 +03:00
|
|
|
user-select: none;
|
|
|
|
|
|
|
|
@media (max-width: ${Constants.sizes.mobile}px) {
|
|
|
|
margin-right: 12px;
|
2020-10-01 03:41:53 +03:00
|
|
|
font-size: ${Constants.typescale.lvl1};
|
2020-09-03 02:38:29 +03:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export class TabGroup extends React.Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2020-09-08 00:45:58 +03:00
|
|
|
<div css={STYLES_TAB_GROUP} style={this.props.style}>
|
2020-09-03 02:38:29 +03:00
|
|
|
{this.props.tabs.map((tab, i) => (
|
|
|
|
<div
|
|
|
|
css={STYLES_TAB}
|
|
|
|
key={tab}
|
|
|
|
style={{
|
2020-09-04 07:42:50 +03:00
|
|
|
color:
|
2020-09-08 00:45:58 +03:00
|
|
|
this.props.disabled || this.props.value === i
|
2020-09-04 07:42:50 +03:00
|
|
|
? Constants.system.black
|
|
|
|
: "rgba(0,0,0,0.25)",
|
2020-09-08 00:45:58 +03:00
|
|
|
cursor: this.props.disabled ? "auto" : "pointer",
|
|
|
|
...this.props.itemStyle,
|
2020-09-03 02:38:29 +03:00
|
|
|
}}
|
2020-09-08 00:45:58 +03:00
|
|
|
onClick={
|
|
|
|
this.props.disabled ? () => {} : () => this.props.onChange(i)
|
|
|
|
}
|
2020-09-03 02:38:29 +03:00
|
|
|
>
|
|
|
|
{tab}
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|