-
-
Notifications
You must be signed in to change notification settings - Fork 523
refactor: config file TBD #1348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
11c4914
6b7db8b
358ada0
fddf290
325eeb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,6 @@ | ||
| import { useEffect } from 'preact/hooks'; | ||
| import Markup from 'preact-markup'; | ||
| import widgets from '../widgets'; | ||
| import style from './style.module.css'; | ||
| import { useTranslation } from '../../lib/i18n'; | ||
| import { TocContext } from '../table-of-contents'; | ||
| import { prefetchContent } from '../../lib/use-content'; | ||
| import { ReplPage, TutorialPage, CodeEditor } from '../routes'; | ||
|
|
@@ -33,34 +31,7 @@ const COMPONENTS = { | |
| } | ||
| }; | ||
|
|
||
| function SiblingNav({ route, lang, start }) { | ||
| let title = ''; | ||
| let url = ''; | ||
| if (route) { | ||
| url = route.path.toLowerCase(); | ||
| title = | ||
| typeof route.name === 'object' | ||
| ? route.name[lang || 'en'] | ||
| : route.name || route.title; | ||
| } | ||
| const label = useTranslation(start ? 'previous' : 'next'); | ||
|
|
||
| return ( | ||
| <a class={style.nextLink} data-dir-end={!start} href={url}> | ||
| {start && <span class={style.icon}>← </span>} | ||
| {!start && <span class={style.icon}> →</span>} | ||
| <span class={style.nextInner}> | ||
| <span class={style.nextTitle}> | ||
| <span class={style.nextTitleInner}>{title}</span> | ||
| </span> | ||
| <span class={style.nextUrl}>{label}</span> | ||
| </span> | ||
| </a> | ||
| ); | ||
| } | ||
|
|
||
|
Comment on lines
-36
to
-61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whilst looking at our use of |
||
| export default function ContentRegion({ content, components, ...props }) { | ||
| const hasNav = !!(props.next || props.prev); | ||
| components = Object.assign({}, COMPONENTS, components); | ||
|
|
||
| useEffect(() => { | ||
|
|
@@ -73,7 +44,7 @@ export default function ContentRegion({ content, components, ...props }) { | |
| }, [props.current]); | ||
|
|
||
| return ( | ||
| <content-region name={props.current} data-page-nav={hasNav} can-edit={props.canEdit}> | ||
| <content-region name={props.current} can-edit={props.canEdit}> | ||
| {content && ( | ||
| <TocContext.Provider value={{ toc: props.toc }}> | ||
| <Markup | ||
|
|
@@ -84,20 +55,6 @@ export default function ContentRegion({ content, components, ...props }) { | |
| /> | ||
| </TocContext.Provider> | ||
| )} | ||
| {hasNav && ( | ||
| <div class={style.nextWrapper}> | ||
| {props.prev ? ( | ||
| <SiblingNav start lang={props.lang} route={props.prev} /> | ||
| ) : ( | ||
| <span /> | ||
| )} | ||
| {props.next ? ( | ||
| <SiblingNav lang={props.lang} route={props.next} /> | ||
| ) : ( | ||
| <span /> | ||
| )} | ||
| </div> | ||
| )} | ||
| </content-region> | ||
| ); | ||
| } | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ | |
| "tr": "Turkish", | ||
| "zh": "简体中文" | ||
| }, | ||
| "repo": "preact", | ||
| "repo": "preactjs/preact", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not against just inlining the string altogether, but if we do have it hoisted to our app-wide config, feels like org + repo makes more sense. |
||
| "docsearch": { | ||
| "apiKey": "842e1531d4af13c18b4718c456e386b2", | ||
| "indexName": "preact", | ||
|
|
@@ -56,26 +56,24 @@ | |
| "selectYourLanguage": { | ||
| "en": "Select your language" | ||
| }, | ||
| "tutorial": { | ||
| "begin": { | ||
| "en": "Begin Tutorial", | ||
| "kr": "튜토리얼 시작", | ||
| "ru": "Начать обучение", | ||
| "zh": "开始教程" | ||
| }, | ||
| "help": { | ||
| "en": "Help", | ||
| "ja": "助ける", | ||
| "kr": "정답 확인", | ||
| "ru": "Помощь", | ||
| "zh": "帮助" | ||
| }, | ||
| "solve": { | ||
| "en": "Solve", | ||
| "ja": "説き明かす", | ||
| "ru": "Решить", | ||
| "zh": "解决" | ||
| } | ||
| "beginTutorial": { | ||
| "en": "Begin Tutorial", | ||
| "kr": "튜토리얼 시작", | ||
| "ru": "Начать обучение", | ||
| "zh": "开始教程" | ||
| }, | ||
| "help": { | ||
| "en": "Help", | ||
| "ja": "助ける", | ||
| "kr": "정답 확인", | ||
| "ru": "Помощь", | ||
| "zh": "帮助" | ||
| }, | ||
| "solve": { | ||
| "en": "Solve", | ||
| "ja": "説き明かす", | ||
| "ru": "Решить", | ||
| "zh": "解决" | ||
|
Comment on lines
-59
to
+76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Flattening this out makes it a bit easier & more consistent to access ( |
||
| } | ||
| }, | ||
| "nav": [ | ||
|
|
@@ -1092,23 +1090,5 @@ | |
| "en": "Congratulations!" | ||
| } | ||
| } | ||
| ], | ||
| "branding": [ | ||
| { | ||
| "name": "logo-text", | ||
| "alt": "Full Logo" | ||
| }, | ||
| { | ||
| "name": "logo-text-inverted", | ||
| "alt": "Full Logo with Inverted Colors" | ||
| }, | ||
| { | ||
| "name": "symbol", | ||
| "alt": "Preact Symbol" | ||
| }, | ||
| { | ||
| "name": "symbol-inverted", | ||
| "alt": "Preact Symbol with Inverted Colors" | ||
| } | ||
| ] | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hoisting this out of the component made little sense, this was the only consumer (I wrote this, to be clear -- dunno why I did, but I did)