({
className,
showLogo = true,
}: WithClassNameProps & {
showLogo?: boolean;
})
| 25 | }; |
| 26 | |
| 27 | export const GoBackButton = ({ |
| 28 | className, |
| 29 | showLogo = true, |
| 30 | }: WithClassNameProps & { |
| 31 | showLogo?: boolean; |
| 32 | }): JSX.Element | null => { |
| 33 | const router = useRouter(); |
| 34 | const goHome = useCallback(() => router.push('/'), [router]); |
| 35 | const featureTheme = useFeatureTheme(); |
| 36 | |
| 37 | const canGoBack = |
| 38 | globalThis?.history?.length > 1 && (checkSameSite() || isDevelopment); |
| 39 | |
| 40 | const logoButton = showLogo ? ( |
| 41 | <Logo |
| 42 | className="my-2" |
| 43 | onLogoClick={goHome} |
| 44 | position={LogoPosition.Initial} |
| 45 | featureTheme={featureTheme} |
| 46 | /> |
| 47 | ) : null; |
| 48 | |
| 49 | return canGoBack ? ( |
| 50 | <Button |
| 51 | icon={<ArrowIcon className="-rotate-90" />} |
| 52 | size={ButtonSize.Small} |
| 53 | variant={ButtonVariant.Tertiary} |
| 54 | onClick={router.back} |
| 55 | className={className} |
| 56 | type="button" |
| 57 | aria-label="Go back" |
| 58 | /> |
| 59 | ) : ( |
| 60 | logoButton |
| 61 | ); |
| 62 | }; |
| 63 | |
| 64 | export function GoBackHeaderMobile({ |
| 65 | children, |
nothing calls this directly
no test coverage detected