Skip to content

Commit c5cb994

Browse files
committed
refactored from NavBar to AppBar
1 parent ea3f3b8 commit c5cb994

File tree

7 files changed

+20
-22
lines changed

7 files changed

+20
-22
lines changed

src/components/NavBar/NavBar.jsx renamed to src/components/AppBar/AppBar.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
import React from 'react';
44
import PropTypes from 'prop-types';
55
import { withStyles } from 'material-ui/styles';
6-
import AppBar from 'material-ui/AppBar';
6+
import MaterialUIAppBar from 'material-ui/AppBar';
77

88
import styles from './styles';
99

10-
class NavBar extends React.PureComponent {
10+
class AppBar extends React.PureComponent {
1111
static propTypes = {
1212
classes: PropTypes.shape({}),
1313
children: PropTypes.element,
14-
navbarPostion: PropTypes.string,
14+
position: PropTypes.string,
1515
color: PropTypes.string,
1616
};
1717

1818
render() {
19-
const { children, navbarPostion, classes, color, ...other } = this.props;
19+
const { children, position, classes, color, ...other } = this.props;
2020
return (
21-
<AppBar position={navbarPostion} color={color}>
21+
<MaterialUIAppBar position={position} color={color}>
2222
{React.cloneElement(children, { ...other })}
23-
</AppBar>
23+
</MaterialUIAppBar>
2424
);
2525
}
2626
}
2727

28-
export default withStyles(styles)(NavBar);
28+
export default withStyles(styles)(AppBar);

src/components/AppBar/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import AppBar from './AppBar';
2+
3+
export default AppBar;
File renamed without changes.

src/components/Layout/Layout.jsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import controllable from 'react-controllables';
77

88
import styles from './styles';
99

10-
import NavBar from '../NavBar';
10+
import AppBar from '../AppBar';
1111
import Footer from '../Footer';
1212

1313
// TODO create Layout Library
@@ -17,7 +17,7 @@ class Layout extends React.PureComponent {
1717
classes: PropTypes.shape({}),
1818
overrideClasses: PropTypes.shape({}),
1919
children: PropTypes.element.isRequired,
20-
navbarPostion: PropTypes.string,
20+
appBarPosition: PropTypes.string,
2121
stickyFooter: PropTypes.bool,
2222
footerContent: PropTypes.element,
2323
appBarContent: PropTypes.element,
@@ -31,7 +31,7 @@ class Layout extends React.PureComponent {
3131

3232
static defaultProps = {
3333
title: '',
34-
navbarPostion: 'default',
34+
appBarPosition: 'default',
3535
stickyFooter: false,
3636
drawerOpen: false,
3737
};
@@ -53,7 +53,7 @@ class Layout extends React.PureComponent {
5353
classes: defaultClasses,
5454
overrideClasses,
5555
children,
56-
navbarPostion,
56+
appBarPosition,
5757
stickyFooter,
5858
footerContent,
5959
appBarContent,
@@ -68,15 +68,14 @@ class Layout extends React.PureComponent {
6868

6969
const mainClassnames = classNames(
7070
classes.main,
71-
{ [`${classes.mainFixedNavbar}`]: navbarPostion === 'fixed' },
71+
{ [`${classes.mainFixedAppBar}`]: appBarPosition === 'fixed' },
7272
{ [`${classes.mainStickyFooter}`]: stickyFooter },
7373
);
74-
7574
return (
7675
<div className={classes.layout}>
77-
<NavBar {...appBarProps} onIconClick={this.toggleDrawer}>
76+
<AppBar {...appBarProps} position={appBarPosition} onIconClick={this.toggleDrawer}>
7877
{appBarContent}
79-
</NavBar>
78+
</AppBar>
8079
{drawerContent ? (
8180
<Drawer {...drawerProps} open={drawerOpen} onRequestClose={this.handleDrawerClose}>
8281
{drawerContent}

src/components/Layout/styles.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ const styles = {
88
paddingTop: '0px',
99
display: 'flex',
1010
},
11-
mainFixedNavbar: {
11+
mainFixedAppBar: {
1212
marginTop: '64px',
1313
},
1414
mainStickyFooter: {
1515
flex: 1,
1616
},
1717
'@media (max-width: 599px)': {
18-
mainFixedNavbar: {
18+
mainFixedAppBar: {
1919
marginTop: '56px',
2020
},
2121
},

src/components/NavBar/index.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import Layout from './components/Layout';
22

3-
export { default as AppBar } from './components/NavBar';
3+
export { default as AppBar } from './components/AppBar';
44
export { default as Footer } from './components/Footer';
55

6-
// I am changing the name from NavBar to AppBar
76
export { default as BasicAppBar } from './templates/AppBar/BasicAppBar';
87
export { default as TwoRowsAppBar } from './templates/AppBar/TwoRowsAppBar';
98
export { default as BasicFooter } from './templates/Footer/BasicFooter';

0 commit comments

Comments
 (0)