Skip to content

Commit e2deb1c

Browse files
committed
Add URL Params to SDK Reference Cards
1 parent e6845fc commit e2deb1c

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

src/components/SDKReferenceCards/index.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint-disable jsx-a11y/no-static-element-interactions */
22
/* eslint-disable jsx-a11y/click-events-have-key-events */
3-
import { useState } from "react";
3+
import { useEffect, useState } from "react";
4+
import { useHistory, useLocation } from "@docusaurus/router";
45

56
import { corekitsfa, corekitmfa, pnp, walletecosystems, helpersdks } from "../../common/SDKOptions";
67
import styles from "./styles.module.css";
@@ -1335,8 +1336,22 @@ export const providers = (
13351336
);
13361337

13371338
export default function QuickNavigation() {
1339+
const location = useLocation();
1340+
const queryParams = new URLSearchParams(location.search);
1341+
const history = useHistory();
13381342
const [product, setProduct] = useState<string>(pnp);
13391343

1344+
useEffect(() => {
1345+
history.push({ search: `product=${product}` });
1346+
}, [product]);
1347+
1348+
useEffect(() => {
1349+
const URLProduct = queryParams.get("product");
1350+
if (URLProduct) {
1351+
setProduct(URLProduct);
1352+
}
1353+
}, []);
1354+
13401355
return (
13411356
<div className={styles.container}>
13421357
<div className={styles.headingContainer}>

0 commit comments

Comments
 (0)