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-07-21 15:25:22 +00:00
|
|
|
import { remSize } 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`
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(8,1fr);
|
2020-07-21 15:21:46 +00:00
|
|
|
padding: ${remSize(8)};
|
2020-07-21 15:14:58 +00:00
|
|
|
|
|
|
|
svg {
|
|
|
|
max-height: ${remSize(32)};
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2020-08-17 18:21:37 +00:00
|
|
|
const ActionStrip = ({ actions }) => (
|
|
|
|
<BottomBarContent>
|
|
|
|
{actions.map(({ icon, aria, action }) =>
|
|
|
|
(<IconButton
|
|
|
|
icon={icon}
|
|
|
|
aria-label={aria}
|
|
|
|
key={`bottom-bar-${aria}`}
|
|
|
|
onClick={() => action()}
|
|
|
|
/>))}
|
|
|
|
</BottomBarContent>);
|
2020-07-21 15:14:58 +00:00
|
|
|
|
2020-08-17 18:21:37 +00:00
|
|
|
ActionStrip.propTypes = {
|
|
|
|
actions: PropTypes.arrayOf(PropTypes.shape({
|
|
|
|
icon: PropTypes.element.isRequired,
|
|
|
|
aria: PropTypes.string.isRequired,
|
|
|
|
action: PropTypes.func.isRequired
|
|
|
|
})).isRequired
|
2020-07-21 15:14:58 +00:00
|
|
|
};
|
2020-08-17 18:21:37 +00:00
|
|
|
|
|
|
|
export default ActionStrip;
|