mirror of
https://github.com/supabase/supabase.git
synced 2026-05-09 18:30:12 -04:00
308cd791a2
This PR preps the monorepo for a migration to Tailwind v4: - Bump all Tailwind dependencies and libraries to the latest possible version, while still compatible with Tailwind 3. - Cleans up obsolete Tailwind 3 specific options and configs. - Cleans up unused CSS files and fixes the CSS imports. - Migrates all `important` uses in `@apply` lines to using the `!` prefix. - Move `typography.css` to the `config` package and import it from the apps. - Migrated all occurrences of `flex-grow`, `flex-shrink`, `overflow-clip` and `overflow-ellipsis` since they're deprecated and will be removed in Tailwind 4. - Make the default theme object typesafe in the `ui` package. - Migrate all `bg-opacity`, `border-opacity`, `ring-opacity` and `divider-opacity` to the new format where they're declared as part of the property color. - Bump and unify all imports of `postcss` dependency.
73 lines
2.1 KiB
TypeScript
73 lines
2.1 KiB
TypeScript
import { AlertCircle, ChevronsUpDown } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
import { forwardRef, type ReactNode } from 'react'
|
|
import { Button, cn, Popover_Shadcn_, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_ } from 'ui'
|
|
|
|
interface AppLayoutDropdownErrorProps {
|
|
message: string
|
|
}
|
|
|
|
export function AppLayoutDropdownError({ message }: AppLayoutDropdownErrorProps) {
|
|
return (
|
|
<div className="flex items-center space-x-2 text-amber-900">
|
|
<AlertCircle size={16} strokeWidth={1.5} />
|
|
<p className="text-sm">{message}</p>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
interface AppLayoutDropdownTriggerButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
className?: string
|
|
}
|
|
|
|
export const AppLayoutDropdownTriggerButton = forwardRef<
|
|
HTMLButtonElement,
|
|
AppLayoutDropdownTriggerButtonProps
|
|
>(({ className, ...props }, ref) => (
|
|
<Button
|
|
ref={ref}
|
|
size="tiny"
|
|
className={cn('px-1.5 py-4 [&_svg]:w-5 [&_svg]:h-5 ml-1', className)}
|
|
iconRight={<ChevronsUpDown strokeWidth={1.5} />}
|
|
{...props}
|
|
type="text"
|
|
/>
|
|
))
|
|
AppLayoutDropdownTriggerButton.displayName = 'AppLayoutDropdownTriggerButton'
|
|
|
|
export interface AppLayoutDropdownWithPopoverProps {
|
|
linkHref: string
|
|
linkContent: ReactNode
|
|
linkClassName?: string
|
|
commandContent: ReactNode
|
|
open: boolean
|
|
onOpenChange: (open: boolean) => void
|
|
triggerButtonClassName?: string
|
|
}
|
|
|
|
export function AppLayoutDropdownWithPopover({
|
|
linkHref,
|
|
linkContent,
|
|
linkClassName = 'flex items-center gap-2 shrink-0 text-sm',
|
|
commandContent,
|
|
open,
|
|
onOpenChange,
|
|
triggerButtonClassName,
|
|
}: AppLayoutDropdownWithPopoverProps) {
|
|
return (
|
|
<Popover_Shadcn_ open={open} onOpenChange={onOpenChange} modal={false}>
|
|
<div className="flex items-center shrink-0">
|
|
<Link href={linkHref} className={linkClassName}>
|
|
{linkContent}
|
|
</Link>
|
|
<PopoverTrigger_Shadcn_ asChild>
|
|
<AppLayoutDropdownTriggerButton className={triggerButtonClassName} />
|
|
</PopoverTrigger_Shadcn_>
|
|
</div>
|
|
<PopoverContent_Shadcn_ className="p-0" side="bottom" align="start">
|
|
{commandContent}
|
|
</PopoverContent_Shadcn_>
|
|
</Popover_Shadcn_>
|
|
)
|
|
}
|