Skip to content

Commit 486f9c2

Browse files
committed
review fixes
1 parent f3ca09e commit 486f9c2

File tree

10 files changed

+46
-18
lines changed

10 files changed

+46
-18
lines changed

src/pages/quick-start/builder/web/nextjs/stepContent/installation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Install Web3Auth
44

55
Install the Web3Auth package in your project.
66

7-
> Additionally, for blockchain calls, install the we're using `wagmi` and its dependency,
7+
> Additionally, for blockchain calls, we're using `wagmi` and its dependency,
88
> `@tanstack/react-query` for this example.
99
1010
```bash npm2yarn

src/pages/quick-start/builder/web/nextjs/stepContent/login.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
title: Logging in your User
33
---
44

5-
Use the `useConnect` hook from Web3Auth get access to the login functionality. The modal will prompt
5+
Use the `useWeb3AuthConnect` hook to get access to the login functionality. The modal will prompt
66
the user to login with their wallet and handle the authentication for you.

src/pages/quick-start/builder/web/nextjs/stepContent/logout.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
title: Log the user out
33
---
44

5-
Use the `useWeb3AuthDisconnect` hook from Web3Auth to log the user out. This will also delete the
6-
session information from the local storage of the browser.
5+
Use the `useWeb3AuthDisconnect` hook to log the user out. This will also delete the session
6+
information from the local storage of the browser.
77

88
:::info
99

src/pages/quick-start/builder/web/react/stepContent/installation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Install Web3Auth
44

55
Install the Web3Auth package in your project.
66

7-
> Additionally, for blockchain calls, install the we're using `wagmi` and its dependency,
7+
> Additionally, for blockchain calls, we're using `wagmi` and its dependency,
88
> `@tanstack/react-query` for this example.
99
1010
```bash npm2yarn

src/pages/quick-start/builder/web/react/stepContent/login.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
title: Logging in your User
33
---
44

5-
Use the `useConnect` hook from Web3Auth get access to the login functionality. The modal will prompt
5+
Use the `useWeb3AuthConnect` hook to get access to the login functionality. The modal will prompt
66
the user to login with their wallet and handle the authentication for you.

src/pages/quick-start/builder/web/react/stepContent/logout.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
title: Log the user out
33
---
44

5-
Use the `useWeb3AuthDisconnect` hook from Web3Auth to log the user out. This will also delete the
6-
session information from the local storage of the browser.
5+
Use the `useWeb3AuthDisconnect` hook to log the user out. This will also delete the session
6+
information from the local storage of the browser.
77

88
:::info
99

src/pages/quick-start/builder/web/vue/stepContent/installation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Install Web3Auth
44

55
Install the Web3Auth package in your project.
66

7-
> Additionally, for blockchain calls, install the we're using `@wagmi/vue` and its dependency,
7+
> Additionally, for blockchain calls, we're using `@wagmi/vue` and its dependency,
88
> `@tanstack/vue-query` for this example.
99
1010
```bash npm2yarn

src/pages/quick-start/builder/web/vue/stepContent/login.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
title: Logging in your User
33
---
44

5-
Use the `useConnect` hook from Web3Auth get access to the login functionality. The modal will prompt
6-
the user to login with their wallet and handle the authentication for you.
5+
Use the `useWeb3AuthConnect` composable to get access to the login functionality. The modal will
6+
prompt the user to login with their wallet and handle the authentication for you.

src/pages/quick-start/builder/web/vue/stepContent/logout.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
title: Log the user out
33
---
44

5-
Use the `useWeb3AuthDisconnect` hook from Web3Auth to log the user out. This will also delete the
6-
session information from the local storage of the browser.
5+
Use the `useWeb3AuthDisconnect` composable to log the user out. This will also delete the session
6+
information from the local storage of the browser.
77

88
:::info
99

src/theme/IntegrationBuilderCodeView/index.tsx

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import rangeParser from "parse-numeric-range";
44
import path from "path";
55
import { FiFile } from "react-icons/fi";
66
import { animated, useSpring } from "react-spring";
7+
import { useEffect, useState } from "react";
78

89
import styles from "./styles.module.css";
910

@@ -23,7 +24,10 @@ const getDisplayName = (filename: string): string => {
2324
const getLanguage = (filename: string): string => {
2425
const ext = path.extname(filename).substr(1);
2526

26-
if (["jsx", "java", "swift", "ts", "tsx", "html", "css", "xml", "dart", "json", "cs"].includes(ext)) return `language-${ext}`;
27+
if (
28+
["jsx", "java", "swift", "ts", "tsx", "html", "css", "xml", "dart", "json", "cs"].includes(ext)
29+
)
30+
return `language-${ext}`;
2731
if (ext === "js") return "language-jsx";
2832
if (ext === "vue") return "language-ts";
2933
if (ext === "gradle") return "language-groovy";
@@ -34,13 +38,35 @@ const getLanguage = (filename: string): string => {
3438
return undefined;
3539
};
3640

37-
export default function IntegrationBuilderCodeView({ selectedFilename, filenames, fileContents, highlight, onClickFilename }: Props) {
41+
export default function IntegrationBuilderCodeView({
42+
selectedFilename,
43+
filenames,
44+
fileContents,
45+
highlight,
46+
onClickFilename,
47+
}: Props) {
3848
const highlightLines = rangeParser(highlight || "0");
39-
const props = useSpring({ scroll: Math.max(highlightLines[0] * 15, 0) }); // 22 is line height, 64 is offset to scroll the line close to top
49+
const [viewportHeight, setViewportHeight] = useState(800);
50+
51+
useEffect(() => {
52+
setViewportHeight(window.innerHeight);
53+
54+
const handleResize = () => setViewportHeight(window.innerHeight);
55+
window.addEventListener("resize", handleResize);
56+
return () => window.removeEventListener("resize", handleResize);
57+
}, []);
58+
59+
const props = useSpring({
60+
scroll: Math.max(highlightLines[0] * 15 - viewportHeight / 3, 0),
61+
}); // 15 is line height, position at roughly 1/3 of the viewport
4062
return (
4163
<div className={styles.container}>
4264
<div className={styles.header}>
43-
<ul className={classNames("tabs", styles.codeTabs)} role="tablist" aria-orientation="horizontal">
65+
<ul
66+
className={classNames("tabs", styles.codeTabs)}
67+
role="tablist"
68+
aria-orientation="horizontal"
69+
>
4470
{filenames.map((filename) => (
4571
<li
4672
key={filename}
@@ -58,7 +84,9 @@ export default function IntegrationBuilderCodeView({ selectedFilename, filenames
5884
</ul>
5985
</div>
6086
<animated.div className={styles.body} scrollTop={props.scroll}>
61-
<CodeBlock className={getLanguage(selectedFilename)}>{fileContents[selectedFilename]}</CodeBlock>
87+
<CodeBlock className={getLanguage(selectedFilename)}>
88+
{fileContents[selectedFilename]}
89+
</CodeBlock>
6290
</animated.div>
6391
</div>
6492
);

0 commit comments

Comments
 (0)