Skip to content

Commit

Permalink
Merge pull request #3 from raccoongang/redwood-test1
Browse files Browse the repository at this point in the history
chore: [RGOeX-26785] update the component to be compatible with redwood release
  • Loading branch information
dyudyunov authored Sep 6, 2024
2 parents 480073e + cc6ddf6 commit 95fe6dc
Show file tree
Hide file tree
Showing 20 changed files with 55,326 additions and 32,209 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Fixed:

Added:
=====
* Update the component to be compatible with redwood release (RGOeX-26785)
* Added z-index to the cookie banner wrapper (RGOeX-26418)

[palm-rg.1] 2023-11-03 (Palm RG release)
Expand Down
6 changes: 3 additions & 3 deletions build/CookiePolicyBanner/CookiePolicyBanner.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ describe('CookiePolicyBanner', function () {
});
it('empty component when banner has already been viewed', function () {
isOpen = false;
mountedBanner = mount( /*#__PURE__*/React.createElement(CookiePolicyBanner, props));
mountedBanner = mount(/*#__PURE__*/React.createElement(CookiePolicyBanner, props));
isClosedBanner();
});
it('banner component when open', function () {
isOpen = true;
mountedBanner = mount( /*#__PURE__*/React.createElement(CookiePolicyBanner, props));
mountedBanner = mount(/*#__PURE__*/React.createElement(CookiePolicyBanner, props));
isOpenBanner();
});
it('toggles banner closed', function () {
Expand All @@ -89,7 +89,7 @@ describe('CookiePolicyBanner', function () {
props = {
onClose: onClose
};
mountedBanner = mount( /*#__PURE__*/React.createElement(CookiePolicyBanner, props));
mountedBanner = mount(/*#__PURE__*/React.createElement(CookiePolicyBanner, props));
isOpenBanner();
mountedBanner.find(StatusAlert).prop('onClose')();
isClosedBanner();
Expand Down
8 changes: 4 additions & 4 deletions build/CookiePolicyBanner/_cookie-policy-banner.scss
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
@import "@edx/brand/paragon/fonts";
@import "@edx/brand/paragon/variables";

$cookie-banner-background-color: #f2f8fd !default;
$cookie-banner-text-color: #4e4e4e !default;
$cookie-banner-cta-base: #19291F !default;
$cookie-banner-cta-hover: #075683 !default;

$font-family-sans-serif: Arial, sans-serif !default;
$font-family-sans-serif: "Open Sans", Arial, sans-serif;
$small-font-size: 14px;

.edx-cookie-banner-wrapper {
background: $cookie-banner-background-color;
box-sizing: border-box;
z-index: 5;

/** Base Styles - start **/
text-align: left;
line-height: 1.5;

font: {
family: $font-family-sans-serif;
family: $font-family-sans-serif !important;
size: 1rem;
weight: 400;
}

.alert {
position: relative;
padding: 8px 20px;
padding: 8px 20px !important;
}

.alert-dismissible {
Expand Down
41 changes: 19 additions & 22 deletions build/CookiePolicyBanner/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
var _PropTypes$shape;
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
/* eslint-disable react/no-danger */
import React, { Component } from 'react';
import { StatusAlert } from '@edx/paragon';
Expand All @@ -28,19 +27,18 @@ subscribe(APP_CONFIG_INITIALIZED, function () {
}, 'Cookie Policy Banner additional config');
});
var CookieBanner = /*#__PURE__*/function (_Component) {
_inherits(CookieBanner, _Component);
var _super = _createSuper(CookieBanner);
function CookieBanner(props) {
var _this;
_classCallCheck(this, CookieBanner);
_this = _super.call(this, props);
_this.onClose = _this.onClose.bind(_assertThisInitialized(_this));
_this = _callSuper(this, CookieBanner, [props]);
_this.onClose = _this.onClose.bind(_this);
_this.state = {
open: false
};
return _this;
}
_createClass(CookieBanner, [{
_inherits(CookieBanner, _Component);
return _createClass(CookieBanner, [{
key: "componentDidMount",
value: function componentDidMount() {
this.toggleDisplay(!hasViewedCookieBanner(this.props.isViewedCookieName));
Expand Down Expand Up @@ -102,7 +100,6 @@ var CookieBanner = /*#__PURE__*/function (_Component) {
return false;
}
}]);
return CookieBanner;
}(Component);
CookieBanner.defaultProps = {
onClose: function onClose() {},
Expand All @@ -113,7 +110,7 @@ CookieBanner.defaultProps = {
CookieBanner.propTypes = {
onClose: PropTypes.func,
languageCode: PropTypes.string,
policyText: PropTypes.shape((_PropTypes$shape = {}, _defineProperty(_PropTypes$shape, ENGLISH_IETF_TAG, PropTypes.string), _defineProperty(_PropTypes$shape, SPANISH_IETF_TAG, PropTypes.string), _PropTypes$shape)),
policyText: PropTypes.shape(_defineProperty(_defineProperty({}, ENGLISH_IETF_TAG, PropTypes.string), SPANISH_IETF_TAG, PropTypes.string)),
isViewedCookieName: PropTypes.string
};
export default CookieBanner;
106 changes: 59 additions & 47 deletions build/_cookie-policy-banner.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build/_cookie-policy-banner.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion build/_cookie-policy-banner.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "@edx/brand/paragon/fonts";
@import "@edx/brand/paragon/variables";

$cookie-banner-background-color: #f2f8fd !default;
Expand Down
Loading

0 comments on commit 95fe6dc

Please sign in to comment.