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
/** | |
* | |
* @param {Object} obj - the object you want to get a value out of | |
* @param {Array | String} path - the path to the value, can either be an array `['a', 'b', 'c']` of keys or | |
* string using dotnotation `a.b.c` | |
* @param {*} [defaultValue=undefined] the value you want to return if the key is not found in the object | |
*/ | |
const getObjValue = (obj, path, defaultValue) => { | |
let checkedPath = path; | |
if (!Array.isArray(checkedPath)) { |
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 { hex, rgb } from 'color-convert'; | |
/** | |
* Determine if a string is a hex color | |
* @param {string} color - hex representation of a color | |
* @returns {boolean} | |
*/ | |
const isHexColor = color => /^#?(?:[a-f0-9]{3}){1,2}$/i.test(color); | |
/** |
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
// Requires https://www.npmjs.com/package/@fdaciuk/ajax | |
import ajax from '@fdaciuk/ajax'; | |
/** | |
* Object that holds all the API endpoints. | |
* @example | |
* { | |
* apiName: '/apiPath' | |
* } | |
*/ |
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
/** | |
* Change the key for a giving object | |
* | |
* @param {string} oldKey - the key (property) you want to change | |
* @param {string} newKey - the new key | |
* @param {Object} old - object that needs to be changed | |
* | |
* @returns {Object} | |
*/ | |
export default function (oldKey, newKey, {[oldKey]: old, ...rest}) { |
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 dataOptions = [{ | |
id: '1', | |
name: 'Surgery', | |
value: 'surgery', | |
children: [{ | |
id: '1.1', | |
name: 'Septoplasty', | |
value: 'septoplasty', | |
},{ | |
id: '1.2', |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
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
// ---- | |
// libsass (v3.5.0.beta.2) | |
// ---- | |
$font-size-base: 16px !default; | |
$font-fallback-type: '' !default; | |
@function get-relative-font-size($actual, $relative: $font-size-base, $unitType: 'rem') { | |
@if $unitType == 'rem' { | |
@return #{($actual / $font-size-base)}rem; |
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
// ---- | |
// libsass (v3.5.0.beta.2) | |
// ---- | |
$btn-themes: ( | |
primary: ( | |
bgColor: #ef6c29, | |
border: #333, | |
color: #fff, | |
hover: darken 15%, |
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
// ---- | |
// libsass (v3.3.6) | |
// ---- | |
@mixin heading-2() { | |
font-size: 1.1rem; | |
line-height: 1.2; | |
font-weight: 500; | |
} | |
@mixin button($color: #fff, $bg-color: #f00) { |
NewerOlder