-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from shefing/Initialize_line10
Adding arrows and scrolling with the mouse for an axis of length 100
- Loading branch information
Showing
6 changed files
with
105 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import leftArrowIcon from "../../img/Group 1299.svg"; | ||
import rightArrowIcon from "../../img/Group 1300.svg"; | ||
|
||
interface IProps { | ||
startIndex: number; | ||
setStartIndex: (val: number) => void; | ||
} | ||
const Arrows = ({ startIndex, setStartIndex }: IProps) => { | ||
const handleArrowClick = (direction: "left" | "right") => { | ||
const step = 1; | ||
if (direction === "left") { | ||
setStartIndex(Math.max(0, startIndex - step)); | ||
} else { | ||
setStartIndex(Math.min(80, startIndex + step)); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className="flex justify-between m-3 mb-6"> | ||
<div className="ext-xl m-2 cursor-pointer text-blue-500" onClick={() => handleArrowClick("left")}> | ||
<img src={leftArrowIcon} alt="Left Arrow" /> | ||
</div> | ||
<div className="text-xl m-2 cursor-pointer text-blue-500" onClick={() => handleArrowClick("right")}> | ||
<img src={rightArrowIcon} alt="Left Arrow" /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
export default Arrows; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.