1
0
Fork 0
blog/src/pages/thanks.tsx

79 lines
2.1 KiB
TypeScript
Raw Normal View History

2019-11-23 14:00:07 +01:00
import React from 'react'
import loadable from '@loadable/component'
import shortid from 'shortid'
2020-04-11 23:37:19 +02:00
import { Helmet } from 'react-helmet'
2019-11-22 21:26:50 +01:00
import { Web3ReactProvider } from '@web3-react/core'
import { Author } from '../@types/Site'
import { useSiteMetadata } from '../hooks/use-site-metadata'
2019-11-22 21:26:50 +01:00
import { getLibrary } from '../hooks/use-web3'
import Qr from '../components/atoms/Qr'
import Icon from '../components/atoms/Icon'
import styles from './thanks.module.scss'
2019-11-22 21:26:50 +01:00
const LazyWeb3Donation = loadable(() =>
2019-11-23 14:00:07 +01:00
import('../components/molecules/Web3Donation')
)
const Coin = ({ address, author }: { address: string; author: Author }) => (
<div className={styles.coin}>
<Qr title={address} address={(author as any)[address]} />
</div>
)
const BackButton = () => (
<button
className={`link ${styles.buttonBack}`}
onClick={() => window.history.back()}
>
<Icon name="ChevronLeft" /> Go Back
</button>
)
export default function Thanks() {
const { author } = useSiteMetadata()
const coins = Object.keys(author).filter(
2020-03-22 00:04:22 +01:00
(key) => key === 'bitcoin' || key === 'ether'
)
return (
<>
<Helmet>
<title>Say thanks</title>
<meta name="robots" content="noindex,nofollow" />
</Helmet>
<article className={styles.thanks}>
<BackButton />
<header>
<h1 className={styles.title}>Say Thanks</h1>
</header>
2019-11-22 21:26:50 +01:00
<div className={styles.web3}>
<header>
<h4>Web3 Wallet</h4>
<p>Send Ether with MetaMask or Brave.</p>
</header>
2019-11-23 14:00:07 +01:00
<Web3ReactProvider getLibrary={getLibrary}>
<LazyWeb3Donation
fallback={<div className={styles.loading}>Loading...</div>}
address={author.ether}
/>
</Web3ReactProvider>
2019-11-22 21:26:50 +01:00
</div>
2019-11-22 21:26:50 +01:00
<div className={styles.coins}>
<header>
<h4>Any other wallets</h4>
<p>Send Bitcoin or Ether from any wallet.</p>
</header>
{coins.map((address: string) => (
<Coin key={shortid.generate()} address={address} author={author} />
))}
</div>
</article>
</>
)
}