11import { runSync } from "@mdx-js/mdx"
22import * as runtime from "react/jsx-runtime.js"
33import { CH } from "../src/components"
4- import Link from "next/link"
54import { getCode , getContent , getFiles } from "../dev/files"
6- import Head from "next/head"
5+ import { ClickToComponent } from "click-to-react-component"
6+ import { Layout } from "../dev/layout"
77
88export async function getStaticPaths ( ) {
99 const files = await getFiles ( )
@@ -37,63 +37,7 @@ export default function Page({
3737} ) {
3838 const { default : Content } = runSync ( code , runtime )
3939 return (
40- < div
41- style = { {
42- display : "flex" ,
43- flexDirection : "row" ,
44- gap : 8 ,
45- margin : "8px" ,
46- } }
47- >
48- < Head >
49- < title > Code Hike Test - { current } </ title >
50- </ Head >
51- < Sidebar tests = { tests } current = { current } />
52- < Result Content = { Content } debugLink = { debugLink } />
53- </ div >
54- )
55- }
56-
57- function Sidebar ( { tests, current } ) {
58- return (
59- < nav
60- style = { {
61- background : "#fafafa" ,
62- borderRadius : 4 ,
63- padding : "16px 0" ,
64- minWidth : 180 ,
65- } }
66- >
67- < ul style = { { margin : 0 , padding : 0 } } >
68- { tests . map ( test => (
69- < li
70- key = { test }
71- style = { { listStyle : "none" } }
72- className = "sidebar-link"
73- data-active = { test === current }
74- >
75- < Link href = { `/${ encodeURIComponent ( test ) } ` } >
76- < a > { test } </ a >
77- </ Link >
78- </ li >
79- ) ) }
80- </ ul >
81- </ nav >
82- )
83- }
84-
85- function Result ( { Content, debugLink } ) {
86- return (
87- < div
88- style = { {
89- maxWidth : 900 ,
90- minWidth : 600 ,
91- background : "#fafafa" ,
92- borderRadius : 4 ,
93- padding : 16 ,
94- position : "relative" ,
95- } }
96- >
40+ < Layout current = { current } contentFileNames = { tests } >
9741 < a
9842 href = { debugLink }
9943 target = "_blank"
@@ -107,6 +51,6 @@ function Result({ Content, debugLink }) {
10751 Debug
10852 </ a >
10953 < Content components = { { CH } } />
110- </ div >
54+ </ Layout >
11155 )
11256}
0 commit comments