mirror of
https://github.com/baairon/torlink.git
synced 2026-07-08 18:28:22 +02:00
Merge pull request #4: navigate panes with the arrow keys
# Conflicts: # package-lock.json
This commit is contained in:
@@ -113,6 +113,7 @@ export function Results() {
|
||||
submitQuery,
|
||||
section,
|
||||
region,
|
||||
setRegion,
|
||||
setCaptureMode,
|
||||
startDownload,
|
||||
copyMagnet,
|
||||
@@ -172,9 +173,13 @@ export function Results() {
|
||||
setMode("search");
|
||||
return;
|
||||
}
|
||||
if (key.upArrow) {
|
||||
if (results.length > 0 && clamped > 0) setCursor(clamped - 1);
|
||||
else setMode("search");
|
||||
return;
|
||||
}
|
||||
if (results.length === 0) return;
|
||||
if (key.upArrow) setCursor(wrapStep(clamped, -1, results.length));
|
||||
else if (key.downArrow) setCursor(wrapStep(clamped, 1, results.length));
|
||||
if (key.downArrow) setCursor(wrapStep(clamped, 1, results.length));
|
||||
else if (key.pageUp) setCursor(Math.max(0, clamped - pageJump));
|
||||
else if (key.pageDown) setCursor(Math.min(results.length - 1, clamped + pageJump));
|
||||
else if (key.return) {
|
||||
@@ -292,12 +297,14 @@ export function Results() {
|
||||
editing={mode === "search"}
|
||||
placeholder={PLACEHOLDER}
|
||||
onSubmit={onSubmit}
|
||||
onExitDown={() => setMode("list")}
|
||||
onExitLeft={() => setRegion("sidebar")}
|
||||
/>
|
||||
<Box marginTop={1}>
|
||||
<Panel
|
||||
title={mode === "detail" ? "details" : browsing ? "latest" : "results"}
|
||||
width={contentWidth}
|
||||
focused={focused}
|
||||
focused={focused && mode !== "search"}
|
||||
count={mode === "detail" ? undefined : count}
|
||||
height={panelOuter}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user