Beginnings of autocomplete for headers

This commit is contained in:
Gregory Schier
2023-03-17 16:51:20 -07:00
parent 10616001df
commit e33085a7b4
17 changed files with 155 additions and 48 deletions

View File

@@ -21,11 +21,12 @@ interface Props {
}
const MIN_WIDTH = 110;
const INITIAL_WIDTH = 200;
const MAX_WIDTH = 500;
export function Sidebar({ className }: Props) {
const [isDragging, setIsDragging] = useState<boolean>(false);
const width = useKeyValue<number>({ key: 'sidebar_width', initialValue: 200 });
const width = useKeyValue<number>({ key: 'sidebar_width', initialValue: INITIAL_WIDTH });
const requests = useRequests();
const activeRequest = useActiveRequest();
const createRequest = useCreateRequest({ navigateAfter: true });
@@ -39,6 +40,10 @@ export function Sidebar({ className }: Props) {
}
};
const handleResizeReset = () => {
width.set(INITIAL_WIDTH);
};
const handleResizeStart = (e: React.MouseEvent<HTMLDivElement>) => {
unsub();
const mouseStartX = e.clientX;
@@ -72,6 +77,7 @@ export function Sidebar({ className }: Props) {
aria-hidden
className="group absolute -right-2 top-0 bottom-0 w-4 cursor-ew-resize flex justify-center"
onMouseDown={handleResizeStart}
onDoubleClick={handleResizeReset}
>
<div
className={classnames(