ItsJonQ / g2

✨ An experimental reimagining of WordPress components
http://g2-components.com/
MIT License
105 stars 12 forks source link

SelectDropdown: Add isPreviewable interaction #185

Closed ItsJonQ closed 3 years ago

ItsJonQ commented 3 years ago

This update adds the ability for SelectDropdown to "preview" changes when hovering/moving through the items (without committing the change via a click).

Example: Screen Capture on 2020-12-09 at 15-54-20

This is an opt-in feature, via a <SelectDropdown isPreviewable /> prop.

The best part is the consumer doesn't have to tap into an alternative callback function for the preview function to work. All of that is handled internally between a substate store and Downshift.

For fun, here's the state flow diagram I drew during the Twitch stream today when we were trying to figure this out.

Screen Shot 2020-12-09 at 1 46 33 PM

Shout outs to @timothybjacobs for contributing ideas for this interaction!

Resolves https://github.com/ItsJonQ/g2/issues/182

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/itsjonq/g2/rj4u0814q
✅ Preview: https://g2-git-try-select-dropdown-preview-interaction.itsjonq.vercel.app