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