mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-30 14:12:07 +02:00
Beginnings of autocomplete for headers
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user