|
|
@ -2,10 +2,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
const React = require("react");
|
|
|
|
const React = require("react");
|
|
|
|
const classnames = require("classnames");
|
|
|
|
const classnames = require("classnames");
|
|
|
|
// const {LocalsContext} = require("../express-async-react");
|
|
|
|
|
|
|
|
|
|
|
|
const {LocalsContext} = require("../express-async-react");
|
|
|
|
|
|
|
|
const isUnderPrefix = require("../is-under-prefix");
|
|
|
|
|
|
|
|
|
|
|
|
function MenuItem({ path, children }) {
|
|
|
|
function MenuItem({ path, children }) {
|
|
|
|
let isActive = false; // FIXME
|
|
|
|
let {currentPath} = React.useContext(LocalsContext);
|
|
|
|
|
|
|
|
let isActive = isUnderPrefix(path, currentPath);
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className={classnames("menu-item", {active: isActive})}>
|
|
|
|
<div className={classnames("menu-item", {active: isActive})}>
|
|
|
@ -17,8 +20,6 @@ function MenuItem({ path, children }) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = function Layout({ children }) {
|
|
|
|
module.exports = function Layout({ children }) {
|
|
|
|
// let locals = React.useContext(LocalsContext);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<head>
|
|
|
@ -28,6 +29,7 @@ module.exports = function Layout({ children }) {
|
|
|
|
<body>
|
|
|
|
<body>
|
|
|
|
<div className="menu">
|
|
|
|
<div className="menu">
|
|
|
|
<h1>CVM</h1>
|
|
|
|
<h1>CVM</h1>
|
|
|
|
|
|
|
|
<MenuItem path="/hardware">Hardware</MenuItem>
|
|
|
|
<MenuItem path="/disk-images">Disk Images</MenuItem>
|
|
|
|
<MenuItem path="/disk-images">Disk Images</MenuItem>
|
|
|
|
<MenuItem path="/instances">Instances</MenuItem>
|
|
|
|
<MenuItem path="/instances">Instances</MenuItem>
|
|
|
|
<MenuItem path="/users">Users</MenuItem>
|
|
|
|
<MenuItem path="/users">Users</MenuItem>
|
|
|
|