import styled from "styled-components/macro"; import { User } from "revolt.js"; import { AutoCompleteState } from "../common/AutoComplete"; import UserIcon from "../common/user/UserIcon"; const Base = styled.div` position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; background: var(--primary-background); border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); z-index: 1001; overflow: hidden; max-height: 200px; overflow-y: auto; @media (max-width: 768px) { margin-top: 8px; max-height: 250px; border-radius: 10px; } button { width: 100%; gap: 8px; padding: 8px 12px; border: none; display: flex; font-size: 14px; cursor: pointer; align-items: center; flex-direction: row; font-family: inherit; background: transparent; color: var(--foreground); text-align: left; transition: background 0.15s ease; &:hover, &.active { background: var(--secondary-background); } span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } @media (max-width: 768px) { padding: 14px 16px; font-size: 15px; gap: 12px; /* Add touch feedback for mobile */ &:active { background: var(--secondary-background); transform: scale(0.98); } } } `; interface Props { state: AutoCompleteState; setState: (state: AutoCompleteState) => void; onClick: (userId: string, username: string) => void; } export default function SearchAutoComplete({ state, setState, onClick }: Props) { if (state.type !== "user") return null; // Detect if we're on mobile const isMobile = window.innerWidth <= 768; const iconSize = isMobile ? 24 : 20; return ( {state.matches.length > 0 ? ( state.matches.map((user, i) => ( )) ) : (
No users found
)} ); }