From b5a1052b40ce8fea5049d385476c9dcd87f17465 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Thu, 13 Dec 2018 15:30:05 -0800 Subject: [PATCH] remove unused utils, move specific utils into component files --- components/BackgroundSelect.js | 6 ++++-- lib/util.js | 6 ------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/components/BackgroundSelect.js b/components/BackgroundSelect.js index fdf5c5f..a9adddf 100644 --- a/components/BackgroundSelect.js +++ b/components/BackgroundSelect.js @@ -6,7 +6,9 @@ import WindowPointer from './WindowPointer' import ImagePicker from './ImagePicker' import { COLORS, DEFAULT_BG_COLOR } from '../lib/constants' import { validateColor } from '../lib/colors' -import { parseRGBA, capitalizeFirstLetter } from '../lib/util' + +const stringifyRGBA = obj => `rgba(${obj.r},${obj.g},${obj.b},${obj.a})` +const capitalizeFirstLetter = s => s.charAt(0).toUpperCase() + s.slice(1) class BackgroundSelect extends React.Component { constructor(props) { @@ -44,7 +46,7 @@ class BackgroundSelect extends React.Component { } handlePickColor(color) { - this.props.onChange({ backgroundColor: parseRGBA(color.rgb) }) + this.props.onChange({ backgroundColor: stringifyRGBA(color.rgb) }) } render() { diff --git a/lib/util.js b/lib/util.js index e7e9b05..9f72689 100644 --- a/lib/util.js +++ b/lib/util.js @@ -37,8 +37,6 @@ export const unescapeHtml = s => { } } -export const parseRGBA = obj => `rgba(${obj.r},${obj.g},${obj.b},${obj.a})` - export const getSettings = morph.compose( parse, escapeHtml, @@ -56,10 +54,6 @@ export const savePresets = (window, v) => assignPresets(window, JSON.stringify(v export const clearSettings = () => localStorage.removeItem(SETTINGS_KEY) -export const capitalizeFirstLetter = s => s.charAt(0).toUpperCase() + s.slice(1) - -export const range = n => [...Array(n).keys()] - export const fileToDataURL = blob => new Promise(res => { const reader = new FileReader()