Skip to content

Commit 926edc1

Browse files
committed
- Sidebar on hooks
1 parent 415971b commit 926edc1

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
# Change Log
22

33
## [1.8.0] date
4-
### Warning
5-
- Due to the fact that on the PRO version of this product the Sidebar component could not be changed to hooks, we've left the Sidebar component of this product unaltered as well (it makes use of classes and the withStyles function, instead of React Hooks and makeStyles function)
64
### Bug fixing
75
- Rewrote the ISSUE_TEMPLATE
86
- Deleted the copyright comments from all files, we only need to keep them inside our index.js and index.html
97
- Added script that adds copyrights to the built app
108
- Renamed all the files from `.jsx` to `.js`
119
- Changed the `withStyles` function from Material-UI with the `makeStyles` function (integration with other frameworks should now be easy)
12-
- React Hooks is now supported (Please read the above warnings)
10+
- React Hooks is now supported
1311
### Major style changes
1412
- Renamed `assets/jss/material-dashboard-react/layouts/dashboardStyle.js` to `assets/jss/material-dashboard-react/layouts/adminStyle.js`
1513
### Deleted components

src/components/Sidebar/Sidebar.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import classNames from "classnames";
44
import PropTypes from "prop-types";
55
import { NavLink } from "react-router-dom";
66
// @material-ui/core components
7-
import withStyles from "@material-ui/core/styles/withStyles";
7+
import { makeStyles } from "@material-ui/core/styles";
88
import Drawer from "@material-ui/core/Drawer";
99
import Hidden from "@material-ui/core/Hidden";
1010
import List from "@material-ui/core/List";
@@ -15,14 +15,17 @@ import Icon from "@material-ui/core/Icon";
1515
import AdminNavbarLinks from "components/Navbars/AdminNavbarLinks.js";
1616
import RTLNavbarLinks from "components/Navbars/RTLNavbarLinks.js";
1717

18-
import sidebarStyle from "assets/jss/material-dashboard-react/components/sidebarStyle.js";
18+
import styles from "assets/jss/material-dashboard-react/components/sidebarStyle.js";
1919

20-
const Sidebar = props => {
20+
const useStyles = makeStyles(styles);
21+
22+
export default function Sidebar(props) {
23+
const classes = useStyles();
2124
// verifies if routeName is the one active (in browser input)
2225
function activeRoute(routeName) {
2326
return window.location.href.indexOf(routeName) > -1 ? true : false;
2427
}
25-
const { classes, color, logo, image, logoText, routes } = props;
28+
const { color, logo, image, logoText, routes } = props;
2629
var links = (
2730
<List className={classes.list}>
2831
{routes.map((prop, key) => {
@@ -146,10 +149,9 @@ const Sidebar = props => {
146149
</Hidden>
147150
</div>
148151
);
149-
};
152+
}
150153

151154
Sidebar.propTypes = {
152-
classes: PropTypes.object.isRequired,
153155
rtlActive: PropTypes.bool,
154156
handleDrawerToggle: PropTypes.func,
155157
bgColor: PropTypes.oneOf(["purple", "blue", "green", "orange", "red"]),
@@ -159,5 +161,3 @@ Sidebar.propTypes = {
159161
routes: PropTypes.arrayOf(PropTypes.object),
160162
open: PropTypes.bool
161163
};
162-
163-
export default withStyles(sidebarStyle)(Sidebar);

0 commit comments

Comments
 (0)