feat breadcrumb.back: add back button

This commit is contained in:
Mahdi Dibaiee 2015-09-19 17:27:18 +04:30
parent 19f6960a6d
commit 419b4010d1
7 changed files with 57 additions and 2 deletions

View File

@ -30280,10 +30280,21 @@ var Breadcrumb = (function (_Component) {
_react2['default'].createElement( _react2['default'].createElement(
'div', 'div',
null, null,
_react2['default'].createElement('span', { onClick: this.goUp, className: 'icon-up' }),
els els
) )
); );
} }
}, {
key: 'goUp',
value: function goUp() {
var current = store.getState().get('cwd');
var up = current.split('/').slice(0, -1).join('/');
if (up === current) return;
store.dispatch((0, _actionsChangedir2['default'])(up));
}
}]); }]);
var _Breadcrumb = Breadcrumb; var _Breadcrumb = Breadcrumb;

View File

@ -59,6 +59,19 @@
.icon-cross svg * { .icon-cross svg * {
fill: white; fill: white;
} }
.icon-up {
display: block;
display: inline-block;
border: 11px solid transparent;
border-right-color: #63b0cd;
border-top-width: 8px;
border-bottom-width: 8px;
border-radius: 3px;
margin-right: 0.5rem;
position: relative;
top: 2px;
right: 0.5rem;
}
.regular-medium { .regular-medium {
font-weight: normal; font-weight: normal;
} }
@ -365,7 +378,9 @@ header button {
background: none; background: none;
border: none; border: none;
width: 8rem; width: 8rem;
height: 4rem; height: 3rem;
padding-top: 1rem;
margin-top: -1rem;
} }
header button::before { header button::before {
content: ''; content: '';

Binary file not shown.

Binary file not shown.

View File

@ -41,11 +41,21 @@ export default class Breadcrumb extends Component {
return ( return (
<div className='breadcrumb'> <div className='breadcrumb'>
<div> <div>
<span onClick={this.goUp} className='icon-up'></span>
{els} {els}
</div> </div>
</div> </div>
); );
} }
goUp() {
let current = store.getState().get('cwd');
let up = current.split('/').slice(0, -1).join('/');
if (up === current) return;
store.dispatch(changedir(up));
}
} }
function props(state) { function props(state) {

View File

@ -28,7 +28,9 @@ header {
border: none; border: none;
width: 8rem; width: 8rem;
height: 4rem; height: 3rem;
padding-top: 1rem;
margin-top: -1rem;
&::before { &::before {
content: ''; content: '';

View File

@ -65,3 +65,20 @@
fill: white; fill: white;
} }
} }
.icon-up {
.icon;
display: inline-block;
border: 11px solid transparent;
border-right-color: @blue;
border-top-width: 8px;
border-bottom-width: 8px;
border-radius: 3px;
margin-right: 0.5rem;
position: relative;
top: 2px;
right: 0.5rem;
}