@6thquake/react-material
Version:
React components that implement Google's Material Design.
114 lines (103 loc) • 2.79 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
import React from 'react';
import PropTypes from 'prop-types';
import withStyles from '../styles/withStyles';
import classNames from 'classnames';
import IconButton from '@material-ui/core/IconButton';
const styles = theme => {
return {
root: {},
colorInherit: {},
colorPrimary: {},
colorSecondary: {},
disabled: {},
label: {},
fish: {
transform: 'scale3d(1,1,1)',
'-ms-transform': 'scale3d(1,1,1)'
/* IE 9 */
,
'-moz-transform': 'scale3d(1,1,1)'
/* Firefox */
,
'-webkit-transform': 'scale3d(1,1,1)'
/* Safari 和 Chrome */
,
'-o-transform': 'scale3d(1,1,1)',
transition: 'all 86ms ease-out',
'&:hover': {
transform: 'scale3d(1.2, 1.2, 1.2)',
'-ms-transform': 'scale3d(1.2, 1.2, 1.2)'
/* IE 9 */
,
'-moz-transform': 'scale3d(1.2, 1.2, 1.2)'
/* Firefox */
,
'-webkit-transform': 'scale3d(1.2, 1.2, 1.2)'
/* Safari 和 Chrome */
,
'-o-transform': 'scale3d(1.2, 1.2, 1.2)'
}
}
};
};
const RMIconButton = React.forwardRef(function RMIconButton(props, ref) {
const {
className: classNamePro,
classes,
fish: isFish
} = props,
other = _objectWithoutPropertiesLoose(props, ["className", "classes", "fish"]);
const className = classNames({
[classes.fish]: isFish
}, classNamePro);
const classesPro = _objectWithoutPropertiesLoose(classes, ["fish"]);
return React.createElement(IconButton, _extends({
classes: classesPro,
className: className,
ref: ref
}, other));
});
process.env.NODE_ENV !== "production" ? RMIconButton.propTypes = {
/**
* The icon element.
*/
children: PropTypes.node,
/**
* Override or extend the styles applied to the component.
* See [CSS API](#css-api) below for more details.
*/
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
className: PropTypes.string,
/**
* The color of the component. It supports those theme colors that make sense for this component.
*/
color: PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary']),
/**
* If `true`, the button will be disabled.
*/
disabled: PropTypes.bool,
/**
* If `true`, the ripple will be disabled.
*/
disableRipple: PropTypes.bool,
/**
* 是否是鱼眼button
*/
fish: PropTypes.bool
} : void 0;
RMIconButton.defaultProps = {
color: 'default',
disabled: false,
fish: false
};
RMIconButton.contextTypes = {
resetActive: PropTypes.func
};
export default withStyles(styles, {
name: 'RMIconButton'
})(RMIconButton);