Removing icons in favor of icon font

This commit is contained in:
James Barnsley
2018-05-13 16:03:51 +12:00
parent d5108822a6
commit 9d398e53c9
87 changed files with 985 additions and 9515 deletions

View File

@ -62,8 +62,10 @@ export default class Header extends React.Component{
render(){
return (
<header className={(this.props.className ? this.props.className : null)}>
{this.props.icon ? <Icon className="header-icon" name={this.props.icon} /> : null}
{this.props.title ? <h1>{ this.props.title }</h1> : null}
<h1>
{this.props.icon ? <i className={"icon header-icon icon-"+this.props.icon}></i> : null}
{this.props.title ? this.props.title : null}
</h1>
{this.renderOptions()}
</header>
)

View File

@ -1,55 +1,18 @@
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { createStore, bindActionCreators } from 'redux';
import * as helpers from '../helpers';
import * as uiActions from '../services/ui/actions';
class Icon extends React.Component{
export default class Icon extends React.Component{
constructor(props){
super(props);
}
componentDidMount(){
if (!this.props.icons[this.props.name]){
this.props.uiActions.getIcon(this.props.name);
}
}
componentWillReceiveProps(newProps){
if (this.props.name !== newProps.name && !newProps.icons[newProps.name]){
this.props.uiActions.getIcon(newProps.name);
}
}
render(){
var className = 'icon';
var className = 'icon icon-'+this.props.name;
if (this.props.className){
className += ' '+this.props.className;
}
var svg = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"></svg>';
if (this.props.icons[this.props.name]){
svg = this.props.icons[this.props.name];
}
return <span className={className} dangerouslySetInnerHTML={{ __html: svg}}></span>;
return <i className={className}></i>;
}
}
const mapStateToProps = (state, ownProps) => {
return {
icons: (state.ui.icons ? state.ui.icons : {})
}
}
const mapDispatchToProps = (dispatch) => {
return {
uiActions: bindActionCreators(uiActions, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(Icon)
}