remove unused utils, move specific utils into component files

main
Mike Fix 6 years ago
parent f1b36f4f67
commit b5a1052b40

@ -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() {

@ -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()

Loading…
Cancel
Save