Skip to content
This repository has been archived by the owner on Mar 27, 2021. It is now read-only.

Refactor utilities #5

Open
osequi opened this issue Nov 24, 2020 · 0 comments
Open

Refactor utilities #5

osequi opened this issue Nov 24, 2020 · 0 comments
Labels
hook Related to hooks

Comments

@osequi
Copy link
Owner

osequi commented Nov 24, 2020

The following code chunks repeats. It can be refactored into a utility hook.

let queries = {};

  responsiveColumns &&
    responsiveColumns.map((item, index) => {
      const breakpoint = breakpoints[index];
      if (!breakpoint || !breakpoint.name) return null;

      const query = useBreakpoint(breakpoint.name);
      if (!query) return null;

      queries[`${query}`] = {
        gridTemplateColumns: `repeat(${item}, 1fr)`,
      };
    });

  return queries;
@osequi osequi added the hook Related to hooks label Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
hook Related to hooks
Projects
None yet
Development

No branches or pull requests

1 participant