11import { useEffect } from 'preact/hooks' ;
22import Markup from 'preact-markup' ;
33import widgets from '../widgets' ;
4- import style from './style.module.css' ;
5- import { useTranslation } from '../../lib/i18n' ;
64import { TocContext } from '../table-of-contents' ;
75import { prefetchContent } from '../../lib/use-content' ;
86import { ReplPage , TutorialPage , CodeEditor } from '../routes' ;
@@ -33,34 +31,7 @@ const COMPONENTS = {
3331 }
3432} ;
3533
36- function SiblingNav ( { route, lang, start } ) {
37- let title = '' ;
38- let url = '' ;
39- if ( route ) {
40- url = route . path . toLowerCase ( ) ;
41- title =
42- typeof route . name === 'object'
43- ? route . name [ lang || 'en' ]
44- : route . name || route . title ;
45- }
46- const label = useTranslation ( start ? 'previous' : 'next' ) ;
47-
48- return (
49- < a class = { style . nextLink } data-dir-end = { ! start } href = { url } >
50- { start && < span class = { style . icon } > ← </ span > }
51- { ! start && < span class = { style . icon } > →</ span > }
52- < span class = { style . nextInner } >
53- < span class = { style . nextTitle } >
54- < span class = { style . nextTitleInner } > { title } </ span >
55- </ span >
56- < span class = { style . nextUrl } > { label } </ span >
57- </ span >
58- </ a >
59- ) ;
60- }
61-
6234export default function ContentRegion ( { content, components, ...props } ) {
63- const hasNav = ! ! ( props . next || props . prev ) ;
6435 components = Object . assign ( { } , COMPONENTS , components ) ;
6536
6637 useEffect ( ( ) => {
@@ -73,7 +44,7 @@ export default function ContentRegion({ content, components, ...props }) {
7344 } , [ props . current ] ) ;
7445
7546 return (
76- < content-region name = { props . current } data-page-nav = { hasNav } can-edit = { props . canEdit } >
47+ < content-region name = { props . current } can-edit = { props . canEdit } >
7748 { content && (
7849 < TocContext . Provider value = { { toc : props . toc } } >
7950 < Markup
@@ -84,20 +55,6 @@ export default function ContentRegion({ content, components, ...props }) {
8455 />
8556 </ TocContext . Provider >
8657 ) }
87- { hasNav && (
88- < div class = { style . nextWrapper } >
89- { props . prev ? (
90- < SiblingNav start lang = { props . lang } route = { props . prev } />
91- ) : (
92- < span />
93- ) }
94- { props . next ? (
95- < SiblingNav lang = { props . lang } route = { props . next } />
96- ) : (
97- < span />
98- ) }
99- </ div >
100- ) }
10158 </ content-region >
10259 ) ;
10360}
0 commit comments