From 8f6b2172743b3b062f688f5f70588d8666c61442 Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Tue, 7 Jan 2020 12:24:22 -0600 Subject: [PATCH] refactor: don't modify fn args in Array.reduce callback (styles.js) per https://github.com/iterative/dvc.org/pull/891#discussion_r363580968 --- src/styles.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/styles.js b/src/styles.js index ef89ddebf8..89018dcb58 100644 --- a/src/styles.js +++ b/src/styles.js @@ -8,25 +8,25 @@ export const global = ` font-weight: 400; text-rendering: optimizeLegibility !important; } - + @-moz-document url-prefix() { body { font-weight: lighter !important; } } - + body { padding: 0px; font-family: BrandonGrotesque, Tahoma, Arial; font-weight: normal; -webkit-font-smoothing: antialiased; line-height: 1.5; - + // IE flex min-height fix https://stackoverflow.com/a/40491316 display: flex; flex-direction: column; } - + *:focus { outline: 0; } @@ -51,13 +51,14 @@ export const sizes = { sizes.phablet = Math.floor((sizes.tablet + sizes.phone) / 2) -export const media = Object.keys(sizes).reduce((accumulator, label) => { - accumulator[label] = (...args) => css` - @media (max-width: ${sizes[label]}px) { - ${css(...args)}; - } - ` - return accumulator +export const media = Object.keys(sizes).reduce((acc, cur) => { + return Object.assign(acc, { + [cur]: (...args) => css` + @media (max-width: ${sizes[cur]}px) { + ${css(...args)}; + } + ` + }) }, {}) export const container = css`