All files / apps / web/src / features / conversation / components / MessageToolbar index.tsx

100% Statements 2/2
100% Branches 0/0
100% Functions 1/1
100% Lines 2/2

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                5x 58x                                          
import { Bookmark, Ellipsis, Reply, SmilePlus } from 'lucide-react'
import type { ReactElement } from 'react'
import { IconButton } from '@/components/IconButton'
 
// The actions that appear at a message's top-right corner on hover or keyboard focus. It stays in
// the tab order while invisible (opacity, not display), so a keyboard user reaches it too.
// shortcut: the four actions open nothing yet; reactions and threads are M3, saved items M4, the
// menu M2. Nothing shows it on a touch screen, which has no hover; a long press comes with M3.
export const MessageToolbar = (): ReactElement => {
  return (
    <div
      role="group"
      aria-label="Message actions"
      className="absolute -top-4 right-3 z-10 flex rounded-[10px] border bg-popover p-0.5 opacity-0 shadow-float transition-opacity group-hover/message:opacity-100 group-has-focus-visible/message:opacity-100 md:right-5"
    >
      <IconButton label="React to message">
        <SmilePlus />
      </IconButton>
      <IconButton label="Reply in thread">
        <Reply />
      </IconButton>
      <IconButton label="Save message">
        <Bookmark />
      </IconButton>
      <IconButton label="More actions">
        <Ellipsis />
      </IconButton>
    </div>
  )
}