Skip to content
Snippets Groups Projects
IconButton.js 747 B
Newer Older
import React from 'react'
import { Icon } from '@pubsweet/ui'
import styled from 'styled-components'
import { positionHelper, marginHelper, paddingHelper } from './styledHelpers'
const IconButton = styled.div`
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: center;
  opacity: ${props => (props.disabled ? 0.7 : 1)};
  ${paddingHelper};
  ${positionHelper};
export default ({ icon, onClick, iconSize = 3, disabled, ...props }) => (
  <IconButton
    onClick={!disabled ? onClick : null}
    {...props}
  >
    <Icon size={iconSize} {...props}>
      {icon}
    </Icon>
  </IconButton>
)