From 8cd629a33b3cfbeed7212568242c4fce79167613 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sat, 23 Nov 2019 14:00:07 +0100 Subject: [PATCH] fallbacks --- src/components/atoms/Time.tsx | 34 +++++++++++++++++++++++------ src/pages/thanks.tsx | 40 +++++++++++++++++------------------ 2 files changed, 46 insertions(+), 28 deletions(-) diff --git a/src/components/atoms/Time.tsx b/src/components/atoms/Time.tsx index c46e3d3e..2c3a173e 100644 --- a/src/components/atoms/Time.tsx +++ b/src/components/atoms/Time.tsx @@ -3,18 +3,38 @@ import loadable from '@loadable/component' const LazyDate = loadable.lib(() => import('date-fns')) +function TimeMarkup({ + date, + format, + formatDistance +}: { + date: Date + format?: any + formatDistance?: any +}) { + const dateIso = date.toISOString() + + return ( + + ) +} + export default function Time({ date }: { date: string }) { const dateNew = new Date(date) return ( - + }> {({ format, formatDistance }) => ( - + )} ) diff --git a/src/pages/thanks.tsx b/src/pages/thanks.tsx index 12d9f273..965f7d0e 100644 --- a/src/pages/thanks.tsx +++ b/src/pages/thanks.tsx @@ -1,4 +1,5 @@ -import React, { lazy, Suspense } from 'react' +import React from 'react' +import loadable from '@loadable/component' import shortid from 'shortid' import Helmet from 'react-helmet' import { Author } from '../@types/Site' @@ -7,7 +8,9 @@ import Qr from '../components/atoms/Qr' import Icon from '../components/atoms/Icon' import styles from './thanks.module.scss' -const Web3Donation = lazy(() => import('../components/molecules/Web3Donation')) +const Web3Donation = loadable(() => + import('../components/molecules/Web3Donation') +) const Coin = ({ address, author }: { address: string; author: Author }) => (
@@ -29,7 +32,6 @@ export default function Thanks() { const coins = Object.keys(author).filter( key => key === 'bitcoin' || key === 'ether' ) - const isSSR = typeof window === 'undefined' return ( <> @@ -43,26 +45,22 @@ export default function Thanks() {

Say Thanks

- {!isSSR && ( - Loading...
}> - -
-
-

Any other wallets

-

Send Bitcoin or Ether from any wallet.

-
+ Loading...
} + address={author.ether} + /> - {coins.map((address: string) => ( - - ))} - - - )} +
+
+

Any other wallets

+

Send Bitcoin or Ether from any wallet.

+
+ + {coins.map((address: string) => ( + + ))} +
)