remove capitalize util

main
Mike Fix 5 years ago
parent 68d8b3f2d7
commit 43c00407f3

@ -5,7 +5,7 @@ import ColorPicker from './ColorPicker'
import Button from './Button' import Button from './Button'
import Popout, { managePopout } from './Popout' import Popout, { managePopout } from './Popout'
import { COLORS, DEFAULT_BG_COLOR } from '../lib/constants' import { COLORS, DEFAULT_BG_COLOR } from '../lib/constants'
import { capitalize, stringifyRGBA } from '../lib/util' import { stringifyRGBA } from '../lib/util'
function validateColor(str) { function validateColor(str) {
if (/#\d{3,6}|rgba{0,1}\(.*?\)/gi.test(str) || /\w+/gi.test(str)) { if (/#\d{3,6}|rgba{0,1}\(.*?\)/gi.test(str) || /\w+/gi.test(str)) {
@ -67,10 +67,10 @@ class BackgroundSelect extends React.PureComponent {
role="button" role="button"
tabIndex={0} tabIndex={0}
key={tab} key={tab}
className={`picker-tab ${mode === tab ? 'active' : ''}`} className={`picker-tab capitalize ${mode === tab ? 'active' : ''}`}
onClick={this.selectTab.bind(null, tab)} onClick={this.selectTab.bind(null, tab)}
> >
{capitalize(tab)} {tab}
</div> </div>
))} ))}
</div> </div>

@ -6,7 +6,7 @@ import ListSetting from '../ListSetting'
import Popout from '../Popout' import Popout from '../Popout'
import ColorPicker from '../ColorPicker' import ColorPicker from '../ColorPicker'
import { HIGHLIGHT_KEYS, COLORS } from '../../lib/constants' import { HIGHLIGHT_KEYS, COLORS } from '../../lib/constants'
import { capitalize, stringifyRGBA, generateId } from '../../lib/util' import { stringifyRGBA, generateId } from '../../lib/util'
const colorPickerStyle = { const colorPickerStyle = {
backgroundColor: COLORS.BLACK, backgroundColor: COLORS.BLACK,
@ -19,7 +19,7 @@ const colorPresets = []
const HighlightPicker = ({ title, onChange, color }) => ( const HighlightPicker = ({ title, onChange, color }) => (
<div className="color-picker-container"> <div className="color-picker-container">
<div className="color-picker-header"> <div className="color-picker-header">
<span>{title}</span> <span className="capitalize">{title}</span>
</div> </div>
<ColorPicker <ColorPicker
color={color} color={color}
@ -87,7 +87,7 @@ const ThemeCreate = ({
{({ name }) => <span>{name}</span>} {({ name }) => <span>{name}</span>}
</ListSetting> </ListSetting>
</div> </div>
<div className="theme-colors"> <div className="theme-colors capitalize">
{HIGHLIGHT_KEYS.map(key => ( {HIGHLIGHT_KEYS.map(key => (
<div className="field" key={key}> <div className="field" key={key}>
<Button <Button
@ -96,7 +96,7 @@ const ThemeCreate = ({
background={highlight === key ? COLORS.HOVER : COLORS.BLACK} background={highlight === key ? COLORS.HOVER : COLORS.BLACK}
> >
<div className="row"> <div className="row">
<span>{capitalize(key)}</span> <span className="capitalize">{key}</span>
<span <span
className="color-square" className="color-square"
style={{ style={{
@ -133,7 +133,7 @@ const ThemeCreate = ({
</div> </div>
{highlight && ( {highlight && (
<HighlightPicker <HighlightPicker
title={capitalize(highlight)} title={highlight}
color={highlights[highlight]} color={highlights[highlight]}
onChange={({ rgb }) => updateHighlights({ [highlight]: stringifyRGBA(rgb) })} onChange={({ rgb }) => updateHighlights({ [highlight]: stringifyRGBA(rgb) })}
/> />
@ -177,7 +177,6 @@ const ThemeCreate = ({
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
border-top: 2px solid ${COLORS.SECONDARY}; border-top: 2px solid ${COLORS.SECONDARY};
text-transform: capitalize;
} }
.theme-colors .field { .theme-colors .field {

@ -218,6 +218,10 @@ export default () => (
display: flex; display: flex;
} }
.capitalize {
text-transform: capitalize;
}
/* include just until we have a keyboard navigation style system */ /* include just until we have a keyboard navigation style system */
[role='button']:focus { [role='button']:focus {
outline: none; outline: none;

@ -97,8 +97,6 @@ export const formatCode = async code => {
export const stringifyRGBA = obj => `rgba(${obj.r},${obj.g},${obj.b},${obj.a})` export const stringifyRGBA = obj => `rgba(${obj.r},${obj.g},${obj.b},${obj.a})`
export const capitalize = s => s.charAt(0).toUpperCase() + s.slice(1)
export const generateId = () => export const generateId = () =>
Math.random() Math.random()
.toString(36) .toString(36)

Loading…
Cancel
Save