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