bogas04 / SikhJS

👳 🚀 Gurbani Progressive Web Application
https://bogas04.github.io/SikhJS
MIT License
26 stars 16 forks source link

Use arrow keys to go to next ang in SGGS #132

Open sartaj10 opened 6 years ago

sartaj10 commented 6 years ago

Hi,

Is it currently possible to switch between Angs in SGGS using the arrow keys? Maybe, it could be a feature that can be added

bogas04 commented 6 years ago

Thank you so much for raising this issue, feel free to contribute for the same!

Ang state is stored in src/pages/SGGS/index.js.

You can addEventListener in componentDidMount for keyup to set call handleIncrementAng or handleDecrementAng based on arrow key pressed. You can get keycodes for arrow keys here.

Don't forget to removeEventListener in componentWillUnmount lifecycle method of above component to be conservative of memory leaks.

We might also want to debounce the event listener to avoid multiple API calls.

You can also join our slack channel to contribute more!

sartaj10 commented 6 years ago

Thanks! I'll work on the same and add in a PR soon.

Also, joined the slack channel 👍