Quick guide on how we're approaching responsive style properties in components
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const combine = (...args) => | |
[].slice.call(args).reduce((next, value) => { | |
// Create an object with duplicates combined | |
const duplicates = Object.keys(value) | |
.filter(key => next.hasOwnProperty(key)) | |
.map(key => { | |
return { | |
[key]: Object.assign(value[key], next[key]) | |
}; | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { get as scale } from '../../utils'; | |
import { Colors } from './colors'; | |
import chroma from 'chroma-js'; | |
const darken = alpha => | |
chroma(Colors.BLACK) | |
.alpha(alpha) | |
.css(); | |
export const gray = scale({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import { Box } from 'reflexbox'; | |
const Column = ({ children, size, ...props }) => ( | |
<Box w={size} {...props}> | |
{children} | |
</Box> | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const calc = (minWidth, maxWidth, minFontSize, maxFontSize) => | |
`calc(${minFontSize}px + (${maxFontSize} - ${minFontSize}) * ((100vw - ${minWidth}px) / (${maxWidth} - ${minWidth})))`; | |
const fluidType = (minWidth, maxWidth, minFontSize, maxFontSize) => ({ | |
fontSize: minFontSize, | |
[`@media screen and (min-width: ${minWidth}px)`]: { | |
fontSize: calc(minWidth, maxWidth, minFontSize, maxFontSize), | |
}, | |
[`@media screen and (min-width: ${maxWidth}px)`]: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmulti parse-int (fn [x] (class x))) | |
(defmethod parse-int String [x] | |
(try (Integer/parseInt x) (catch RuntimeException re 0))) | |
(defmethod parse-int nil [_] 0) | |
(defmethod parse-int Number [x] x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns api-fetchers.utils | |
(:require [clj-time.format :as format-time] | |
[taoensso.timbre :as timbre :refer [info]]) | |
(:import java.text.SimpleDateFormat | |
[java.time Duration Instant] | |
java.util.zip.ZipInputStream)) | |
(defn unzip | |
"Returns a `ZipInputStream` with the contents of `input-stream`" | |
[input-stream] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn bold [x] | |
(let [keys (seq "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ") | |
values ["\uD835\uDDD4" | |
"\uD835\uDDD5" | |
"\uD835\uDDD6" | |
"\uD835\uDDD7" | |
"\uD835\uDDD8" | |
"\uD835\uDDD9" | |
"\uD835\uDDDA" | |
"\uD835\uDDDB" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn str->num [x] | |
(-> (NumberFormat/getInstance (Locale/forLanguageTag "en-US")) (.parse x))) | |
(defn numeric? [x] | |
(try | |
(str->num x) | |
(catch ParseException pe false))) | |
(defn vector-of-vectors? [x] | |
(every? vector? x)) |