diff --git a/app/components/NoteAvatar.module.css b/app/components/NoteAvatar.module.css index 666758db9..ee71b19cb 100644 --- a/app/components/NoteAvatar.module.css +++ b/app/components/NoteAvatar.module.css @@ -5,6 +5,13 @@ width: fit-content; } +.clickable { + cursor: pointer; + border: none; + padding: 0; + background: none; +} + .badge { position: absolute; bottom: 15%; diff --git a/app/components/NoteAvatar.tsx b/app/components/NoteAvatar.tsx index 01a099cbf..f63c3f3af 100644 --- a/app/components/NoteAvatar.tsx +++ b/app/components/NoteAvatar.tsx @@ -29,20 +29,34 @@ const SIZE_CLASS = { * `sentiment` is set: POSITIVE → green check, NEGATIVE → red cross, NEUTRAL → grey dash. Renders the * children without a badge when `sentiment` is `null`/`undefined`. `size` scales the badge to match * the wrapped avatar (`xs` for tiny avatars, `sm` for small avatars, `md` for large ones). + * + * `onClick` makes the whole wrapper (avatar and badge) clickable. It is kept out of the tab order, so + * only use it as a shortcut to an action that is also available elsewhere. */ export function NoteAvatar({ sentiment, size = "md", className, + onClick, children, }: { sentiment?: Sentiment | null; size?: keyof typeof SIZE_CLASS; className?: string; + onClick?: () => void; children: React.ReactNode; }) { + const Wrapper = onClick ? "button" : "div"; + return ( -