Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 3x 3x 10x | import { MessageSquare, Pin, Plus } from 'lucide-react'
import type { ReactElement } from 'react'
import { IconButton } from '@/components/IconButton'
interface ConversationTabsProps {
/** How many messages are pinned here; the Pins tab shows it when above zero. */
pinCount: number
}
const TAB =
'-mb-px flex h-10 items-center gap-1.5 rounded-t-lg border-b-2 border-transparent px-3 text-sm font-semibold text-muted-foreground outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring aria-[current=page]:border-primary aria-[current=page]:text-foreground'
// The views of one conversation. Buttons with aria-current rather than a tablist: there is no
// panel to switch to yet, only Messages.
// shortcut: Pins and "add a tab" open nothing; pins are M3, custom tabs V2.
export const ConversationTabs = ({ pinCount }: ConversationTabsProps): ReactElement => {
return (
<nav aria-label="Conversation views" className="flex items-center gap-1 border-b px-3">
<button type="button" aria-current="page" className={TAB}>
<MessageSquare aria-hidden="true" className="size-4" />
Messages
</button>
<button type="button" className={TAB}>
<Pin aria-hidden="true" className="size-4" />
Pins{' '}
{pinCount > 0 ? (
<span className="rounded-full bg-muted px-1.5 text-xs font-bold text-muted-foreground">
{pinCount}
</span>
) : null}
</button>
<IconButton label="Add a tab">
<Plus />
</IconButton>
</nav>
)
}
|