Bluesky app fork with some witchin' additions 馃挮
witchsky.app
bluesky
fork
client
1import {View} from 'react-native'
2import {msg} from '@lingui/core/macro'
3import {useLingui} from '@lingui/react'
4import {Trans} from '@lingui/react/macro'
5
6import {atoms as a} from '#/alf'
7import {Button, ButtonIcon, ButtonText} from '#/components/Button'
8import {Loader} from '#/components/Loader'
9
10export interface BackNextButtonsProps {
11 hideNext?: boolean
12 showRetry?: boolean
13 isLoading?: boolean
14 isNextDisabled?: boolean
15 onBackPress: () => void
16 onNextPress?: () => void
17 onRetryPress?: () => void
18 overrideNextText?: string
19}
20
21export function BackNextButtons({
22 hideNext,
23 showRetry,
24 isLoading,
25 isNextDisabled,
26 onBackPress,
27 onNextPress,
28 onRetryPress,
29 overrideNextText,
30}: BackNextButtonsProps) {
31 const {_} = useLingui()
32
33 return (
34 <View style={[a.flex_row, a.justify_between, a.pb_lg, a.pt_3xl]}>
35 <Button
36 label={_(msg`Go back to previous step`)}
37 variant="solid"
38 color="secondary"
39 size="large"
40 onPress={onBackPress}>
41 <ButtonText>
42 <Trans>Back</Trans>
43 </ButtonText>
44 </Button>
45 {!hideNext &&
46 (showRetry ? (
47 <Button
48 label={_(msg`Press to retry`)}
49 variant="solid"
50 color="primary"
51 size="large"
52 onPress={onRetryPress}>
53 <ButtonText>
54 <Trans>Retry</Trans>
55 </ButtonText>
56 {isLoading && <ButtonIcon icon={Loader} />}
57 </Button>
58 ) : (
59 <Button
60 testID="nextBtn"
61 label={_(msg`Continue to next step`)}
62 variant="solid"
63 color="primary"
64 size="large"
65 disabled={isLoading || isNextDisabled}
66 onPress={onNextPress}>
67 <ButtonText>
68 {overrideNextText ? overrideNextText : <Trans>Next</Trans>}
69 </ButtonText>
70 {isLoading && <ButtonIcon icon={Loader} />}
71 </Button>
72 ))}
73 </View>
74 )
75}