diff --git a/content/de/index.md b/content/de/index.md index c3d2975a0..f19a4057c 100755 --- a/content/de/index.md +++ b/content/de/index.md @@ -1,7 +1,6 @@ --- layout: home title: Preact -toc: false --- diff --git a/content/en/index.md b/content/en/index.md index bcd80a39f..0b0f64b1f 100755 --- a/content/en/index.md +++ b/content/en/index.md @@ -1,7 +1,6 @@ --- layout: home title: Preact -toc: false description: 'Fast 3kB alternative to React with the same modern API.' --- diff --git a/content/es/index.md b/content/es/index.md index e240399fd..9045f3558 100755 --- a/content/es/index.md +++ b/content/es/index.md @@ -1,7 +1,6 @@ --- layout: home title: Preact -toc: false --- diff --git a/content/fr/index.md b/content/fr/index.md index e7da46220..d9bdd34ee 100755 --- a/content/fr/index.md +++ b/content/fr/index.md @@ -1,7 +1,6 @@ --- layout: home title: Preact -toc: false --- diff --git a/content/it/index.md b/content/it/index.md index 41c237096..a66610792 100755 --- a/content/it/index.md +++ b/content/it/index.md @@ -1,7 +1,6 @@ --- layout: home title: Preact -toc: false --- diff --git a/content/ja/index.md b/content/ja/index.md index 0ce068aae..2517beba9 100755 --- a/content/ja/index.md +++ b/content/ja/index.md @@ -1,7 +1,6 @@ --- layout: home title: Preact -toc: false description: 'Preact is a fast 3kB alternative to React with the same modern API' --- diff --git a/content/kr/index.md b/content/kr/index.md index 3e84907cb..bad34726a 100644 --- a/content/kr/index.md +++ b/content/kr/index.md @@ -1,7 +1,6 @@ --- layout: home title: Preact -toc: false description: 'Fast 3kB alternative to React with the same modern API.' --- diff --git a/content/pt-br/index.md b/content/pt-br/index.md index ea773a46b..279e48ed1 100755 --- a/content/pt-br/index.md +++ b/content/pt-br/index.md @@ -1,7 +1,6 @@ --- layout: home title: Preact -toc: false --- diff --git a/content/ru/index.md b/content/ru/index.md index aaa86780a..6f92d421f 100644 --- a/content/ru/index.md +++ b/content/ru/index.md @@ -1,7 +1,6 @@ --- layout: home title: Preact -toc: false description: 'Быстрая 3КБ-альтернатива React с тем же современным API.' --- diff --git a/content/tr/index.md b/content/tr/index.md index fa48fb9bc..702ede75c 100755 --- a/content/tr/index.md +++ b/content/tr/index.md @@ -1,7 +1,6 @@ --- layout: home title: Preact -toc: false --- diff --git a/content/zh/index.md b/content/zh/index.md index 132c87353..afafef23d 100755 --- a/content/zh/index.md +++ b/content/zh/index.md @@ -1,7 +1,6 @@ --- layout: home title: Preact -toc: false description: 'React 的 3kb 轻量级替代方案,拥有相同的现代 API。' --- diff --git a/src/components/code-block/index.jsx b/src/components/code-block/index.jsx index e80b9148c..d05406247 100644 --- a/src/components/code-block/index.jsx +++ b/src/components/code-block/index.jsx @@ -1,6 +1,7 @@ import { useMemo } from 'preact/hooks'; +import { Suspense } from 'preact/compat'; import { wrap } from 'comlink'; -import { FakeSuspense, useResource } from '../../lib/use-resource'; +import { useResource } from '../../lib/use-resource'; let prismWorker; @@ -75,9 +76,9 @@ function HighlightedCodeBlock({ code, lang }) { return (
-				
+				
 					
-				
+				
 			
{repl && ( diff --git a/src/components/controllers/blog-page.jsx b/src/components/controllers/blog-page.jsx index df1a9b9f4..0dc189459 100644 --- a/src/components/controllers/blog-page.jsx +++ b/src/components/controllers/blog-page.jsx @@ -1,4 +1,4 @@ -import { useRoute, useLocation } from 'preact-iso'; +import { useRoute } from 'preact-iso'; import { useContent } from '../../lib/use-resource'; import { useTitle, useDescription } from './utils'; import { NotFound } from './not-found'; @@ -20,7 +20,7 @@ export default function BlogPage() { } function BlogLayout() { - const { path } = useLocation(); + const { path } = useRoute(); const [lang] = useLanguage(); const { html, meta } = useContent([lang, path === '/' ? 'index' : path]); diff --git a/src/components/controllers/doc-page.jsx b/src/components/controllers/doc-page.jsx index 6a8b462d7..3fb248343 100644 --- a/src/components/controllers/doc-page.jsx +++ b/src/components/controllers/doc-page.jsx @@ -1,15 +1,15 @@ -import { useRoute, useLocation } from 'preact-iso'; +import { useRoute } from 'preact-iso'; import { useContent } from '../../lib/use-resource'; import { useTitle, useDescription } from './utils'; import config from '../../config.json'; import { NotFound } from './not-found'; import cx from '../../lib/cx'; -import { LATEST_MAJOR, isDocPage } from '../../lib/docs'; import { useLanguage } from '../../lib/i18n'; import { MarkdownRegion } from './markdown-region'; import Sidebar from '../sidebar'; import Footer from '../footer/index'; import { docRoutes } from '../../lib/route-utils'; +import { LATEST_MAJOR } from '../doc-version'; import style from './style.module.css'; export function DocPage() { @@ -20,29 +20,27 @@ export function DocPage() { return ; } - return ; + return ; } -export function DocLayout() { - const { path } = useLocation(); +export function DocLayout({ isGuide = false }) { + const { path } = useRoute(); const [lang] = useLanguage(); const { html, meta } = useContent([lang, path === '/' ? 'index' : path]); useTitle(meta.title); useDescription(meta.description); - const hasSidebar = meta.toc !== false && isDocPage(path); - return ( -
+
- {hasSidebar && ( + {isGuide && (
)}
- + {isGuide && }
@@ -53,9 +51,8 @@ export function DocLayout() { function OldDocsWarning() { const { name, version } = useRoute().params; - const { path } = useLocation(); - if (!isDocPage(path) || version === LATEST_MAJOR) { + if (version === LATEST_MAJOR) { return null; } diff --git a/src/components/controllers/markdown-region.jsx b/src/components/controllers/markdown-region.jsx index 19d923202..11f3dc940 100644 --- a/src/components/controllers/markdown-region.jsx +++ b/src/components/controllers/markdown-region.jsx @@ -1,4 +1,4 @@ -import { useLocation } from 'preact-iso'; +import { useRoute } from 'preact-iso'; import EditThisPage from '../edit-button'; import ContentRegion from '../content-region'; import BlogMeta from '../blog-meta'; @@ -10,7 +10,7 @@ import BlogMeta from '../blog-meta'; * @propery {any} [components] */ export function MarkdownRegion({ html, meta, components }) { - const { path } = useLocation(); + const { path } = useRoute(); const canEdit = path !== '/' && !path.startsWith('/tutorial'); const isBlogArticle = path.startsWith('/blog/'); diff --git a/src/components/controllers/tutorial-page.jsx b/src/components/controllers/tutorial-page.jsx index 1092f57b8..faa216ab8 100644 --- a/src/components/controllers/tutorial-page.jsx +++ b/src/components/controllers/tutorial-page.jsx @@ -1,4 +1,4 @@ -import { useRoute, useLocation } from 'preact-iso'; +import { useRoute } from 'preact-iso'; import { SolutionProvider } from './tutorial/contexts'; import { useContent } from '../../lib/use-resource'; import { useTitle, useDescription } from './utils'; @@ -19,8 +19,7 @@ export default function TutorialPage() { } function TutorialLayout() { - const { path } = useLocation(); - const { params } = useRoute(); + const { path, params } = useRoute(); const [lang] = useLanguage(); const { html, meta } = useContent([lang, !params.step ? 'tutorial/index' : path]); diff --git a/src/components/controllers/tutorial/index.jsx b/src/components/controllers/tutorial/index.jsx index c85d77363..f832cadaf 100644 --- a/src/components/controllers/tutorial/index.jsx +++ b/src/components/controllers/tutorial/index.jsx @@ -8,7 +8,7 @@ import { useMemo, useCallback } from 'preact/hooks'; -import { useLocation } from 'preact-iso'; +import { useRoute } from 'preact-iso'; import linkState from 'linkstate'; import { TutorialContext, SolutionContext } from './contexts'; import cx from '../../../lib/cx'; @@ -168,7 +168,7 @@ function TutorialView({ const [showCodeOverride, toggleCode] = useReducer(s => !s, true); - const { url } = useLocation(); + const { path } = useRoute(); const [lang] = useLanguage(); const { solved } = useContext(SolutionContext); @@ -183,7 +183,7 @@ function TutorialView({ if (!loading && !initialLoad) { content.current.scrollTo(0, 0); } - }, [url, loading, initialLoad]); + }, [path, loading, initialLoad]); const reRun = useCallback(() => { let code = tutorial.state.code; @@ -211,7 +211,7 @@ function TutorialView({
{!initialLoad && ( { @@ -28,7 +30,7 @@ export default function DocVersion() { Version:{' '}