Building Components with Sass Framework for Zoro

”

As our design system matured, the way we styled components had to mature with it.

UX Discovery Statement

Project Summary

All deprecated Zoro components needed to be refactored into Sass, and brought up to a high standard of code patterns and rules. A few selected components are shown below.

Project Conclusions

After the first couple of pull requests came through the dev team, the results were clear. Most developers had been waiting for an approach with real standards, especially with Sass becoming the new norm and much of the code we were refactoring pushing five years old.

Project Details

Project Challenges

Given the amount of Components that had to be refactored, this was going to be a long term project. Keeping the effort going, getting and keeping other developers on board with the new standards would prove to be difficult.

Challenge #1
Challenge #2
Challenge

Refactoring the components in a logical, orderly fashion, with both desktop and mobile in mind.

Solution

We started with the most familiar, common components first, the heading suite (simple) and the popular carousel component (complex).

Challenge

As we developed these components, we made sure not to get fast and loose with the standards as we moved along.

Solution

We stayed firm but flexible with our formatting approach. We set core principles up front, but stayed open to exceptions. For example, using @at-root in the carousel component moved the logical flow away from the component and its styling, but it ended up being the simpler solution overall.

Carousel Component Refactor

We refactored the carousel component’s code while updating its look and feel at the same time, cutting the code by about 70% compared to the old version. This was our first refactor using the new approach. Define the component by class name, then select native HTML elements from within it using Sass’s built-in functions or CSS pseudo-selectors.

https://codepen.io/paulroesner77/pen/NZxLLX

Heading Component Refactor

Refactored the heading component into a size-scale system, built on two mixins.

https://codepen.io/paulroesner77/pen/JQGaej

Grid Layout Fallback Refactor

Rebuilding the common grid component came with a twist. About 5% of site traffic was still on IE11 at the time, so a style fallback was necessary. Below is the Sass code, written to follow the same principles we used across all our Sass files.

https://codepen.io/paulroesner77/pen/OEaZGv

The End.

Thanks for reading!
ClientZoro
My RoleComponent Refactor, Development
ToolsSass, Visual Studio Code
WebsiteZoro.com

Project Overview

As our design system matured, the way we styled components had to mature with it. So we brought in Sass, a CSS extension that let us introduce variables and calculations, shortening our styling and keeping everything tidy.

Who is Zoro?

Zoro is an established half-billion dollar revenue eCommerce store selling supplies and tools.