2020-06-16 22:38:43 +02:00
|
|
|
import React from 'react';
|
2020-06-29 23:35:00 +02:00
|
|
|
import PropTypes from 'prop-types';
|
2020-06-16 22:38:43 +02:00
|
|
|
import styled from 'styled-components';
|
2020-06-29 23:35:00 +02:00
|
|
|
import Button from '../../common/Button';
|
2020-06-30 21:41:26 +02:00
|
|
|
import { remSize } from '../../theme';
|
2020-06-16 22:38:43 +02:00
|
|
|
|
2020-06-29 23:35:00 +02:00
|
|
|
const ButtonWrapper = styled(Button)`
|
2020-06-30 21:41:26 +02:00
|
|
|
width: ${remSize(48)};
|
2020-06-16 22:38:43 +02:00
|
|
|
> svg {
|
|
|
|
width: 100%;
|
2020-06-30 00:54:48 +02:00
|
|
|
height: 100%;
|
2020-06-16 22:38:43 +02:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2020-07-01 21:32:29 +02:00
|
|
|
const IconButton = (props) => {
|
|
|
|
const { icon, ...otherProps } = props;
|
|
|
|
const Icon = icon;
|
|
|
|
|
|
|
|
return (<ButtonWrapper
|
2020-08-12 15:19:06 +02:00
|
|
|
iconBefore={icon && <Icon />}
|
2020-07-01 21:32:29 +02:00
|
|
|
kind={Button.kinds.inline}
|
|
|
|
focusable="false"
|
|
|
|
{...otherProps}
|
|
|
|
/>);
|
|
|
|
};
|
2020-06-29 23:35:00 +02:00
|
|
|
|
|
|
|
IconButton.propTypes = {
|
2020-08-12 15:19:06 +02:00
|
|
|
icon: PropTypes.func
|
|
|
|
};
|
|
|
|
|
|
|
|
IconButton.defaultProps = {
|
|
|
|
icon: null
|
2020-06-29 23:35:00 +02:00
|
|
|
};
|
|
|
|
|
2020-06-16 22:38:43 +02:00
|
|
|
export default IconButton;
|