Files
supabase/apps/www/components/Nav/MenuItem.tsx
Ivan VasilovandJordi Enric 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00

92 lines
2.8 KiB
TypeScript

import { ChevronRight } from 'lucide-react'
import Link from 'next/link'
import React from 'react'
import { cn } from 'ui'
const MenuItem = React.forwardRef<
React.ElementRef<'a'>,
React.ComponentPropsWithoutRef<'a'> & {
description?: string
icon?: string
hasChevron?: boolean
hoverColor?: 'foreground' | 'brand'
}
>(
(
{
className,
title,
href = '',
description,
icon,
hasChevron,
children,
hoverColor = 'foreground',
...props
},
ref
) => {
return (
<Link
href={href}
ref={ref}
className={cn(
'group/menu-item flex items-center text-foreground-light text-sm hover:text-foreground select-none gap-3 rounded-md p-2 leading-none no-underline outline-hidden focus-visible:ring-2 focus-visible:ring-foreground-lighter focus-visible:text-foreground',
description && 'items-center',
className
)}
{...props}
>
{children ?? (
<>
{icon && (
<div className="shrink-0 border bg-surface-200 min-w-10 w-10 h-10 flex items-center justify-center rounded-lg">
<svg
className="h-5 w-5 group-hover/menu-item:text-foreground group-focus-visible/menu-item:text-foreground"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
aria-hidden="true"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
d={icon}
stroke="currentColor"
/>
</svg>
</div>
)}
<div className="flex flex-col justify-center">
<div className="flex items-center gap-1">
<p
className={cn(
'leading-snug text-foreground',
hoverColor === 'brand' && 'group-hover/menu-item:text-brand-link'
)}
>
{title}
</p>
{hasChevron && (
<ChevronRight
strokeWidth={2}
className="w-3 h-3 text-foreground transition-all will-change-transform -translate-x-1 opacity-0 group-hover/menu-item:translate-x-0 group-hover/menu-item:opacity-100"
/>
)}
</div>
{description && (
<p className="line-clamp-2 leading-snug text-foreground-lighter group-hover/menu-item:text-foreground-light group-focus-visible/menu-item:text-foreground-light text-xs">
{description}
</p>
)}
</div>
</>
)}
</Link>
)
}
)
export default MenuItem