Add admin nav

This commit is contained in:
Jan Tuomi
2019-01-15 12:20:49 +02:00
parent 8197c40701
commit ef28a3f4b9
11 changed files with 115 additions and 3 deletions
@@ -0,0 +1,22 @@
@import "../../assets/scss/globals";
.admin-sidebar {
display: flex;
flex-flow: column nowrap;
align-self: stretch;
margin-right: 1rem;
}
.admin-sidebar-item {
padding: 1rem;
background-color: $orange2;
border-left: 4px solid $orange2;
&:hover {
border-left: 4px solid $white;
}
&::after {
content: " ";
}
}
@@ -0,0 +1,23 @@
import * as React from "react";
import { Link } from "react-router-dom";
import "./AdminSidebar.scss";
import AdminSidebarLink from "../AdminSidebarLink";
export interface AdminSiderbarProps {
path: string;
}
export interface AdminSiderbarState {}
class AdminSidebar extends React.Component<AdminSiderbarProps, AdminSiderbarState> {
render() {
const { path } = this.props;
return (
<div className="admin-sidebar">
<AdminSidebarLink to="/admin" path={path}>Home</AdminSidebarLink>
<AdminSidebarLink to="/admin/events" path={path}>Events</AdminSidebarLink>
</div>
);
}
}
export default AdminSidebar;
+2
View File
@@ -0,0 +1,2 @@
import AdminSidebar from "./AdminSidebar";
export default AdminSidebar;
@@ -0,0 +1,20 @@
@import "../../assets/scss/globals";
.admin-sidebar-link {
padding: 1rem 3rem 1rem 1rem;
background-color: $blue;
letter-spacing: 3px;
text-transform: uppercase;
line-height: 20px;
font-weight: bold;
border-left: 4px solid $blue;
&:hover,
&.active {
border-left: 4px solid $white;
}
&::after {
content: " ";
}
}
@@ -0,0 +1,24 @@
import * as React from "react";
import { Link } from "react-router-dom";
import "./AdminSidebarLink.scss";
export interface AdminSidebarLinkProps {
to: string;
path: string;
}
export interface AdminSidebarLinkState {}
class AdminSidebarLink extends React.Component<AdminSidebarLinkProps, AdminSidebarLinkState> {
render() {
const { to, path, children } = this.props;
const activeClass = to === path ? "active" : "";
return (
<Link to={to} className={`admin-sidebar-link ${activeClass}`}>
{ children }
</Link>
);
}
}
export default AdminSidebarLink;
+2
View File
@@ -0,0 +1,2 @@
import AdminSidebarLink from "./AdminSidebarLink";
export default AdminSidebarLink;
+2
View File
@@ -14,6 +14,8 @@ body {
#root {
position: relative;
min-height: 100vh;
display: flex;
flex-flow: column nowrap;
}
body {
@@ -0,0 +1,7 @@
.admin-container {
display: flex;
flex-flow: row nowrap;
justify-content: flex-start;
align-items: flex-start;
flex: 1;
}
+11 -1
View File
@@ -1,18 +1,28 @@
import * as React from "react";
import AdminHeader from "../../components/AdminHeader";
import AdminSidebar from "../../components/AdminSidebar";
import "./AdminCommonPage.scss";
export interface AdminCommonPageProps {
page: any;
match: {
path: string;
};
}
export interface AdminCommonPageState { }
class AdminCommonPage extends React.Component<AdminCommonPageProps, AdminCommonPageState> {
render() {
const Page = this.props.page;
const { path } = this.props.match;
return (
<React.Fragment>
<AdminHeader />
<Page {...this.props} />
<div className="admin-container">
<AdminSidebar path={path} />
<Page {...this.props} />
</div>
</React.Fragment>
);
}
+1 -1
View File
@@ -1,3 +1,3 @@
.admin-event-page {
padding: 1rem;
margin: 0 1rem;
}
+1 -1
View File
@@ -1,3 +1,3 @@
.admin-front-page {
padding: 1rem;
margin: 0 1rem;
}