You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.0 KiB

"use strict";
const React = require("react");
const classnames = require("classnames");
const renderingContext = require("../rendering-context");
let currentURLContext = React.createContext();
function ExternalLinkIcon() {
return <img class="externalLink" src="/assets/external-link-icon.svg" alt="External link" />;
function MenuItem({ url, children }) {
let currentURL = React.useContext(currentURLContext);
let isCurrentPage = (url === currentURL);
return (
<a href={url} className={classnames("item", { active: isCurrentPage })}>
module.exports = function DefaultLayout({ mdxContent, meta, pageContext }) {
console.log({ mdxContent, meta, pageContext });
return (
<renderingContext.Provider value={{ mdxContent, meta, pageContext }}>
<currentURLContext.Provider value={meta.url}>
<html lang="en">
<meta charSet="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{meta.title} - Nix Manual</title>
<link rel="stylesheet" href="/assets/bundle.css"/>
<div className="header">
<div className="inner">
<img className="logo" src="/assets/nix-logo.svg" alt="Nix logo"/>
{/* <div className="menu">
<MenuItem url="/">Home</MenuItem>
<MenuItem url="/getting-started">Getting started</MenuItem>
<MenuItem url="/modules">Validator index</MenuItem>
<MenuItem url="">
Source code
<ExternalLinkIcon />
</div> */}
<div className="content">
<div className="inner">
{ mdxContent }
<div className="footer">
<div className="inner">
This is a proof-of-concept for the NixOS documentation, using <a href="">MDX</a> and <a href="">Shayu</a>.