Skip to content

Commit

Permalink
Added selected props to toolbar nav
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielbull committed Aug 8, 2016
1 parent 0beb473 commit aed6c86
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
11 changes: 3 additions & 8 deletions src/toolbar/macOs/nav/item/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,14 @@ class Item extends Component {
static propTypes = {
name: PropTypes.string,
icon: PropTypes.element,
selected: PropTypes.bool
};

isSvg(icon) {
return icon.type === 'svg';
}

render() {
const { name, icon, style, ...props } = this.props;

this.isSvg(icon);
const { name, icon, style, selected, ...props } = this.props;

return (
<div className="_reactDesktop-Toolbar-Nav-Item-SVG">
<div className={'_reactDesktop-Toolbar-Nav-Item-SVG' + (selected ? ' _selected' : '')}>
<a
style={{ ...styles.container, ...style }}
{...props}
Expand Down
25 changes: 20 additions & 5 deletions src/toolbar/macOs/nav/nav.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import React, { Component, PropTypes } from 'react';
import { Style } from 'radium';
import Dimension, { dimensionPropTypes } from '../../../style/dimension';

const styles = {
nav: {
display: 'flex',
flexDirection: 'row', // row | row-reverse | column | column-reverse
flexWrap: 'nowrap', // nowrap | wrap | wrap-reverse
justifyContent: 'flex-start', // flex-start | flex-end | center | space-between | space-around
alignItems: 'flex-start', // flex-start | flex-end | center | space-between | space-around | stretch
alignContent: 'flex-start' // flex-start | flex-end | center | space-between | space-around | stretch
alignItems: 'center'
}
};

@Dimension({ height: '54px' })
class Nav extends Component {
static propTypes = {
...dimensionPropTypes
};

render() {
const { children, style, ...props } = this.props;

Expand All @@ -31,6 +33,19 @@ class Nav extends Component {
}
}}
/>
<Style
scopeSelector="._reactDesktop-Toolbar-Nav-Item-SVG._selected"
rules={{
'a svg *': {
fill: '#007bfa',
fillOpacity: '1'
},
'a:active svg *': {
fill: '#003dd6',
fillOpacity: '1'
}
}}
/>
{children}
</div>
);
Expand Down

0 comments on commit aed6c86

Please sign in to comment.