forked from gnosischain/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
71 lines (62 loc) · 2.05 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import React, { useEffect, useState } from 'react';
import clsx from 'clsx';
import Layout from '@theme/Layout';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import styles from './index.module.css';
import HomepageFeatures from '@site/src/components/HomepageFeatures';
function HomepageHeader() {
const handleClickCopy = async () => {
try {
await navigator.clipboard.writeText('npx build-with-gnosis');
} catch (err) {
console.error(err);
}
}
return (
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className='container margin-vert--lg' id="intro">
<img src='img/gnosis-chain.svg' alt='Gnosis Chain' />
<h1 className='margin-vert--md'>Documentation</h1>
{/* <div className={clsx('margin-top--xl', styles.flexCol)} >
<h2>Deploy a Dapp in 5 Minutes</h2>
<span className={styles.copyField}>
npx build-with-gnosis
<button className={styles.iconButton} onClick={handleClickCopy}>
<img className={styles.icon} src='img/copy-icon.svg' alt='Copy' />
</button>
</span>
</div> */}
</div>
</header>
);
}
export default function Home() {
const { siteConfig } = useDocusaurusContext()
const [linePosition, setLinePosition] = useState(0)
useEffect(() => {
const updateNavbarPosition = () => {
const navbar = document.querySelector('.navbar')
if (navbar) {
const rect = navbar.getBoundingClientRect()
setLinePosition(rect.bottom)
}
}
window.addEventListener('scroll', updateNavbarPosition)
updateNavbarPosition()
return () => {
window.removeEventListener('scroll', updateNavbarPosition)
}
}, [])
return (
<Layout
title={`${siteConfig.title}`}
description={`${siteConfig.tagline}`}
>
<div className={clsx(styles.homePage)} >
<div className={clsx(styles.fixedLine)} style={{top: linePosition}}></div>
<HomepageHeader />
<HomepageFeatures />
</div>
</Layout>
);
}