Skip to content

Commit

Permalink
fix: active tab bar line (#3614)
Browse files Browse the repository at this point in the history
  • Loading branch information
sshanzel authored Oct 2, 2024
1 parent eadf50c commit d7d2c55
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,46 +69,45 @@ export const SquadDirectoryLayout = (

const isDiscover = pathname === squadCategoriesPaths.discover;

if (!loadedSettings) {
return null;
}

return (
loadedSettings && (
<BaseFeedPage className="relative mb-4 flex-col px-4 pt-4 laptop:px-18 laptop:pt-8">
{isDiscover && (
<div className="absolute inset-0 -z-1 hidden h-[25rem] w-full bg-gradient-to-t from-accent-cabbage-default to-background-default tablet:flex" />
)}
<BaseFeedPage className="relative mb-4 flex-col px-4 pt-4 laptop:px-18 laptop:pt-8">
{isDiscover && (
<div className="absolute inset-0 -z-1 hidden h-[25rem] w-full bg-gradient-to-t from-accent-cabbage-default to-background-default tablet:flex" />
)}

<header className="flex w-full flex-col gap-2">
<section className="flex w-full flex-row items-center justify-between typo-body laptop:hidden">
<strong>Squads</strong>
<NewSquadButton
icon={<PlusIcon />}
variant={ButtonVariant.Primary}
/>
</section>
<div className="flex max-w-full flex-row flex-nowrap items-center justify-between gap-6 laptop:gap-22">
<SquadDirectoryNavbar className="min-h-14 min-w-0 flex-1">
{Object.entries(categoryPaths ?? {}).map(([category, path]) => (
<SquadDirectoryNavbarItem
buttonSize={buttonSize}
elementProps={{ id: `squad-item-${category}-${id}` }}
isActive={path === pathname || path === asPath}
key={category}
label={category}
path={path}
/>
))}
</SquadDirectoryNavbar>
<div className="hidden laptop:block">
<NewSquadButton />
</div>
</div>
</header>
<section
{...attrs}
className={classNames('flex w-full flex-col pt-5', className)}
>
{children}
<header className="flex w-full flex-col gap-2">
<section className="flex w-full flex-row items-center justify-between typo-body laptop:hidden">
<strong>Squads</strong>
<NewSquadButton icon={<PlusIcon />} variant={ButtonVariant.Primary} />
</section>
</BaseFeedPage>
)
<div className="flex max-w-full flex-row flex-nowrap items-center justify-between gap-6 laptop:gap-22">
<SquadDirectoryNavbar className="min-h-14 min-w-0 flex-1">
{Object.entries(categoryPaths ?? {}).map(([category, path]) => (
<SquadDirectoryNavbarItem
buttonSize={buttonSize}
elementProps={{ id: `squad-item-${category}-${id}` }}
isActive={path === pathname || path === asPath}
key={category}
label={category}
path={path}
/>
))}
</SquadDirectoryNavbar>
<div className="hidden laptop:block">
<NewSquadButton />
</div>
</div>
</header>
<section
{...attrs}
className={classNames('flex w-full flex-col pt-5', className)}
>
{children}
</section>
</BaseFeedPage>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function SquadDirectoryNavbarItem({
{...elementProps}
className={classNames(
'relative py-3',
'after:absolute after:bottom-0 after:left-0 after:right-0 after:mx-auto after:w-14 after:border-b-2',
'after:absolute after:bottom-0 after:left-0 after:right-0 after:mx-auto after:w-1/2 after:border-b-2',
{ 'after:hidden': !isActive },
elementProps?.className,
)}
Expand Down
8 changes: 8 additions & 0 deletions packages/webapp/pages/squads/discover/my.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@ import React, { ReactElement } from 'react';
import { NextSeo } from 'next-seo';
import { useAuthContext } from '@dailydotdev/shared/src/contexts/AuthContext';
import { SquadList } from '@dailydotdev/shared/src/components/cards/squad/SquadList';
import { useRouter } from 'next/router';
import { squadCategoriesPaths } from '@dailydotdev/shared/src/lib/constants';
import { getLayout } from '../../../components/layouts/FeedLayout';
import { mainFeedLayoutProps } from '../../../components/layouts/MainFeedPage';
import { SquadDirectoryLayout } from '../../../../shared/src/components/squads/layout/SquadDirectoryLayout';
import { defaultSeo } from '../../../next-seo';

function MySquadsPage(): ReactElement {
const { squads } = useAuthContext();
const router = useRouter();

if (squads?.length === 0) {
router.push(squadCategoriesPaths.discover);
return null;
}

return (
<SquadDirectoryLayout className="gap-3">
Expand Down

0 comments on commit d7d2c55

Please sign in to comment.