Something went wrong. Try again.
Mirror — see github.com/blacksky-algorithms/blacksky.community
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293import {useContext} from 'react'import {type GestureResponderEvent, View} from 'react-native'import {msg} from '@lingui/core/macro'import {useLingui} from '@lingui/react'
import {HITSLOP_30} from '#/lib/constants'import {Logomark} from '#/view/icons/Logomark'import {atoms as a, platform, useGutters, useTheme} from '#/alf'import {Button, ButtonIcon, type ButtonProps} from '#/components/Button'import {ArrowLeft_Stroke2_Corner0_Rounded as ArrowLeft} from '#/components/icons/Arrow'import { BUTTON_VISUAL_ALIGNMENT_OFFSET, Header, HEADER_SLOT_SIZE,} from '#/components/Layout'import {IS_WEB} from '#/env'import {AuthLayoutNavigationContext} from '../context'
/** * This is a simplified version of `Layout.Header` for the auth screens. */
export const Slot = Header.Slot
export function Outer({children}: {children: React.ReactNode}) { const t = useTheme() const gutters = useGutters([0, 'wide'])
return ( <View style={[ a.w_full, a.flex_row, a.align_center, a.gap_sm, gutters, platform({ native: [a.pb_xs, {minHeight: 48}], web: [a.py_xs, {minHeight: 52}], }), t.atoms.border_contrast_low, ]}> {children} </View> )}
export function Content({children}: {children?: React.ReactNode}) { return ( <View style={[a.flex_1, a.justify_center, {minHeight: HEADER_SLOT_SIZE}]}> {IS_WEB ? children : <Logo />} </View> )}
export function Logo() { const t = useTheme()
return <Logomark fill={t.palette.primary_500} style={[a.mx_auto]} />}
export function BackButton({onPress, style, ...props}: Partial<ButtonProps>) { const {_} = useLingui() const navigation = useContext(AuthLayoutNavigationContext)
const onPressBack = (evt: GestureResponderEvent) => { onPress?.(evt) if (evt.defaultPrevented) return navigation?.goBack() }
return ( <Slot> <Button label={_(msg`Go back`)} onPress={onPressBack} size="small" variant="ghost" color="secondary" shape="round" hitSlop={HITSLOP_30} style={[ {marginLeft: -BUTTON_VISUAL_ALIGNMENT_OFFSET}, a.bg_transparent, style, ]} {...props}> <ButtonIcon icon={ArrowLeft} size="lg" /> </Button> </Slot> )}