Skip to content

Commit 916f10a

Browse files
committed
useClient
1 parent b6c8198 commit 916f10a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/site-isotype/index.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
import { useParallax } from "@atomico/hooks/use-parallax";
2-
import { c, css, useRef } from "atomico";
2+
import { c, css, useMemo, useRef, options, UseMemo } from "atomico";
33
import { SitePlanet } from "../site-planet";
44
import { tokensColor, tokensSize } from "../site-tokens";
55

6-
const isAndroid = navigator.userAgent.toLowerCase().includes("android");
6+
const useClient: UseMemo = (callback, args) =>
7+
useMemo(() => {
8+
if (options.ssr) return;
9+
return callback();
10+
}, args);
711

812
function siteIsotype() {
913
const host = useRef(globalThis);
1014
const state = useParallax(host);
15+
const isAndroid = useClient(
16+
() => navigator.userAgent.toLowerCase().includes("android"),
17+
[]
18+
);
19+
1120
return (
1221
<host shadowDom>
1322
<div class="atom-orbe" style="--orbe-size: 1.5; opacity:.5">

0 commit comments

Comments
 (0)