bhauman / devcards

Devcards aims to provide a visual REPL experience for ClojureScript
1.53k stars 116 forks source link

adds next/previous buttons to breadcrums, listens to left right keydown #110

Closed timothypratley closed 7 years ago

timothypratley commented 7 years ago

http://recordit.co/o3oJoVpXQt

This small change allows users to navigate cards linearly as a slideshow. This is useful for step by step documentation, and presenting talks.

bhauman commented 7 years ago

I would say that you should make the left and right key bindings a method call.

(devcards.core/key-nav-enable!) (devcards.core/key-nav-disable!)

(devcards.core/key-nav-toggle!)

And it should default to off for sure. There should be no key listeners in the DOM by default or when (devcards.core/key-nav-disable!) is called.

timothypratley commented 7 years ago

Ok I'll make those changes tonight. Please consider allowing left/right to be enabled by default (with a turn off option): Keys are only active when the user is in single card view mode, and will only fire if the event comes from body (so if you have handlers in your card, they will be firing from some element on the card). If there are other concerns, maybe they can be addressed. The navigation benefit is higher from the keys than the buttons.

bhauman commented 7 years ago

The way I see it is that you can have a separate library that adds navigation with keys (not buttons).

This doesn't need to be in core because it's not the use case that devcards is intended for.

The single card functionality is intended solely/primarily for development ...

A slideshow is a different thing all together, and its much better to not have a dual use case, as this will only lead to more slideshow-y feature requests down the line. Its very possible to create a separate library that uses devcards to make a slideshow without injecting that functionality into someones workflow.

timothypratley commented 7 years ago

I've updated the pull request so that key navigation is off; does this seem about right?

Thank you for making devcards, I find it very useful.

Regards, Timothy

timothypratley commented 7 years ago

O.K. Yup, simple is beautiful. Will close this PR to avoid distraction.