fix
parent
a16663d08d
commit
c7e4d249c6
|
@ -2,7 +2,7 @@ import React from "react";
|
||||||
import { HashRouter, Route, Switch, Redirect } from "react-router-dom";
|
import { HashRouter, Route, Switch, Redirect } from "react-router-dom";
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import Layout from "./Layout";
|
import Layout from "./Layout/Layout";
|
||||||
|
|
||||||
// pages
|
// pages
|
||||||
import Error from "../pages/error";
|
import Error from "../pages/error";
|
||||||
|
@ -37,7 +37,7 @@ export default function App() {
|
||||||
return (
|
return (
|
||||||
<Route
|
<Route
|
||||||
{...rest}
|
{...rest}
|
||||||
render={props =>
|
render={(props) =>
|
||||||
isAuthenticated ? (
|
isAuthenticated ? (
|
||||||
React.createElement(component, props)
|
React.createElement(component, props)
|
||||||
) : (
|
) : (
|
||||||
|
@ -45,8 +45,8 @@ export default function App() {
|
||||||
to={{
|
to={{
|
||||||
pathname: "/login",
|
pathname: "/login",
|
||||||
state: {
|
state: {
|
||||||
from: props.location,
|
from: props.location
|
||||||
},
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
@ -59,11 +59,11 @@ export default function App() {
|
||||||
return (
|
return (
|
||||||
<Route
|
<Route
|
||||||
{...rest}
|
{...rest}
|
||||||
render={props =>
|
render={(props) =>
|
||||||
isAuthenticated ? (
|
isAuthenticated ? (
|
||||||
<Redirect
|
<Redirect
|
||||||
to={{
|
to={{
|
||||||
pathname: "/",
|
pathname: "/"
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
|
|
|
@ -2,7 +2,7 @@ import React from "react";
|
||||||
import { withRouter } from "react-router-dom";
|
import { withRouter } from "react-router-dom";
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import Header from "../Header";
|
import Header from "../Header/Header";
|
||||||
import Sidebar from "../Sidebar";
|
import Sidebar from "../Sidebar";
|
||||||
import Content from "./Content";
|
import Content from "./Content";
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
import Notification from "./Notification";
|
||||||
|
export default Notification;
|
|
@ -0,0 +1,2 @@
|
||||||
|
import PageTitle from "./PageTitle";
|
||||||
|
export default PageTitle;
|
|
@ -0,0 +1,2 @@
|
||||||
|
import Sidebar from "./Sidebar";
|
||||||
|
export default Sidebar;
|
|
@ -24,7 +24,7 @@ const menu = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
label: "Resources",
|
label: "Resources",
|
||||||
link: "/app/typography",
|
link: "/app/resources",
|
||||||
icon: <ImageIcon />
|
icon: <ImageIcon />
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -33,13 +33,13 @@ const menu = [
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
label: "Admin",
|
label: "Admin",
|
||||||
link: "/app/typography",
|
link: "/app/admin",
|
||||||
icon: <BuildIcon />
|
icon: <BuildIcon />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 5,
|
id: 5,
|
||||||
label: "Settings",
|
label: "Settings",
|
||||||
link: "/app/typography",
|
link: "/app/settings",
|
||||||
icon: <SettingsIcon />,
|
icon: <SettingsIcon />,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ const menu = [
|
||||||
{
|
{
|
||||||
id: 6,
|
id: 6,
|
||||||
label: "Health",
|
label: "Health",
|
||||||
link: "/app/typography",
|
link: "/app/health",
|
||||||
icon: <NetworkCheckIcon />
|
icon: <NetworkCheckIcon />
|
||||||
},
|
},
|
||||||
{ id: 7, type: "divider" },
|
{ id: 7, type: "divider" },
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {
|
||||||
IconButton,
|
IconButton,
|
||||||
Menu,
|
Menu,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
Typography,
|
Typography
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import { MoreVert as MoreIcon } from "@material-ui/icons";
|
import { MoreVert as MoreIcon } from "@material-ui/icons";
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
|
@ -32,14 +32,21 @@ export default function Widget({
|
||||||
var [isMoreMenuOpen, setMoreMenuOpen] = useState(false);
|
var [isMoreMenuOpen, setMoreMenuOpen] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.widgetWrapper} style={style && {...style}}>
|
<div className={classes.widgetWrapper} style={style && { ...style }}>
|
||||||
<Paper className={classes.paper} classes={{ root: classnames(classes.widgetRoot, {
|
<Paper
|
||||||
|
className={classes.paper}
|
||||||
|
classes={{
|
||||||
|
root: classnames(classes.widgetRoot, {
|
||||||
[classes.noWidgetShadow]: noWidgetShadow
|
[classes.noWidgetShadow]: noWidgetShadow
|
||||||
}) }}>
|
})
|
||||||
<div className={classnames(classes.widgetHeader, {
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={classnames(classes.widgetHeader, {
|
||||||
[classes.noPadding]: noHeaderPadding,
|
[classes.noPadding]: noHeaderPadding,
|
||||||
[headerClass]: headerClass
|
[headerClass]: headerClass
|
||||||
})}>
|
})}
|
||||||
|
>
|
||||||
{header ? (
|
{header ? (
|
||||||
header
|
header
|
||||||
) : (
|
) : (
|
||||||
|
@ -65,7 +72,7 @@ export default function Widget({
|
||||||
<div
|
<div
|
||||||
className={classnames(classes.widgetBody, {
|
className={classnames(classes.widgetBody, {
|
||||||
[classes.noPadding]: noBodyPadding,
|
[classes.noPadding]: noBodyPadding,
|
||||||
[bodyClass]: bodyClass,
|
[bodyClass]: bodyClass
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
import Widget from "./Widget";
|
||||||
|
export default Widget;
|
|
@ -3,18 +3,18 @@ import {
|
||||||
withStyles,
|
withStyles,
|
||||||
Badge as BadgeBase,
|
Badge as BadgeBase,
|
||||||
Typography as TypographyBase,
|
Typography as TypographyBase,
|
||||||
Button as ButtonBase,
|
Button as ButtonBase
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import { useTheme, makeStyles } from "@material-ui/styles";
|
import { useTheme, makeStyles } from "@material-ui/styles";
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
|
|
||||||
// styles
|
// styles
|
||||||
var useStyles = makeStyles(theme => ({
|
var useStyles = makeStyles((theme) => ({
|
||||||
badge: {
|
badge: {
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
height: 16,
|
height: 16,
|
||||||
minWidth: 16,
|
minWidth: 16
|
||||||
},
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function Badge({ children, colorBrightness, color, ...props }) {
|
function Badge({ children, colorBrightness, color, ...props }) {
|
||||||
|
@ -22,16 +22,16 @@ function Badge({ children, colorBrightness, color, ...props }) {
|
||||||
var theme = useTheme();
|
var theme = useTheme();
|
||||||
var Styled = createStyled({
|
var Styled = createStyled({
|
||||||
badge: {
|
badge: {
|
||||||
backgroundColor: getColor(color, theme, colorBrightness),
|
backgroundColor: getColor(color, theme, colorBrightness)
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Styled>
|
<Styled>
|
||||||
{styledProps => (
|
{(styledProps) => (
|
||||||
<BadgeBase
|
<BadgeBase
|
||||||
classes={{
|
classes={{
|
||||||
badge: classnames(classes.badge, styledProps.classes.badge),
|
badge: classnames(classes.badge, styledProps.classes.badge)
|
||||||
}}
|
}}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
|
@ -57,7 +57,7 @@ function Typography({
|
||||||
style={{
|
style={{
|
||||||
color: getColor(color, theme, colorBrightness),
|
color: getColor(color, theme, colorBrightness),
|
||||||
fontWeight: getFontWeight(weight),
|
fontWeight: getFontWeight(weight),
|
||||||
fontSize: getFontSize(size, props.variant, theme),
|
fontSize: getFontSize(size, props.variant, theme)
|
||||||
}}
|
}}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
|
@ -71,7 +71,7 @@ function Button({ children, color, className, ...props }) {
|
||||||
|
|
||||||
var Styled = createStyled({
|
var Styled = createStyled({
|
||||||
root: {
|
root: {
|
||||||
color: getColor(color, theme),
|
color: getColor(color, theme)
|
||||||
},
|
},
|
||||||
contained: {
|
contained: {
|
||||||
backgroundColor: getColor(color, theme),
|
backgroundColor: getColor(color, theme),
|
||||||
|
@ -79,20 +79,20 @@ function Button({ children, color, className, ...props }) {
|
||||||
color: `${color ? "white" : theme.palette.text.primary} !important`,
|
color: `${color ? "white" : theme.palette.text.primary} !important`,
|
||||||
"&:hover": {
|
"&:hover": {
|
||||||
backgroundColor: getColor(color, theme, "light"),
|
backgroundColor: getColor(color, theme, "light"),
|
||||||
boxShadow: theme.customShadows.widgetWide,
|
boxShadow: theme.customShadows.widgetWide
|
||||||
},
|
},
|
||||||
"&:active": {
|
"&:active": {
|
||||||
boxShadow: theme.customShadows.widgetWide,
|
boxShadow: theme.customShadows.widgetWide
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
outlined: {
|
outlined: {
|
||||||
color: getColor(color, theme),
|
color: getColor(color, theme),
|
||||||
borderColor: getColor(color, theme),
|
borderColor: getColor(color, theme)
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
backgroundColor: theme.palette.primary.main,
|
backgroundColor: theme.palette.primary.main,
|
||||||
color: "#fff",
|
color: "#fff"
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -102,14 +102,14 @@ function Button({ children, color, className, ...props }) {
|
||||||
classes={{
|
classes={{
|
||||||
contained: classes.contained,
|
contained: classes.contained,
|
||||||
root: classes.root,
|
root: classes.root,
|
||||||
outlined: classes.outlined,
|
outlined: classes.outlined
|
||||||
}}
|
}}
|
||||||
{...props}
|
{...props}
|
||||||
className={classnames(
|
className={classnames(
|
||||||
{
|
{
|
||||||
[classes.select]: props.select,
|
[classes.select]: props.select
|
||||||
},
|
},
|
||||||
className,
|
className
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
@ -172,7 +172,7 @@ function getFontSize(size, variant = "", theme) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createStyled(styles, options) {
|
function createStyled(styles, options) {
|
||||||
var Styled = function(props) {
|
var Styled = function (props) {
|
||||||
const { children, ...other } = props;
|
const { children, ...other } = props;
|
||||||
return children(other);
|
return children(other);
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
export { Badge, Typography, Button } from "./Wrappers";
|
|
@ -28,14 +28,14 @@ const datatableData = [
|
||||||
["Anna Siranush", "Example Inc.", "Yonkers", "NY"],
|
["Anna Siranush", "Example Inc.", "Yonkers", "NY"],
|
||||||
["Avram Sylva", "Example Inc.", "Hartford", "CT"],
|
["Avram Sylva", "Example Inc.", "Hartford", "CT"],
|
||||||
["Serafima Babatunde", "Example Inc.", "Tampa", "FL"],
|
["Serafima Babatunde", "Example Inc.", "Tampa", "FL"],
|
||||||
["Gaston Festus", "Example Inc.", "Tampa", "FL"],
|
["Gaston Festus", "Example Inc.", "Tampa", "FL"]
|
||||||
];
|
];
|
||||||
|
|
||||||
const useStyles = makeStyles(theme => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
tableOverflow: {
|
tableOverflow: {
|
||||||
overflow: 'auto'
|
overflow: "auto"
|
||||||
}
|
}
|
||||||
}))
|
}));
|
||||||
|
|
||||||
export default function Tables() {
|
export default function Tables() {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
@ -49,12 +49,17 @@ export default function Tables() {
|
||||||
data={datatableData}
|
data={datatableData}
|
||||||
columns={["Name", "Company", "City", "State"]}
|
columns={["Name", "Company", "City", "State"]}
|
||||||
options={{
|
options={{
|
||||||
filterType: "checkbox",
|
filterType: "checkbox"
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Widget title="Material-UI Table" upperTitle noBodyPadding bodyClass={classes.tableOverflow}>
|
<Widget
|
||||||
|
title="Material-UI Table"
|
||||||
|
upperTitle
|
||||||
|
noBodyPadding
|
||||||
|
bodyClass={classes.tableOverflow}
|
||||||
|
>
|
||||||
<Table data={mock.table} />
|
<Table data={mock.table} />
|
||||||
</Widget>
|
</Widget>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
Loading…
Reference in New Issue