|
| 1 | +import React from 'react'; |
| 2 | +import { StyleSheet, View } from 'react-native'; |
| 3 | +import PropTypes from 'prop-types'; |
| 4 | +import Background from '../component/background'; |
| 5 | +import { Text, H1Text, CopyText } from '../component/text'; |
| 6 | +import MainContent from '../component/main-content'; |
| 7 | +import { ResizeableSpinner } from '../component/spinner'; |
| 8 | +import { DownButton } from '../component/button'; |
| 9 | +import { color, font } from '../component/style'; |
| 10 | + |
| 11 | +const styles = StyleSheet.create({ |
| 12 | + content: { |
| 13 | + alignItems: 'center', |
| 14 | + }, |
| 15 | + downBtn: { |
| 16 | + margin: 25, |
| 17 | + }, |
| 18 | +}); |
| 19 | + |
| 20 | +const LoaderSyncingView = ({ store }) => ( |
| 21 | + <Background color={color.blackDark}> |
| 22 | + <MainContent style={styles.content}> |
| 23 | + <LoadNetworkSpinner |
| 24 | + percentage={store.percentSynced} |
| 25 | + msg={store.loadingMsg} |
| 26 | + /> |
| 27 | + <CopySection /> |
| 28 | + <DownButton onPress={() => {}} style={styles.downBtn}> |
| 29 | + Learn More |
| 30 | + </DownButton> |
| 31 | + </MainContent> |
| 32 | + </Background> |
| 33 | +); |
| 34 | + |
| 35 | +LoaderSyncingView.propTypes = { |
| 36 | + store: PropTypes.object.isRequired, |
| 37 | +}; |
| 38 | + |
| 39 | +// |
| 40 | +// Load Network Spinner |
| 41 | +// |
| 42 | + |
| 43 | +const size = 80; |
| 44 | +const progressWidth = 3; |
| 45 | + |
| 46 | +const loadNetworkStyles = StyleSheet.create({ |
| 47 | + spinner: { |
| 48 | + margin: 20, |
| 49 | + }, |
| 50 | + bolt: { |
| 51 | + height: 126 / 4.5, |
| 52 | + width: 64 / 4.5, |
| 53 | + }, |
| 54 | + copy: { |
| 55 | + fontSize: font.sizeXS, |
| 56 | + marginTop: 5, |
| 57 | + color: color.white, |
| 58 | + textAlign: 'center', |
| 59 | + }, |
| 60 | +}); |
| 61 | + |
| 62 | +export const LoadNetworkSpinner = ({ percentage, msg }) => ( |
| 63 | + <View style={loadNetworkStyles.spinner}> |
| 64 | + <ResizeableSpinner |
| 65 | + percentage={percentage} |
| 66 | + size={size} |
| 67 | + progressWidth={progressWidth} |
| 68 | + gradient="loadNetworkGrad" |
| 69 | + icon="lightning-bolt" |
| 70 | + iconStyles={loadNetworkStyles.bolt} |
| 71 | + /> |
| 72 | + <Text style={loadNetworkStyles.copy}>{msg}</Text> |
| 73 | + </View> |
| 74 | +); |
| 75 | + |
| 76 | +LoadNetworkSpinner.propTypes = { |
| 77 | + percentage: PropTypes.number.isRequired, |
| 78 | + msg: PropTypes.string.isRequired, |
| 79 | +}; |
| 80 | + |
| 81 | +// |
| 82 | +// Copy Section |
| 83 | +// |
| 84 | + |
| 85 | +const copyStyles = StyleSheet.create({ |
| 86 | + wrapper: { |
| 87 | + flex: 1, |
| 88 | + justifyContent: 'center', |
| 89 | + alignItems: 'center', |
| 90 | + }, |
| 91 | + title: { |
| 92 | + textAlign: 'center', |
| 93 | + marginTop: 30, |
| 94 | + }, |
| 95 | + copyTxt: { |
| 96 | + textAlign: 'center', |
| 97 | + marginTop: 10, |
| 98 | + maxWidth: 450, |
| 99 | + paddingBottom: 30, |
| 100 | + }, |
| 101 | +}); |
| 102 | + |
| 103 | +const CopySection = () => ( |
| 104 | + <View style={copyStyles.wrapper}> |
| 105 | + <H1Text style={copyStyles.title}>Almost there</H1Text> |
| 106 | + <CopyText style={copyStyles.copyTxt}> |
| 107 | + { |
| 108 | + "Why not learn more about what we're doing at Lightning Labs? Or grab a coffee. This could take about 30 minutes." |
| 109 | + } |
| 110 | + </CopyText> |
| 111 | + </View> |
| 112 | +); |
| 113 | + |
| 114 | +export default LoaderSyncingView; |
0 commit comments