From c850a5fa8c5a3c98b1c55b4b0ed221ef2036e2bc Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Sat, 26 Dec 2015 17:52:18 +0000 Subject: [PATCH] [add] CSS textShadow and reintroduce enums --- docs/components/Text.md | 1 + src/components/Text/TextStylePropTypes.js | 1 + src/modules/StylePropTypes/index.js | 35 ++++++++++++----------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/docs/components/Text.md b/docs/components/Text.md index dda4d8da..45af8409 100644 --- a/docs/components/Text.md +++ b/docs/components/Text.md @@ -61,6 +61,7 @@ This function is called on press. + `lineHeight` + `textAlign` + `textDecoration` ++ `textShadow` + `textTransform` + `whiteSpace` + `wordWrap` diff --git a/src/components/Text/TextStylePropTypes.js b/src/components/Text/TextStylePropTypes.js index c910eec6..9751dabc 100644 --- a/src/components/Text/TextStylePropTypes.js +++ b/src/components/Text/TextStylePropTypes.js @@ -14,6 +14,7 @@ export default { 'lineHeight', 'textAlign', 'textDecoration', + 'textShadow', 'textTransform', 'whiteSpace', 'wordWrap', diff --git a/src/modules/StylePropTypes/index.js b/src/modules/StylePropTypes/index.js index 5b05a786..e5f63d36 100644 --- a/src/modules/StylePropTypes/index.js +++ b/src/modules/StylePropTypes/index.js @@ -1,23 +1,25 @@ import { PropTypes } from 'react' -const { number, string } = PropTypes -const numberOrString = PropTypes.oneOfType([ number, string ]) +const { number, oneOf, oneOfType, string } = PropTypes +const numberOrString = oneOfType([ number, string ]) /** * Any properties marked @private are used internally in resets or property * mappings. + * + * https://developer.mozilla.org/en-US/docs/Web/CSS/Reference */ export default { - alignContent: string, - alignItems: string, - alignSelf: string, + alignContent: oneOf([ 'center', 'flex-end', 'flex-start', 'space-around', 'space-between', 'stretch' ]), + alignItems: oneOf([ 'baseline', 'center', 'flex-end', 'flex-start', 'stretch' ]), + alignSelf: oneOf([ 'auto', 'baseline', 'center', 'flex-end', 'flex-start', 'stretch' ]), appearance: string, backfaceVisibility: string, - backgroundAttachment: string, + backgroundAttachment: oneOf([ 'fixed', 'local', 'scroll' ]), backgroundClip: string, backgroundColor: string, backgroundImage: string, - backgroundOrigin: string, + backgroundOrigin: oneOf([ 'border-box', 'content-box', 'padding-box' ]), backgroundPosition: string, backgroundRepeat: string, backgroundSize: string, @@ -43,7 +45,7 @@ export default { borderTopWidth: numberOrString, bottom: numberOrString, boxShadow: string, - boxSizing: string, + boxSizing: oneOf([ 'border-box', 'content-box' ]), clear: string, color: string, cursor: string, @@ -51,18 +53,18 @@ export default { direction: string, /* @private */ flex: number, flexBasis: string, - flexDirection: string, + flexDirection: oneOf([ 'column', 'column-reverse', 'row', 'row-reverse' ]), flexGrow: number, flexShrink: number, - flexWrap: string, - float: string, + flexWrap: oneOf([ 'nowrap', 'wrap', 'wrap-reverse' ]), + float: oneOf([ 'left', 'none', 'right' ]), font: string, /* @private */ fontFamily: string, fontSize: numberOrString, fontStyle: string, fontWeight: string, height: numberOrString, - justifyContent: string, + justifyContent: oneOf([ 'center', 'flex-end', 'flex-start', 'space-around', 'space-between' ]), left: numberOrString, letterSpacing: string, lineHeight: numberOrString, @@ -91,16 +93,17 @@ export default { paddingRight: numberOrString, paddingTop: numberOrString, paddingVertical: numberOrString, - position: string, + position: oneOf([ 'absolute', 'fixed', 'relative', 'static' ]), right: numberOrString, - textAlign: string, + textAlign: oneOf([ 'center', 'justify', 'justify-all', 'left', 'right' ]), textDecoration: string, textOverflow: string, - textTransform: string, + textShadow: string, + textTransform: oneOf([ 'capitalize', 'lowercase', 'none', 'uppercase' ]), top: numberOrString, userSelect: string, verticalAlign: string, - visibility: string, + visibility: oneOf([ 'hidden', 'visible' ]), whiteSpace: string, width: numberOrString, wordWrap: string,