Skip to content

Commit 43f5f8a

Browse files
committed
Restructure
1 parent b22a8a5 commit 43f5f8a

22 files changed

+121
-238
lines changed

.storybook/config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { configure, addDecorator, addParameters } from '@storybook/react'
44
import { withA11y } from '@storybook/addon-a11y'
55
import { themes } from '@storybook/theming';
66
import { ThemeProvider } from '@material-ui/styles'
7+
import { BrowserRouter } from 'react-router-dom' //
78

89

910
import docsTheme from './theme'
@@ -28,7 +29,9 @@ addDecorator(withA11y);
2829
addDecorator(story => (
2930
<>
3031
<ThemeProvider theme={appTheme}>
31-
{story()}
32+
<BrowserRouter>
33+
{story()}
34+
</BrowserRouter>
3235
</ThemeProvider>
3336
</>
3437
));

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"disqus-react": "^1.0.7",
2323
"lodash": "^4.17.15",
2424
"moment": "^2.24.0",
25+
"prop-types": "^15.7.2",
2526
"react": "^16.12.0",
2627
"react-dom": "^16.11.0",
2728
"react-router-dom": "^5.1.2",
@@ -36,8 +37,8 @@
3637
"devDependencies": {
3738
"@storybook/addon-a11y": "^5.3.0-rc.4",
3839
"@storybook/addon-actions": "^5.3.0-rc.4",
39-
"@storybook/addon-knobs": "^5.3.0-rc.4",
4040
"@storybook/addon-docs": "^5.3.0-rc.4",
41+
"@storybook/addon-knobs": "^5.3.0-rc.4",
4142
"@storybook/addon-storysource": "^5.3.0-rc.4",
4243
"@storybook/addons": "^5.3.0-rc.4",
4344
"@storybook/preset-typescript": "^1.2.0",

src/App.stories.mdx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,20 @@
33

44
# Modular Material Admin + React
55

6-
> React dashboard application starter
6+
> React dashboard application starter
7+
8+
9+
## Directory Structure
10+
11+
12+
## Module system
13+
14+
15+
## Layouts
16+
17+
## Routing
18+
19+
## Authorization
20+
21+
## API calls and data
22+

src/_common/AppHeader/AppHeader.js

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,72 @@
11
import React from 'react'
2+
import PropTypes from 'prop-types'
3+
import clsx from 'clsx'
24

3-
export const AppHeader = () => {
4-
return <div>App Header</div>
5+
import { makeStyles } from '@material-ui/core/styles'
6+
import AppBar from '@material-ui/core/AppBar'
7+
import Toolbar from '@material-ui/core/Toolbar'
8+
import IconButton from '@material-ui/core/IconButton'
9+
10+
import IconMenu from '@material-ui/icons/Menu'
11+
12+
import HeaderDemo from './AppHeaderDemo'
13+
14+
import HeaderSearch from './AppHeaderSearch'
15+
import HeaderNotifications from './AppHeaderNotifications'
16+
import HeaderProfile from './AppHeaderProfile'
17+
18+
/**
19+
* The `Avatar` component is where all your avatars come to play.
20+
*/
21+
const Header = ({ onToggle }) => {
22+
const classes = useStyles()
23+
24+
return (
25+
<AppBar position="absolute" className={classes.header}>
26+
<Toolbar className={classes.toolbar}>
27+
<IconButton
28+
edge="start"
29+
color="inherit"
30+
aria-label="Toggle sidebar"
31+
onClick={onToggle}
32+
className={clsx(classes.menuButton)}
33+
>
34+
<IconMenu />
35+
</IconButton>
36+
<HeaderDemo />
37+
<div className={classes.actions}>
38+
<HeaderSearch />
39+
<HeaderNotifications />
40+
<HeaderProfile />
41+
</div>
42+
</Toolbar>
43+
</AppBar>
44+
)
545
}
46+
47+
Header.propTypes = {
48+
onToggle: PropTypes.func,
49+
}
50+
51+
const useStyles = makeStyles(theme => ({
52+
header: {
53+
background: '#fff',
54+
color: '#7b7b7b',
55+
boxShadow: 'none',
56+
},
57+
toolbar: {},
58+
menuButton: {},
59+
actions: {
60+
marginLeft: 'auto',
61+
alignItems: 'center',
62+
display: 'flex',
63+
},
64+
notificationsButton: {
65+
marginRight: 23,
66+
},
67+
title: {
68+
flexGrow: 1,
69+
},
70+
}))
71+
72+
export default Header
Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
import { Meta, Story, Preview } from '@storybook/addon-docs/blocks'
2-
import { Button } from '@storybook/react/demo'
1+
import { Meta, Story, Preview, Props } from '@storybook/addon-docs/blocks'
2+
import AppHeader from './AppHeader.js'
33

4-
<Meta title="General/AppHeader" component={Button} />
4+
<Meta title="General/Components/AppHeader" component={AppHeader} />
55

6-
# Checkbox
6+
# App Header
77

8-
With `MDX` we can define a story for `Button` right in the middle of our
9-
markdown documentation.
8+
Application header component.
109

1110
<Preview>
12-
<Story name="all buttons">
13-
<form>
14-
<Button>
15-
<span role="img" aria-label="so cool">
16-
😀 😎 👍 💯
17-
</span>
18-
</Button>
19-
</form>
11+
<Story name="default header">
12+
<AppHeader />
2013
</Story>
21-
</Preview>
14+
</Preview>
15+
16+
## Props
17+
18+
<Props of={AppHeader} />
19+

src/_common/AppHeader/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from '../../../_common/AppHeader/Header'

src/_common/AppSidebar/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from './Sidebar'

src/_layouts/DashboardLayout/DashboardLayout.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import useMediaQuery from '@material-ui/core/useMediaQuery'
66
import Drawer from '@material-ui/core/Drawer'
77
import Hidden from '@material-ui/core/Hidden'
88

9-
import Header from './Header/Header'
10-
import Sidebar from './Sidebar/Sidebar'
11-
import Footer from './Footer'
9+
import AppHeader from '../../_common/AppHeader/AppHeader'
10+
import AppSidebar from '../../_common/AppSidebar/Sidebar'
11+
import AppFooter from '../../_common/AppFooter'
1212

1313
export default function Dashboard({ children }) {
1414
const classes = useStyles()
@@ -45,7 +45,7 @@ export default function Dashboard({ children }) {
4545
classes.headerContainerDesktopDrawerCollapsed,
4646
)}
4747
>
48-
<Header onToggle={handleSidebarToggle} />
48+
<AppHeader onToggle={handleSidebarToggle} />
4949
</div>
5050
<div
5151
className={clsx(
@@ -101,7 +101,7 @@ export default function Dashboard({ children }) {
101101
<main className={classes.content}>
102102
<div className={classes.headerSpacer} />
103103
{children}
104-
<Footer />
104+
<AppFooter />
105105
</main>
106106
</div>
107107
)

src/_layouts/DashboardLayout/Header/Header.js

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

src/_layouts/DashboardLayout/Header/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/_layouts/DashboardLayout/Sidebar/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)