@react-material/fab
Advanced tools
Comparing version
@@ -9,4 +9,2 @@ 'use strict'; | ||
require('@material/fab/dist/mdc.fab.css'); | ||
var _classnames = require('classnames'); | ||
@@ -24,14 +22,21 @@ | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var FloatingActionButton = function FloatingActionButton(props) { | ||
var isIconSpecifiedByName = typeof props.children === 'string'; | ||
var className = props.className, | ||
mini = props.mini, | ||
plain = props.plain, | ||
restProps = _objectWithoutProperties(props, ['className', 'mini', 'plain']); | ||
return _react2.default.createElement( | ||
'button', | ||
_extends({ | ||
_extends({}, restProps, { | ||
className: (0, _classnames2.default)(_defineProperty({ | ||
'mdc-fab': true, | ||
'mdc-fab--mini': props.mini, | ||
'mdc-fab--plain': props.plain, | ||
'mdc-fab--mini': mini, | ||
'mdc-fab--plain': plain, | ||
'material-icons': isIconSpecifiedByName | ||
}, props.className, true)) | ||
}, className, true)) | ||
}, isIconSpecifiedByName && { 'aria-label': props.children }), | ||
@@ -38,0 +43,0 @@ _react2.default.createElement( |
{ | ||
"name": "@react-material/fab", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Material Design floating action button component for React", | ||
@@ -16,3 +16,2 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@material/fab": "^0.2.0", | ||
"classnames": "^2.2.5" | ||
@@ -19,0 +18,0 @@ }, |
@@ -1,2 +0,1 @@ | ||
import '@material/fab/dist/mdc.fab.css'; | ||
import classNames from 'classnames'; | ||
@@ -7,11 +6,13 @@ import React, { PropTypes } from 'react'; | ||
const isIconSpecifiedByName = typeof props.children === 'string'; | ||
const { className, mini, plain, ...restProps } = props; | ||
return ( | ||
<button | ||
{...restProps} | ||
className={classNames({ | ||
'mdc-fab': true, | ||
'mdc-fab--mini': props.mini, | ||
'mdc-fab--plain': props.plain, | ||
'mdc-fab--mini': mini, | ||
'mdc-fab--plain': plain, | ||
'material-icons': isIconSpecifiedByName, | ||
[props.className]: true, | ||
[className]: true, | ||
})} | ||
@@ -18,0 +19,0 @@ {...(isIconSpecifiedByName && { 'aria-label': props.children })} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2
-33.33%82
6.49%48621
-0.7%- Removed
- Removed
- Removed
- Removed
- Removed