diff --git a/README.md b/README.md index 84b4bfc76..65fdbeb39 100644 --- a/README.md +++ b/README.md @@ -856,26 +856,27 @@ The `Text` tag is used to add text to your slide. Line height can be adjusted vi Every component above that has `(Base)` after it has been extended from a common class that includes the following props: -| Name | PropType | Description | -| ---------- | -------------------------- | --------------------------------------------------------------------------- | -| italic | PropTypes.boolean | Set `fontStyle` to `italic` | -| bold | PropTypes.boolean | Set `fontWeight` to `bold` | -| caps | PropTypes.boolean | Set `textTransform` to `uppercase` | -| margin | PropTypes.number or string | Set `margin` value | -| padding | PropTypes.number or string | Set `padding` value | -| textColor | PropTypes.string | Set `color` value | -| textFont | PropTypes.string | Set `fontFamily` value | -| textSize | PropTypes.string | Set `fontSize` value | -| textAlign | PropTypes.string | Set `textAlign` value | -| textFont | PropTypes.string | Set `textFont` value | -| bgColor | PropTypes.string | Set `backgroundColor` value | -| bgImage | PropTypes.string | Set `backgroundImage` value | -| bgSize | PropTypes.string | Set `backgroundSize` value | -| bgPosition | PropTypes.string | Set `backgroundPosition` value | -| bgRepeat | PropTypes.string | Set `backgroundRepeat` value | -| bgDarken | PropTypes.number | Float value from 0.0 to 1.0 specifying how much to darken the bgImage image | -| overflow | PropTypes.string | Set `overflow` value | -| height | PropTypes.string | Set `height` value | +| Name | PropType | Description | +| ---------- | -------------------------- | ---------------------------------------------------------------------------- | +| italic | PropTypes.boolean | Set `fontStyle` to `italic` | +| bold | PropTypes.boolean | Set `fontWeight` to `bold` | +| caps | PropTypes.boolean | Set `textTransform` to `uppercase` | +| margin | PropTypes.number or string | Set `margin` value | +| padding | PropTypes.number or string | Set `padding` value | +| textColor | PropTypes.string | Set `color` value | +| textFont | PropTypes.string | Set `fontFamily` value | +| textSize | PropTypes.string | Set `fontSize` value | +| textAlign | PropTypes.string | Set `textAlign` value | +| textFont | PropTypes.string | Set `textFont` value | +| bgColor | PropTypes.string | Set `backgroundColor` value | +| bgImage | PropTypes.string | Set `backgroundImage` value | +| bgSize | PropTypes.string | Set `backgroundSize` value | +| bgPosition | PropTypes.string | Set `backgroundPosition` value | +| bgRepeat | PropTypes.string | Set `backgroundRepeat` value | +| bgDarken | PropTypes.number | Float value from 0.0 to 1.0 specifying how much to darken the bgImage image | +| bgLighten | PropTypes.number | Float value from 0.0 to 1.0 specifying how much to lighten the bgImage image | +| overflow | PropTypes.string | Set `overflow` value | +| height | PropTypes.string | Set `height` value | diff --git a/src/utils/base.js b/src/utils/base.js index 75f84e596..126346667 100644 --- a/src/utils/base.js +++ b/src/utils/base.js @@ -60,6 +60,12 @@ export const getStyles = function getStyles() { ) { this.warnedAboutFontSize = false; } + if ( + process.env.NODE_ENV !== 'production' && + typeof this.warnedAboutLightenAndDarken === 'undefined' + ) { + this.warnedAboutLightenAndDarken = false; + } const { italic, @@ -74,6 +80,7 @@ export const getStyles = function getStyles() { bgColor, bgImage, bgDarken, + bgLighten, bgSize, bgPosition, bgRepeat, @@ -148,8 +155,24 @@ export const getStyles = function getStyles() { styles.backgroundColor = color; } if (bgImage) { + if ( + process.env.NODE_ENV !== 'production' && + !this.warnedAboutLightenAndDarken && + this.context.store.getState().style.globalStyleSet + ) { + if (bgDarken && bgLighten) { + // eslint-disable-next-line + console.warn( + `prop \`bgDarken="${bgDarken}"\` and prop \`bgLighten=${bgLighten}\` are both present. Only bgDarken will be applied.` + ); + this.warnedAboutLightenAndDarken = true; + } + } if (bgDarken) { styles.backgroundImage = `linear-gradient( rgba(0, 0, 0, ${bgDarken}), rgba(0, 0, 0, ${bgDarken}) ), url(${bgImage})`; + } else if (bgLighten) { + styles.backgroundImage = `linear-gradient( rgba(255, 255, 255, ${bgLighten}), rgba(255, 255, 255, ${bgLighten}) ), + url(${bgImage})`; } else { styles.backgroundImage = `url(${bgImage})`; }