Allow location none, to disable automatic location styling. Closes gi… (#17)

Fixes #16 

Allows location property to receive string `none` which will disable automatic placement of the component.
This commit is contained in:
Dimitris Fasoulas 2018-06-21 18:33:53 +02:00 committed by Rick van Lieshout
parent d601613b5a
commit 2d1501457b
3 changed files with 7 additions and 5 deletions

View File

@ -77,7 +77,7 @@ One of the props (onAccept) is a function, this function will be called after th
## Props
| Prop | Type | Default value | Description |
|---------------|:--------------------------------:|---------------|-------------------------------------------------------------------------------------------------------|
| location | string, either "top" or "bottom" | "bottom" | Syntactic sugar to easily enable you to place the bar at the top or the bottom of the browser window. |
| location | string, "top", "bottom" or "none"| "bottom" | Syntactic sugar to easily enable you to place the bar at the top or the bottom of the browser window. Use "none" to disable. |
| children | string or React component | | Content to appear inside the bar |
| disableStyles | boolean | false | If enabled the component will have no default style. (you can still supply style through props) |
| buttonText | string or React component | "I understand" | Text to appear on the button |

View File

@ -701,7 +701,8 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
var OPTIONS = exports.OPTIONS = {
TOP: "top",
BOTTOM: "bottom"
BOTTOM: "bottom",
NONE: "none"
};
var CookieConsent = function (_Component) {
@ -855,7 +856,7 @@ var CookieConsent = function (_Component) {
}(_react.Component);
CookieConsent.propTypes = {
location: _propTypes2.default.oneOf(["top", "bottom"]),
location: _propTypes2.default.oneOf(Object.values(OPTIONS)),
style: _propTypes2.default.object,
buttonStyle: _propTypes2.default.object,
contentStyle: _propTypes2.default.object,

View File

@ -4,7 +4,8 @@ import Cookies from "js-cookie";
export const OPTIONS = {
TOP: "top",
BOTTOM: "bottom"
BOTTOM: "bottom",
NONE: "none"
};
class CookieConsent extends Component {
@ -131,7 +132,7 @@ class CookieConsent extends Component {
}
CookieConsent.propTypes = {
location: PropTypes.oneOf(["top", "bottom"]),
location: PropTypes.oneOf(Object.values(OPTIONS)),
style: PropTypes.object,
buttonStyle: PropTypes.object,
contentStyle: PropTypes.object,