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