admin-on-rest-fr05t1k
Version:
A frontend Framework for building admin applications on top of REST services, using ES6, React and Material UI
55 lines (49 loc) • 1.26 kB
JavaScript
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import MuiAppBar from 'material-ui/AppBar';
import muiThemeable from 'material-ui/styles/muiThemeable';
import compose from 'recompose/compose';
import { toggleSidebar as toggleSidebarAction } from '../../actions';
const style = {
bar: {
height: '3em',
position: 'absolute',
top: 0,
},
title: {
fontSize: '1.25em',
lineHeight: '2.5em',
},
icon: {
marginTop: 0,
marginRight: 0,
marginLeft: '-24px',
},
link: {
color: '#fff',
textDecoration: 'none',
},
};
const AppBarMobile = ({ title, toggleSidebar }) => (
<MuiAppBar
style={style.bar}
titleStyle={style.title}
iconStyleLeft={style.icon}
title={title}
onLeftIconButtonTouchTap={toggleSidebar}
/>
);
AppBarMobile.propTypes = {
title: PropTypes.oneOfType([
PropTypes.string,
PropTypes.element
]).isRequired,
toggleSidebar: PropTypes.func.isRequired,
};
const enhance = compose(
muiThemeable(), // force redraw on theme change
connect(null, {
toggleSidebar: toggleSidebarAction,
}),
);
export default enhance(AppBarMobile);