mirror of
https://github.com/supabase/supabase.git
synced 2026-09-22 13:37:53 +08:00
8f69cfaaae
## Problem People using screen readers can't find how to navigate back to the organization dashboard. ## Solution - Add an invisible label for screen readers - Add a tooltip for all users <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a tooltip to the home navigation icon on hover (“Back to organization home”). * Enhanced app layout dropdowns to accept custom trigger content, improving accessibility with updated labels for branches, organizations, and projects. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
71 lines
2.0 KiB
TypeScript
71 lines
2.0 KiB
TypeScript
import { AlertCircle, ChevronsUpDown } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
import { forwardRef, type ReactNode } from 'react'
|
|
import { Button, cn, Popover, PopoverContent, PopoverTrigger } 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}
|
|
variant="text"
|
|
/>
|
|
))
|
|
AppLayoutDropdownTriggerButton.displayName = 'AppLayoutDropdownTriggerButton'
|
|
|
|
export interface AppLayoutDropdownWithPopoverProps {
|
|
linkHref: string
|
|
linkContent: ReactNode
|
|
linkClassName?: string
|
|
commandContent: ReactNode
|
|
open: boolean
|
|
onOpenChange: (open: boolean) => void
|
|
triggerButton?: ReactNode
|
|
}
|
|
|
|
export function AppLayoutDropdownWithPopover({
|
|
linkHref,
|
|
linkContent,
|
|
linkClassName = 'flex items-center gap-2 shrink-0 text-sm',
|
|
commandContent,
|
|
open,
|
|
onOpenChange,
|
|
triggerButton,
|
|
}: AppLayoutDropdownWithPopoverProps) {
|
|
return (
|
|
<Popover open={open} onOpenChange={onOpenChange} modal={false}>
|
|
<div className="flex items-center shrink-0">
|
|
<Link href={linkHref} className={linkClassName}>
|
|
{linkContent}
|
|
</Link>
|
|
<PopoverTrigger asChild>{triggerButton}</PopoverTrigger>
|
|
</div>
|
|
<PopoverContent className="p-0" side="bottom" align="start">
|
|
{commandContent}
|
|
</PopoverContent>
|
|
</Popover>
|
|
)
|
|
}
|