You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
846 B
39 lines
846 B
8 years ago
|
import React from 'react';
|
||
8 years ago
|
import PropTypes from 'prop-types';
|
||
8 years ago
|
|
||
5 years ago
|
const iconStyle = {
|
||
|
height: null,
|
||
|
lineHeight: '27px',
|
||
|
width: `${18 * 1.28571429}px`,
|
||
|
};
|
||
|
|
||
8 years ago
|
export default class TextIconButton extends React.PureComponent {
|
||
8 years ago
|
|
||
8 years ago
|
static propTypes = {
|
||
|
label: PropTypes.string.isRequired,
|
||
|
title: PropTypes.string,
|
||
|
active: PropTypes.bool,
|
||
|
onClick: PropTypes.func.isRequired,
|
||
8 years ago
|
ariaControls: PropTypes.string,
|
||
8 years ago
|
};
|
||
|
|
||
8 years ago
|
render () {
|
||
8 years ago
|
const { label, title, active, ariaControls } = this.props;
|
||
8 years ago
|
|
||
|
return (
|
||
5 years ago
|
<button
|
||
2 years ago
|
type='button'
|
||
5 years ago
|
title={title}
|
||
|
aria-label={title}
|
||
|
className={`text-icon-button ${active ? 'active' : ''}`}
|
||
|
aria-expanded={active}
|
||
3 years ago
|
onClick={this.props.onClick}
|
||
5 years ago
|
aria-controls={ariaControls} style={iconStyle}
|
||
|
>
|
||
8 years ago
|
{label}
|
||
|
</button>
|
||
|
);
|
||
|
}
|
||
|
|
||
8 years ago
|
}
|