1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-11 05:40:11 +02:00

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 React = require('react');
const Styled = require('styled-components');
@ -21,11 +23,9 @@ const ButtonIcon = ({
const Component = styled(Icon)(styles);
return (
<div>
<Button>
<Component className={className} style={style} />
</Button>
</div>
<Button>
<Component className={className} style={style} />
</Button>
);
};

View File

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