From 2d1501457bc06934e1aa17d088ce4466c657d8b4 Mon Sep 17 00:00:00 2001 From: Dimitris Fasoulas Date: Thu, 21 Jun 2018 18:33:53 +0200 Subject: [PATCH] =?UTF-8?q?Allow=20location=20none,=20to=20disable=20autom?= =?UTF-8?q?atic=20location=20styling.=20Closes=20gi=E2=80=A6=20(#17)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #16 Allows location property to receive string `none` which will disable automatic placement of the component. --- README.md | 2 +- build/index.js | 5 +++-- src/index.js | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 48814f1..ff2557e 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/build/index.js b/build/index.js index 29868a6..a456cdb 100644 --- a/build/index.js +++ b/build/index.js @@ -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, diff --git a/src/index.js b/src/index.js index b893665..777f114 100644 --- a/src/index.js +++ b/src/index.js @@ -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,