Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

Commit

Permalink
add support for font awesome
Browse files Browse the repository at this point in the history
  • Loading branch information
terebentina committed Sep 1, 2016
1 parent 380e73b commit 11c3e99
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
17 changes: 10 additions & 7 deletions lib/components/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@ var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _reactFontawesome = require('react-fontawesome');

var _reactFontawesome2 = _interopRequireDefault(_reactFontawesome);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function Icon(_ref) {
var name = _ref.name;
var size = _ref.size;

var cName = 'icon';
if (size) {
cName += ' is-' + size;
}

return _react2.default.createElement(
'span',
{ className: cName },
_react2.default.createElement('i', { className: 'fa fa-' + name })
{ className: (0, _classnames2.default)('icon', size && 'is-' + size) },
_react2.default.createElement(_reactFontawesome2.default, { name: name })
);
}

Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@
"dom-helpers": "^2.4.0"
},
"peerDependencies": {
"react": "15.x"
"react": "15.x",
"react-dom": "^15.3.1",
"react-fontawesome": "^1.1.0"
},
"devDependencies": {
"nwb": "0.12.x",
"react": "^15.3.1",
"react-dom": "^15.3.1"
"react-dom": "^15.3.1",
"react-fontawesome": "^1.1.0"
},
"author": "Dan Caragea",
"homepage": "",
Expand Down
11 changes: 4 additions & 7 deletions src/components/Icon.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import React, { PropTypes } from 'react';
import classNames from 'classnames';
import FontAwesome from 'react-fontawesome';

function Icon({ name, size }) {
let cName = 'icon';
if (size) {
cName += ` is-${size}`;
}

return (
<span className={cName}>
<i className={`fa fa-${name}`} />
<span className={classNames('icon', size && `is-${size}`)}>
<FontAwesome name={name} />
</span>
);
}
Expand Down

0 comments on commit 11c3e99

Please sign in to comment.