mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-28 23:06:37 +01:00
674bb131b2
* replacing deprecated constants * updating Box in player.js * created story for Player.js
60 lines
1.6 KiB
JavaScript
60 lines
1.6 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import classnames from 'classnames';
|
|
|
|
import { Icon, IconName, IconSize, Box } from '../../component-library';
|
|
import {
|
|
BorderRadius,
|
|
Color,
|
|
Display,
|
|
} from '../../../helpers/constants/design-system';
|
|
|
|
const TabBar = (props) => {
|
|
const { tabs = [], onSelect, isActive } = props;
|
|
|
|
return (
|
|
<div className="tab-bar">
|
|
{tabs.map(({ key, content, icon }) => (
|
|
<Box
|
|
as="button"
|
|
key={key}
|
|
paddingTop={5}
|
|
paddingBottom={5}
|
|
paddingLeft={4}
|
|
paddingRight={4}
|
|
className={classnames('tab-bar__tab pointer', {
|
|
'tab-bar__tab--active': isActive(key, content),
|
|
})}
|
|
onClick={() => onSelect(key)}
|
|
>
|
|
{isActive(key, content) && (
|
|
<Box
|
|
className="tab-bar__tab__selected-indicator"
|
|
borderRadius={BorderRadius.pill}
|
|
backgroundColor={Color.primaryDefault}
|
|
display={[Display.None, Display.Block]}
|
|
/>
|
|
)}
|
|
<div className="tab-bar__tab__content">
|
|
<div className="tab-bar__tab__content__icon">{icon}</div>
|
|
<div className="tab-bar__tab__content__title">{content}</div>
|
|
</div>
|
|
<Icon
|
|
name={IconName.ArrowRight}
|
|
size={IconSize.Sm}
|
|
className="tab-bar__tab__caret"
|
|
/>
|
|
</Box>
|
|
))}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
TabBar.propTypes = {
|
|
isActive: PropTypes.func.isRequired,
|
|
tabs: PropTypes.array,
|
|
onSelect: PropTypes.func,
|
|
};
|
|
|
|
export default TabBar;
|