DRYing out
I just did a coding challenge that involved making a component and then testing it with Storybook. Which reminded me how much I love Storybook. So I started using it in my project. Which reminded me that I'm not really following Best Practices with my components. Basically, my FilteredGallery component is way too big - it's more of a page than a component. It contains all the other components used for displaying artwork. Which is not optimal design.
Ideally, I want an Artwork page that contains the following components:
Ideally, I want an Artwork page that contains the following components:
- A list of albums (where each image is in exactly one album)
- A filtering tool that uses tags (which is what I currently have as the album list)
- A thumbnail gallery, for showing the images returned by the filter or album
- A carousel
- An image display
- An info panel with purchase options and links
The thumbnail gallery and carousel can be part of the same component - that's probably easier, because they need to be synchronized. And the info panel can be a child of the image display (or they can both be children of another component). But having all that stuff be part of a single component is not DRY enough, even if I'm not planning on reusing any of the components in the current project.
Comments
Post a Comment