2020-07-21 15:14:58 +00:00
|
|
|
import React from 'react';
|
2020-08-17 18:21:37 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2020-07-21 15:14:58 +00:00
|
|
|
import styled from 'styled-components';
|
2020-08-11 21:03:09 +00:00
|
|
|
import { remSize, prop } from '../../theme';
|
2020-07-21 15:14:58 +00:00
|
|
|
import IconButton from './IconButton';
|
|
|
|
|
2020-08-17 18:21:37 +00:00
|
|
|
const BottomBarContent = styled.div`
|
2020-07-21 15:21:46 +00:00
|
|
|
padding: ${remSize(8)};
|
2020-08-17 18:21:37 +00:00
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(8,1fr);
|
2020-08-11 21:03:09 +00:00
|
|
|
|
2020-07-21 15:14:58 +00:00
|
|
|
svg {
|
|
|
|
max-height: ${remSize(32)};
|
|
|
|
}
|
2020-08-11 21:03:09 +00:00
|
|
|
|
|
|
|
path { fill: ${prop('primaryTextColor')} !important }
|
|
|
|
|
|
|
|
.inverted {
|
|
|
|
path { fill: ${prop('backgroundColor')} !important }
|
|
|
|
rect { fill: ${prop('primaryTextColor')} !important }
|
2020-07-21 15:14:58 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2020-08-17 18:21:37 +00:00
|
|
|
const ActionStrip = ({ actions }) => (
|
|
|
|
<BottomBarContent>
|
2020-08-17 18:45:55 +00:00
|
|
|
{actions.map(({
|
|
|
|
icon, aria, action, inverted
|
|
|
|
}) =>
|
2020-08-17 18:21:37 +00:00
|
|
|
(<IconButton
|
2020-08-17 18:45:55 +00:00
|
|
|
inverted={inverted}
|
|
|
|
className={inverted && 'inverted'}
|
2020-08-17 18:21:37 +00:00
|
|
|
icon={icon}
|
|
|
|
aria-label={aria}
|
|
|
|
key={`bottom-bar-${aria}`}
|
2020-08-28 18:02:07 +00:00
|
|
|
onClick={action}
|
2020-08-17 18:21:37 +00:00
|
|
|
/>))}
|
|
|
|
</BottomBarContent>);
|
2020-07-21 15:14:58 +00:00
|
|
|
|
2020-08-17 18:21:37 +00:00
|
|
|
ActionStrip.propTypes = {
|
|
|
|
actions: PropTypes.arrayOf(PropTypes.shape({
|
2020-08-18 20:24:20 +00:00
|
|
|
icon: PropTypes.any,
|
2020-08-17 18:21:37 +00:00
|
|
|
aria: PropTypes.string.isRequired,
|
2020-08-17 18:45:55 +00:00
|
|
|
action: PropTypes.func.isRequired,
|
|
|
|
inverted: PropTypes.bool
|
2020-08-17 18:21:37 +00:00
|
|
|
})).isRequired
|
2020-07-21 15:14:58 +00:00
|
|
|
};
|
2020-08-17 18:21:37 +00:00
|
|
|
|
|
|
|
export default ActionStrip;
|