diff --git a/frontend/src/components/Composer.css b/frontend/src/components/Composer.css index cff7804..1683f75 100644 --- a/frontend/src/components/Composer.css +++ b/frontend/src/components/Composer.css @@ -105,6 +105,11 @@ cursor: not-allowed; } +.composer-attach-wrap { + position: relative; + flex: none; +} + .composer-attach { width: 36px; height: 36px; @@ -119,6 +124,42 @@ cursor: pointer; } +.composer-attach-menu-scrim { + position: fixed; + inset: 0; + z-index: 30; +} + +.composer-attach-menu { + position: absolute; + bottom: calc(100% + 8px); + left: 0; + z-index: 31; + background: var(--card-bg); + border: 1px solid var(--ds-border); + border-radius: var(--radius); + padding: var(--sp-2); + min-width: 160px; + display: flex; + flex-direction: column; + gap: 2px; +} + +.composer-attach-menu button[role='menuitem'] { + background: transparent; + border: none; + color: var(--ds-text); + text-align: left; + padding: 8px; + border-radius: 6px; + font-size: 0.86rem; + cursor: pointer; +} + +.composer-attach-menu button[role='menuitem']:hover { + background: var(--ds-surface-2); +} + .composer-attach:hover:not(:disabled) { color: var(--ds-text); border-color: var(--ds-accent); diff --git a/frontend/src/components/Composer.tsx b/frontend/src/components/Composer.tsx index a857621..81c92a5 100644 --- a/frontend/src/components/Composer.tsx +++ b/frontend/src/components/Composer.tsx @@ -8,6 +8,7 @@ import { type FormEvent, type KeyboardEvent, } from 'react' +import { useEscapeKey } from '../hooks/useEscapeKey' import { useOnlineStatus } from '../hooks/useOnlineStatus' import { uploadRoomFile, uploadRoomImage } from '../api/rooms' import { getUploadLimit } from '../api/uploads' @@ -61,6 +62,33 @@ function detectRoomReferenceQuery(text: string, cursor: number): TriggerQuery | return detectTriggerQuery(text, cursor, '#') } +interface AttachMenuProps { + onPickPhoto: () => void + onPickFile: () => void + onClose: () => void +} + +// #29: splits into two explicit choices rather than one unrestricted file +// input -- see photoInputRef's comment on the Composer below for why a +// single input can't reliably offer both "any file type" and a mobile +// gallery shortcut at once. +function AttachMenu({ onPickPhoto, onPickFile, onClose }: AttachMenuProps) { + useEscapeKey(onClose) + return ( + <> +
+