Merge pull request #50 from bchristie/master

Enable mobile gesture support
This commit is contained in:
Rodrigo Pombo 2019-02-07 16:09:54 -03:00 committed by GitHub
commit 47e29bde98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -8,6 +8,7 @@
"react": "^16.8.1", "react": "^16.8.1",
"react-dom": "^16.8.1", "react-dom": "^16.8.1",
"react-scripts": "2.1.3", "react-scripts": "2.1.3",
"react-swipeable": "^4.3.2",
"react-use": "^5.2.2" "react-use": "^5.2.2"
}, },
"scripts": { "scripts": {

View File

@ -1,6 +1,7 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { getSlides } from "./differ"; import { getSlides } from "./differ";
import useSpring from "react-use/lib/useSpring"; import useSpring from "react-use/lib/useSpring";
import Swipeable from "react-swipeable"
import Slide from "./slide"; import Slide from "./slide";
import "./comment-box.css"; import "./comment-box.css";
@ -109,7 +110,12 @@ export default function History({ commits, language }) {
currentIndex={current} currentIndex={current}
selectCommit={index => setTarget(index)} selectCommit={index => setTarget(index)}
/> />
<Slide time={current - index} lines={slideLines[index]} /> <Swipeable
onSwipedLeft={nextSlide}
onSwipedRight={prevSlide}
>
<Slide time={current - index} lines={slideLines[index]} />
</Swipeable>
</React.Fragment> </React.Fragment>
); );
} }