Skip to content

Commit

Permalink
feature: add go back link to header
Browse files Browse the repository at this point in the history
  • Loading branch information
byCedric committed Mar 17, 2024
1 parent 21899e3 commit 14d3280
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions webui/src/ui/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
import cn from 'classnames';
import { Link } from 'expo-router';
import { Link, useRouter } from 'expo-router';
import { HTMLAttributes, PropsWithChildren } from 'react';

export function LayoutNavigation({
children,
className,
}: PropsWithChildren & { className?: string }) {
const router = useRouter();

return (
<header
className={cn(
'h-16 flex flex-shrink-0 items-center justify-between gap-2 border-b border-b-secondary bg-default px-4',
className
)}
>
<Link href="/" aria-label="Go back to graph">
<ExpoLogoBig title="Expo" className="w-[74px] text-default max-md-gutters:hidden" />
<ExpoLogoSmall title="Expo" className="hidden text-default max-md-gutters:flex" />
</Link>
<div className="flex flex-row">
<Link className="mr-4" href="/" aria-label="Go back to graph">
<ExpoLogoBig title="Expo" className="w-[74px] text-default max-md-gutters:hidden" />
<ExpoLogoSmall title="Expo" className="hidden text-default max-md-gutters:flex" />
</Link>
{router.canGoBack() ? (
<a
className="text-link hover:underline"
href="#"
onClick={(event) => {
event.preventDefault();
router.back();
}}
>
← go back
</a>
) : null}
</div>
{children}
</header>
);
Expand Down

0 comments on commit 14d3280

Please sign in to comment.