[Max-Red] - Create icon component

This commit is contained in:
Ivan Diaz 2015-12-26 21:33:01 -03:00
parent b39fd2f948
commit 0a94a001d4
3 changed files with 22 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import CommonActions from 'actions/common-actions';
import Button from 'core-components/button';
import DropDown from 'core-components/drop-down';
import Icon from 'core-components/icon';
var languageList = ['English', 'Spanish', 'Portuguese', 'German', 'Turkish', 'Indian'];
var codeLanguages = {
@ -35,7 +36,7 @@ var MainLayoutHeader = React.createClass({
return {
content: (
<span>
<img className="language-icon" src={`../images/icons/${codeLanguages[item]}.png`} />{item}
<Icon name={codeLanguages[item]} />{item}
</span>
)
};

View File

@ -4,7 +4,6 @@ import _ from 'lodash';
import {Motion, spring} from 'react-motion';
import callback from 'lib/callback';
import getIcion from 'lib/callback';
var DropDown = React.createClass({
@ -44,7 +43,7 @@ var DropDown = React.createClass({
return {
defaultStyle: closedStyle,
style: (this.state.opened) ? openedStyle : closedStyle
}
};
},
render() {

View File

@ -0,0 +1,19 @@
import React from 'react';
var Icon = React.createClass({
propTypes: {
name: React.PropTypes.string.isRequired
},
render() {
return (
<img className="language-icon" src={`../images/icons/${this.props.name}.png`} />
);
}
});
export default Icon;