Skip to content
Snippets Groups Projects
Commit c4feb035 authored by Tom Robinson's avatar Tom Robinson
Browse files

Fix the star icon and mbIcon for reals

parent 59cca1d1
No related branches found
No related tags found
No related merge requests found
......@@ -15,13 +15,14 @@ angular.module('corvus.components')
return {
restrict: 'E',
template: '<svg class="Icon" id="{{name}}" viewBox="{{viewBox}}" ng-attr-width="{{width}}" ng-attr-height="{{height}}" fill="{{fill}}"><path ng-attr-d="{{path}}" /></svg>',
// NOTE: can't use ng-attr-viewBox because Angular doesn't preserve the case pre-v1.3.7
template: '<svg viewBox={{viewBox}} ng-attr-class="{{className}}" ng-attr-width="{{width}}" ng-attr-height="{{height}}" ng-attr-fill="{{fill}}"><path ng-attr-d="{{path}}" /></svg>',
scope: {
width: '@?', // a value in PX to define the width of the icon
height: '@?', // a value in PX to define the height of the icon
name: '@', // the name of the icon to be referended from the ICON_PATHS object
path: '@',
'class': '@',
className: '@',
viewBox: '@',
fill: '@'
},
......
......@@ -63,11 +63,11 @@ export function loadIcon(name) {
var icon = {
attrs: {
'class': 'Icon Icon-' + name,
'width': '32px',
'height': '32px',
'viewBox': '0 0 32 32',
'fill': 'currentcolor'
className: 'Icon Icon-' + name,
width: '32px',
height: '32px',
viewBox: '0 0 32 32',
fill: 'currentcolor'
},
svg: undefined,
path: undefined
......
......@@ -83,7 +83,7 @@ export default React.createClass({
return (
<a className={iconClasses} href="#" onClick={this.toggleFavorite}>
<Icon name="star"></Icon>
<Icon name="star" viewBox="0 0 32 32"></Icon>
</a>
);
}
......
......@@ -7,10 +7,6 @@ export default React.createClass({
render: function () {
var icon = loadIcon(this.props.name);
// react uses "className" instead of "class"
icon.attrs.className = icon.attrs['class'];
delete icon.attrs['class'];
if (icon.svg) {
return (<svg {... icon.attrs} {... this.props} dangerouslySetInnerHTML={{__html: icon.svg}}></svg>);
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment