import React from 'react';
import PropTypes from 'prop-types';
+const iconStyle = {
+ height: null,
+ lineHeight: '27px',
+ width: `${18 * 1.28571429}px`,
+};
+
export default class TextIconButton extends React.PureComponent {
static propTypes = {
const { label, title, active, ariaControls } = this.props;
return (
- <button title={title} aria-label={title} className={`text-icon-button ${active ? 'active' : ''}`} aria-expanded={active} onClick={this.handleClick} aria-controls={ariaControls}>
+ <button
+ title={title}
+ aria-label={title}
+ className={`text-icon-button ${active ? 'active' : ''}`}
+ aria-expanded={active}
+ onClick={this.handleClick}
+ aria-controls={ariaControls} style={iconStyle}
+ >
{label}
</button>
);
padding: 0;
color: $action-button-color;
border: 0;
+ border-radius: 4px;
background: transparent;
cursor: pointer;
- transition: color 100ms ease-in;
+ transition: all 100ms ease-in;
+ transition-property: background-color, color;
&:hover,
&:active,
&:focus {
color: lighten($action-button-color, 7%);
- transition: color 200ms ease-out;
+ background-color: rgba($action-button-color, 0.15);
+ transition: all 200ms ease-out;
+ transition-property: background-color, color;
+ }
+
+ &:focus {
+ background-color: rgba($action-button-color, 0.3);
}
&.disabled {
color: darken($action-button-color, 13%);
+ background-color: transparent;
cursor: default;
}
&:active,
&:focus {
color: darken($lighter-text-color, 7%);
+ background-color: rgba($lighter-text-color, 0.15);
+ }
+
+ &:focus {
+ background-color: rgba($lighter-text-color, 0.3);
}
&.disabled {
color: lighten($lighter-text-color, 7%);
+ background-color: transparent;
}
&.active {
.text-icon-button {
color: $lighter-text-color;
border: 0;
+ border-radius: 4px;
background: transparent;
cursor: pointer;
font-weight: 600;
padding: 0 3px;
line-height: 27px;
outline: 0;
- transition: color 100ms ease-in;
+ transition: all 100ms ease-in;
+ transition-property: background-color, color;
&:hover,
&:active,
&:focus {
color: darken($lighter-text-color, 7%);
- transition: color 200ms ease-out;
+ background-color: rgba($lighter-text-color, 0.15);
+ transition: all 200ms ease-out;
+ transition-property: background-color, color;
+ }
+
+ &:focus {
+ background-color: rgba($lighter-text-color, 0.3);
}
&.disabled {
color: lighten($lighter-text-color, 20%);
+ background-color: transparent;
cursor: default;
}
}
}
- .icon-button {
+ .icon-button,
+ .text-icon-button {
box-sizing: content-box;
padding: 0 3px;
}