Skip to content

Commit

Permalink
Revert "Chore: try without motion div"
Browse files Browse the repository at this point in the history
This reverts commit 2d515e8.
  • Loading branch information
emielvanseveren committed Jun 8, 2024
1 parent 2d515e8 commit 79171aa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC, Fragment } from 'react';
import { FC } from 'react';
import { Link, LinkProps } from '@tanstack/react-router';
import { NavBar } from './style';
import { Block, NavBar, Underline } from './style';

export type HorizontalNavVariant = 'underline' | 'block';

Expand All @@ -19,18 +19,15 @@ export const HorizontalNav: FC<HorizontalNavProps> = ({ links, variant }) => {
return (
<NavBar variant={variant}>
{links.map(({ text, to, params }) => {
const baseKey = JSON.stringify(to + params);
return (
<Link
key={`${baseKey}-link`}
to={to}
params={{ params }}
activeOptions={{ exact: true }}
activeProps={{ className: 'active' }}
>
<Fragment key={`${baseKey}-container`}>
<span key={`${baseKey}-text`}>{text}</span>
</Fragment>
<Link to={to} params={{ params }}>
{({ isActive }) => (
<>
{isActive && variant === 'block' && <Block layoutId="block" />}
{isActive && variant === 'underline' && <Underline layoutId="underline" />}
<span>{text}</span>
</>
)}
</Link>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@ export const NavBar = styled.nav<{ variant: HorizontalNavVariant }>`
&.active {
color: ${({ theme }) => theme.colors.text};
&::after {
content: '';
position: absolute;
bottom: -${({ theme }) => theme.spacing['0_75']};
left: 0;
width: 100%;
height: 2px;
background-color: ${({ theme }) => theme.colors.primary};
}
}
}
`;
Expand Down
17 changes: 15 additions & 2 deletions packages/web-main/src/routes/_auth/_global/player.$playerId.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Stats, styled, Skeleton, useTheme, Avatar, getInitials, HorizontalNav } from '@takaro/lib-components';
import { Outlet, redirect, createFileRoute } from '@tanstack/react-router';
import { Stats, styled, Skeleton, useTheme, Avatar, getInitials } from '@takaro/lib-components';
import { Outlet, redirect, createFileRoute, Link } from '@tanstack/react-router';
import { DateTime } from 'luxon';
import { playerQueryOptions } from 'queries/player';
import { playersOnGameServersQueryOptions } from 'queries/pog';
Expand Down Expand Up @@ -78,6 +78,18 @@ function Component() {
</div>
</Header>

<div>
<Link to="/player/$playerId/info" params={{ playerId }}>
info
</Link>
<Link to="/player/$playerId/events" params={{ playerId }}>
events
</Link>
<Link to="/player/$playerId/economy" params={{ playerId }}>
economy
</Link>
</div>
{/*
<HorizontalNav
links={[
{
Expand All @@ -99,6 +111,7 @@ function Component() {
]}
variant="underline"
/>
*/}
<ErrorBoundary>
<Outlet />
</ErrorBoundary>
Expand Down

0 comments on commit 79171aa

Please sign in to comment.