Skip to content

Commit 8edfc63

Browse files
committed
refactor: Remove unused code paths in content-region
1 parent 5aa73cc commit 8edfc63

File tree

3 files changed

+2
-100
lines changed

3 files changed

+2
-100
lines changed
Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { useEffect } from 'preact/hooks';
22
import Markup from 'preact-markup';
33
import widgets from '../widgets';
4-
import style from './style.module.css';
5-
import { useTranslation } from '../../lib/i18n';
64
import { TocContext } from '../table-of-contents';
75
import { prefetchContent } from '../../lib/use-content';
86
import { 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}>&larr;&nbsp;</span>}
51-
{!start && <span class={style.icon}>&nbsp;&rarr;</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-
6234
export 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
}

src/components/content-region/style.module.css

Lines changed: 0 additions & 55 deletions
This file was deleted.

src/types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ declare global {
44
namespace preact.JSX {
55
interface IntrinsicElements {
66
'loading-bar': { showing: boolean };
7-
'content-region': { name: string; 'data-page-nav': boolean; 'can-edit': boolean, children: any };
7+
'content-region': { name: string; 'can-edit': boolean, children: any };
88
}
99
}
1010
}

0 commit comments

Comments
 (0)