website: use <ClientOnly> to prevent issues during SSR

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-03-18 23:41:20 +01:00
parent fe054136b1
commit d8841911de
1 changed files with 19 additions and 14 deletions

View File

@ -2,6 +2,7 @@ import React from "react";
import clsx from "clsx"; import clsx from "clsx";
import Layout from "@theme/Layout"; import Layout from "@theme/Layout";
import Link from "@docusaurus/Link"; import Link from "@docusaurus/Link";
import ClientOnly from "@docusaurus/core/lib/client/exports/ClientOnly.js";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import useBaseUrl from "@docusaurus/useBaseUrl"; import useBaseUrl from "@docusaurus/useBaseUrl";
import styles from "./styles.module.css"; import styles from "./styles.module.css";
@ -102,6 +103,7 @@ function Home() {
<div className="row"> <div className="row">
<div className="col col--5"> <div className="col col--5">
<div> <div>
<ClientOnly>
<BeforeAfterSlider <BeforeAfterSlider
className={styles.featureImage} className={styles.featureImage}
before={useBaseUrl("img/screen_apps_light.png")} before={useBaseUrl("img/screen_apps_light.png")}
@ -109,6 +111,7 @@ function Home() {
width={640} width={640}
height={480} height={480}
/> />
</ClientOnly>
</div> </div>
</div> </div>
<div className="col col--5 col--offset-2 padding-vert--xl"> <div className="col col--5 col--offset-2 padding-vert--xl">
@ -139,6 +142,7 @@ function Home() {
</div> </div>
<div className="col col--5"> <div className="col col--5">
<div> <div>
<ClientOnly>
<BeforeAfterSlider <BeforeAfterSlider
className={styles.featureImage} className={styles.featureImage}
before={useBaseUrl("img/screen_admin_light.png")} before={useBaseUrl("img/screen_admin_light.png")}
@ -146,6 +150,7 @@ function Home() {
width={640} width={640}
height={480} height={480}
/> />
</ClientOnly>
</div> </div>
</div> </div>
</div> </div>