MCPcopy Create free account
hub / github.com/dailydotdev/apps / GoBackButton

Function GoBackButton

packages/shared/src/components/post/GoBackHeaderMobile.tsx:27–62  ·  view source on GitHub ↗
({
  className,
  showLogo = true,
}: WithClassNameProps & {
  showLogo?: boolean;
})

Source from the content-addressed store, hash-verified

25};
26
27export 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
64export function GoBackHeaderMobile({
65 children,

Callers

nothing calls this directly

Calls 4

useFeatureThemeFunction · 0.90
checkSameSiteFunction · 0.85
pushMethod · 0.80
useRouterFunction · 0.50

Tested by

no test coverage detected