Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(resource menu): minor adjustments #1044

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,52 @@ export const CategoryTabs = ({ resourceActiveCategory }: CategoryTabsProps) => {
const { t } = useTranslation();

return (
<nav className="md:flex flex-wrap w-full justify-center items-center md:gap-6 lg:gap-8 xl:gap-10 md:px-5 mb-10 hidden">
{RESOURCES_CATEGORIES.map((resourceCategory) => (
<Link
key={resourceCategory.name}
to={`/resources/${resourceCategory.name}`}
onClick={(event: React.MouseEvent<HTMLAnchorElement>) =>
resourceCategory.unreleased && event.preventDefault()
}
className={cn(
'group',
resourceCategory.unreleased
? 'cursor-not-allowed opacity-50'
: resourceCategory.name === resourceActiveCategory
? 'scale-125 filter-newOrange1'
: '',
)}
>
<div className="flex justify-center items-center p-2 lg:p-4 border border-white rounded-xl">
<img
src={resourceCategory.image}
alt={resourceCategory.name}
className="filter-white max-w-7 lg:max-w-9"
/>
<span
<nav className="md:flex flex-wrap w-full justify-center items-center md:gap-6 lg:gap-8 xl:gap-10 md:px-5 mb-14 hidden">
{RESOURCES_CATEGORIES.map((resourceCategory) => {
const categoryTitle = capitalizeFirstWord(
t(`resources.${resourceCategory.name}.title`),
);

return (
<Link
key={resourceCategory.name}
to={`/resources/${resourceCategory.name}`}
onClick={(event: React.MouseEvent<HTMLAnchorElement>) =>
resourceCategory.unreleased && event.preventDefault()
}
className={cn(
'group relative',
resourceCategory.unreleased
? 'cursor-not-allowed opacity-50'
: resourceCategory.name === resourceActiveCategory &&
'filter-newOrange1',
)}
>
<div
className={cn(
'text-white opacity-0 max-lg:text-sm font-medium leading-[1.43] tracking-[0.17px] max-w-0 inline-flex whitespace-nowrap transition-[max-width_opacity] overflow-hidden ease-in-out duration-700',
resourceCategory.name !== resourceActiveCategory &&
'group-hover:max-w-96 group-hover:opacity-100 group-hover:ml-3 lg:group-hover:ml-4 group-focus:max-w-96 group-focus:opacity-100 group-focus:ml-3 lg:group-focus:ml-4',
'flex justify-center items-center p-2 lg:p-2.5 border border-white rounded-xl',
resourceCategory.name === resourceActiveCategory && 'scale-125',
)}
>
{capitalizeFirstWord(
t(`resources.${resourceCategory.name}.title`),
<img
src={resourceCategory.image}
alt={resourceCategory.name}
className="filter-white max-w-[25px]"
/>
</div>
<span
className={cn(
'absolute left-1/2 -translate-x-1/2 body-14px text-white opacity-0 transition-opacity duration-300 group-hover:opacity-100 w-[100px] text-center',
resourceCategory.name === resourceActiveCategory
? 'top-16'
: 'top-14',
)}
>
{categoryTitle}
</span>
</div>
</Link>
))}
</Link>
);
})}
</nav>
);
};
Loading