rpearce / react-medium-image-zoom

🔎 🏞 The original medium.com-inspired image zooming library for React (since 2016)
https://rpearce.github.io/react-medium-image-zoom/
BSD 3-Clause "New" or "Revised" License
1.88k stars 100 forks source link

RMIZ's future: React 16 & beyond RFC #143

Closed rpearce closed 5 years ago

rpearce commented 5 years ago

Intro

With the latest React version and React's future as a whole, some things have come to light that need changing, and this has me thinking that it's time for an overhaul on this project.

Current State

While the project works fine as it is right now, here are some observations:

The Future?

Split Controlled & Uncontrolled Components

For this, I'm thinking either 1 of 2 things:

I could use some feedback on this.

All the "business logic" around what makes these components tick would naturally be extracted, shared and tested. Unlike input components, which can be controlled or uncontrolled (given you provide a value or not), developers know from the get-go how they're going to use this component, so I'm of a mind to have them choose from the start.

Updates for future React

Testing

I've gotten a lot better about testing React components since this was initially published and updates made. I might as well use this as an opportunity to test all the things instead of relying on Storybook.

Keyboard a11y

Not much to say here other than it seems a bit wonky across browsers. Can address more fully if it's baked in from the get-go.

General Cleanliness

Parts of this library are quite difficult to follow and are hacky because it's what I had to do to make the library work. That said, I think this could improve the quality of the code (and dependability with tests) and make it easier for others to contribute.

Portability Across Frameworks / Languages

I'd love to identify patterns and code blocks that can be used as inspiration for porting this to

Docs

Small point, but I'm going to move the documentation to separate markdown files and keep the README clean and to the point:


Thoughts? I'm asking all of you because you have contributed in this project in some way and should have a say: cc @cbothner @jeremybini @ismay @rajit @rsaccon @wtfdaemon @aswinckr @alexshelkov @Snowsoul @kendagriff @HippoDippo @oyeanuj @ludwigfrank @serfgy @babyPrince

cbothner commented 5 years ago

I’m in favor of exporting multiple components from the same package, rather than splitting into two packages. It’s likely a user will start with the stateful component and then grow into needing the lower level controlled component. My thinking is that it’s lower friction and more discoverable to change the import at the top of the file rather than package.json.

rpearce commented 5 years ago

@cbothner thank you for the feedback!

rpearce commented 5 years ago

Update: I've now broken ground on this. Here we go... Working from the rewrite branch

rpearce commented 5 years ago

Update: This has been paused as I've been having hand+wrist+forearm pain and need to deal with that before doing this outside normal working hours.

Good news is that we'll be using latest & greatest React & hooks!

rpearce commented 5 years ago

@spencerfdavis is going to be giving me a hand with this. Welcome to the project, @spencerfdavis, and I look forward to getting some things rolling together over the coming months!

rpearce commented 5 years ago

Update: I've been putting a bit of work into the rewrite and am having a meeting with @spencerfdavis on Monday to figure out what path we want to go down with regard to some things.

We're going to

The ultimate goals are:

There are also a few other folks who have expressed interest in contributing (thanks, Hacktoberfest!), so more to come on that, as well.

rpearce commented 5 years ago

The prototype for the rewrite is out on the master branch (master is dev for now), and it needs a lot of work. We'll be tracking its progress in https://github.com/rpearce/react-medium-image-zoom/projects/1, so I'm going to close this issue.