From a4168be21878ee816b11aa4e725207bd7b6456c3 Mon Sep 17 00:00:00 2001 From: Trevor Robinson Date: Fri, 10 Apr 2015 17:38:28 -0500 Subject: [PATCH] rename constants to styleMaps --- src/BootstrapMixin.js | 16 ++++++++-------- src/Col.js | 6 +++--- src/Glyphicon.js | 4 ++-- src/index.js | 4 ++-- src/{constants.js => styleMaps.js} | 6 +++--- test/BootstrapMixinSpec.js | 4 ++-- 6 files changed, 20 insertions(+), 20 deletions(-) rename src/{constants.js => styleMaps.js} (98%) diff --git a/src/BootstrapMixin.js b/src/BootstrapMixin.js index 70561558c1..fc7f52d503 100644 --- a/src/BootstrapMixin.js +++ b/src/BootstrapMixin.js @@ -1,29 +1,29 @@ import React from 'react'; -import constants from './constants'; +import styleMaps from './styleMaps'; import CustomPropTypes from './utils/CustomPropTypes'; const BootstrapMixin = { propTypes: { - bsClass: CustomPropTypes.keyOf(constants.CLASSES), - bsStyle: CustomPropTypes.keyOf(constants.STYLES), - bsSize: CustomPropTypes.keyOf(constants.SIZES) + bsClass: CustomPropTypes.keyOf(styleMaps.CLASSES), + bsStyle: CustomPropTypes.keyOf(styleMaps.STYLES), + bsSize: CustomPropTypes.keyOf(styleMaps.SIZES) }, getBsClassSet() { let classes = {}; - let bsClass = this.props.bsClass && constants.CLASSES[this.props.bsClass]; + let bsClass = this.props.bsClass && styleMaps.CLASSES[this.props.bsClass]; if (bsClass) { classes[bsClass] = true; let prefix = bsClass + '-'; - let bsSize = this.props.bsSize && constants.SIZES[this.props.bsSize]; + let bsSize = this.props.bsSize && styleMaps.SIZES[this.props.bsSize]; if (bsSize) { classes[prefix + bsSize] = true; } - let bsStyle = this.props.bsStyle && constants.STYLES[this.props.bsStyle]; + let bsStyle = this.props.bsStyle && styleMaps.STYLES[this.props.bsStyle]; if (this.props.bsStyle) { classes[prefix + bsStyle] = true; } @@ -33,7 +33,7 @@ const BootstrapMixin = { }, prefixClass(subClass) { - return constants.CLASSES[this.props.bsClass] + '-' + subClass; + return styleMaps.CLASSES[this.props.bsClass] + '-' + subClass; } }; diff --git a/src/Col.js b/src/Col.js index 23ae471ad1..0898e10b2e 100644 --- a/src/Col.js +++ b/src/Col.js @@ -1,6 +1,6 @@ import React from 'react'; import classNames from 'classnames'; -import constants from './constants'; +import styleMaps from './styleMaps'; const Col = React.createClass({ propTypes: { @@ -33,8 +33,8 @@ const Col = React.createClass({ let ComponentClass = this.props.componentClass; let classes = {}; - Object.keys(constants.SIZES).forEach(function (key) { - let size = constants.SIZES[key]; + Object.keys(styleMaps.SIZES).forEach(function (key) { + let size = styleMaps.SIZES[key]; let prop = size; let classPart = size + '-'; diff --git a/src/Glyphicon.js b/src/Glyphicon.js index bb3e41ea19..e406feaa31 100644 --- a/src/Glyphicon.js +++ b/src/Glyphicon.js @@ -1,13 +1,13 @@ import React from 'react'; import classNames from 'classnames'; import BootstrapMixin from './BootstrapMixin'; -import constants from './constants'; +import styleMaps from './styleMaps'; const Glyphicon = React.createClass({ mixins: [BootstrapMixin], propTypes: { - glyph: React.PropTypes.oneOf(constants.GLYPHS).isRequired + glyph: React.PropTypes.oneOf(styleMaps.GLYPHS).isRequired }, getDefaultProps() { diff --git a/src/index.js b/src/index.js index b7e54269fb..ab8c3f01c2 100644 --- a/src/index.js +++ b/src/index.js @@ -47,7 +47,7 @@ import Table from './Table'; import TabPane from './TabPane'; import Tooltip from './Tooltip'; import Well from './Well'; -import constants from './constants'; +import styleMaps from './styleMaps'; export default { Accordion, @@ -99,5 +99,5 @@ export default { TabPane, Tooltip, Well, - constants + styleMaps }; diff --git a/src/constants.js b/src/styleMaps.js similarity index 98% rename from src/constants.js rename to src/styleMaps.js index 9feb03dbcc..83435899c6 100644 --- a/src/constants.js +++ b/src/styleMaps.js @@ -1,4 +1,4 @@ -const constants = { +const styleMaps = { CLASSES: { 'alert': 'alert', 'button': 'btn', @@ -32,7 +32,7 @@ const constants = { 'pills': 'pills' }, addStyle: function(name) { - constants.STYLES[name] = name; + styleMaps.STYLES[name] = name; }, SIZES: { 'large': 'lg', @@ -303,4 +303,4 @@ const constants = { ] }; -export default constants; +export default styleMaps; diff --git a/test/BootstrapMixinSpec.js b/test/BootstrapMixinSpec.js index 99279e726b..dea0bac9ce 100644 --- a/test/BootstrapMixinSpec.js +++ b/test/BootstrapMixinSpec.js @@ -1,7 +1,7 @@ import React from 'react'; import ReactTestUtils from 'react/lib/ReactTestUtils'; import BootstrapMixin from '../src/BootstrapMixin'; -import constants from '../src/constants'; +import styleMaps from '../src/styleMaps'; let Component; @@ -198,7 +198,7 @@ describe('BootstrapMixin', function () { }); it('should return "btn btn-wacky"', function () { - constants.addStyle('wacky'); + styleMaps.addStyle('wacky'); let instance = ReactTestUtils.renderIntoDocument( content