convert Icon

This commit is contained in:
Sérgio Ramos 2016-12-09 10:18:04 +00:00
parent fa376612aa
commit 5a6a7ae53b
2 changed files with 18 additions and 16 deletions

View File

@ -1,3 +1,5 @@
// TODO this should inherit <Icon />
const Button = require('../button'); const Button = require('../button');
const React = require('react'); const React = require('react');
const Styled = require('styled-components'); const Styled = require('styled-components');
@ -21,11 +23,9 @@ const ButtonIcon = ({
const Component = styled(Icon)(styles); const Component = styled(Icon)(styles);
return ( return (
<div>
<Button> <Button>
<Component className={className} style={style} /> <Component className={className} style={style} />
</Button> </Button>
</div>
); );
}; };

View File

@ -1,6 +1,14 @@
const React = require('react'); const React = require('react');
const classNames = require('classnames'); const Styled = require('styled-components');
const styles = require('./style.css');
const {
default: styled,
css
} = Styled;
const styles = css`
font-size: inherit;
`;
const Icon = ({ const Icon = ({
name = 'beer', name = 'beer',
@ -8,17 +16,11 @@ const Icon = ({
iconSet = 'fa', iconSet = 'fa',
style style
}) => { }) => {
const Component = require(`react-icons/lib/${iconSet}/${name}`); const Icon = require(`react-icons/lib/${iconSet}/${name}`);
const Component = styled(Icon)(styles);
const cn = classNames(
className,
styles.icon
);
return ( return (
<div className={cn}> <Component className={className} style={style} />
<Component style={style} />
</div>
); );
}; };