mc-react-header 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,6 +46,11 @@ ul.mc-breadcrumb li a[href]:hover {
46
46
  text-decoration: underline;
47
47
  }
48
48
 
49
+ /* prevent _reboot.scss from bootstrap to override this */
50
+ ul.mc-breadcrumb li a:not([href]):hover {
51
+ color: #303f9f;
52
+ }
53
+
49
54
  .mc-breadcrumb li a::after {
50
55
  content: " ";
51
56
  display: block;
@@ -3,20 +3,20 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports["default"] = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  require("./Breadcrumbs.css");
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
10
  function Breadcrumbs(props) {
11
- return /*#__PURE__*/_react.default.createElement("ul", {
11
+ return /*#__PURE__*/_react["default"].createElement("ul", {
12
12
  className: "mc-breadcrumb"
13
13
  }, props.breadcrumbsPath.map(function (el, i) {
14
- return /*#__PURE__*/_react.default.createElement("li", {
14
+ return /*#__PURE__*/_react["default"].createElement("li", {
15
15
  key: i
16
- }, /*#__PURE__*/_react.default.createElement("a", {
16
+ }, /*#__PURE__*/_react["default"].createElement("a", {
17
17
  href: el.link
18
18
  }, el.name));
19
19
  }));
20
20
  }
21
21
  var _default = Breadcrumbs;
22
- exports.default = _default;
22
+ exports["default"] = _default;
package/dist/Navbar.js CHANGED
@@ -4,12 +4,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ exports["default"] = void 0;
8
8
  require("./Navbar.css");
9
9
  var _mcloud_logo = _interopRequireDefault(require("./assets/mcloud_logo.png"));
10
10
  require("font-awesome/css/font-awesome.min.css");
11
11
  var _react = _interopRequireDefault(require("react"));
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
13
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
14
  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); } }
15
15
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -130,20 +130,20 @@ var DropdownMenu = /*#__PURE__*/function (_React$Component) {
130
130
  if (this.state.dropdownOpen) {
131
131
  dropdownContentClass += " dropdown-open";
132
132
  }
133
- return /*#__PURE__*/_react.default.createElement("div", {
133
+ return /*#__PURE__*/_react["default"].createElement("div", {
134
134
  ref: this.setWrapperRef,
135
135
  className: "more-dropdown"
136
- }, /*#__PURE__*/_react.default.createElement("a", {
136
+ }, /*#__PURE__*/_react["default"].createElement("a", {
137
137
  className: "more-btn",
138
138
  onClick: this.toggleDropdown
139
- }, "More ", /*#__PURE__*/_react.default.createElement("i", {
139
+ }, "More ", /*#__PURE__*/_react["default"].createElement("i", {
140
140
  className: "fa fa-caret-down"
141
- })), /*#__PURE__*/_react.default.createElement("div", {
141
+ })), /*#__PURE__*/_react["default"].createElement("div", {
142
142
  className: dropdownContentClass
143
143
  }, Object.keys(dropdownSections).map(function (element, i) {
144
144
  var cname = "";
145
145
  if (element == _this2.props.activeSection) cname = "active";
146
- return /*#__PURE__*/_react.default.createElement("a", {
146
+ return /*#__PURE__*/_react["default"].createElement("a", {
147
147
  key: i,
148
148
  className: cname,
149
149
  href: dropdownSections[element].link
@@ -152,7 +152,7 @@ var DropdownMenu = /*#__PURE__*/function (_React$Component) {
152
152
  }
153
153
  }]);
154
154
  return DropdownMenu;
155
- }(_react.default.Component);
155
+ }(_react["default"].Component);
156
156
  var Navbar = /*#__PURE__*/function (_React$Component2) {
157
157
  _inherits(Navbar, _React$Component2);
158
158
  var _super2 = _createSuper(Navbar);
@@ -164,29 +164,29 @@ var Navbar = /*#__PURE__*/function (_React$Component2) {
164
164
  key: "render",
165
165
  value: function render() {
166
166
  var _this3 = this;
167
- return /*#__PURE__*/_react.default.createElement("div", {
167
+ return /*#__PURE__*/_react["default"].createElement("div", {
168
168
  className: "mc-navbar"
169
- }, /*#__PURE__*/_react.default.createElement("a", {
169
+ }, /*#__PURE__*/_react["default"].createElement("a", {
170
170
  className: "mc-navbrand",
171
171
  href: "https://www.materialscloud.org/home"
172
- }, /*#__PURE__*/_react.default.createElement("img", {
173
- src: _mcloud_logo.default,
172
+ }, /*#__PURE__*/_react["default"].createElement("img", {
173
+ src: _mcloud_logo["default"],
174
174
  height: "50",
175
175
  alt: "MC logo"
176
176
  })), Object.keys(mainSections).map(function (key, i) {
177
177
  var cname = "mc-navlink";
178
178
  if (key == _this3.props.activeSection) cname += " active";
179
- return /*#__PURE__*/_react.default.createElement("a", {
179
+ return /*#__PURE__*/_react["default"].createElement("a", {
180
180
  key: i,
181
181
  className: cname,
182
182
  href: mainSections[key].link
183
183
  }, mainSections[key].name);
184
- }), /*#__PURE__*/_react.default.createElement(DropdownMenu, {
184
+ }), /*#__PURE__*/_react["default"].createElement(DropdownMenu, {
185
185
  activeSection: this.props.activeSection
186
186
  }));
187
187
  }
188
188
  }]);
189
189
  return Navbar;
190
- }(_react.default.Component);
190
+ }(_react["default"].Component);
191
191
  var _default = Navbar;
192
- exports.default = _default;
192
+ exports["default"] = _default;
package/dist/index.js CHANGED
@@ -4,12 +4,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ exports["default"] = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  require("./index.css");
10
10
  var _Navbar = _interopRequireDefault(require("./Navbar"));
11
11
  var _Breadcrumbs = _interopRequireDefault(require("./Breadcrumbs"));
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
13
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
14
  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); } }
15
15
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -32,18 +32,18 @@ var MaterialsCloudHeader = /*#__PURE__*/function (_React$Component) {
32
32
  _createClass(MaterialsCloudHeader, [{
33
33
  key: "render",
34
34
  value: function render() {
35
- return /*#__PURE__*/_react.default.createElement("div", {
35
+ return /*#__PURE__*/_react["default"].createElement("div", {
36
36
  className: "main-container"
37
- }, /*#__PURE__*/_react.default.createElement(_Navbar.default, {
37
+ }, /*#__PURE__*/_react["default"].createElement(_Navbar["default"], {
38
38
  activeSection: this.props.activeSection
39
- }), /*#__PURE__*/_react.default.createElement("div", {
39
+ }), /*#__PURE__*/_react["default"].createElement("div", {
40
40
  className: "content-container"
41
- }, /*#__PURE__*/_react.default.createElement(_Breadcrumbs.default, {
41
+ }, /*#__PURE__*/_react["default"].createElement(_Breadcrumbs["default"], {
42
42
  breadcrumbsPath: this.props.breadcrumbsPath
43
43
  }), this.props.children));
44
44
  }
45
45
  }]);
46
46
  return MaterialsCloudHeader;
47
- }(_react.default.Component);
47
+ }(_react["default"].Component);
48
48
  var _default = MaterialsCloudHeader;
49
- exports.default = _default;
49
+ exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mc-react-header",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "author": "Kristjan Eimre <kristjan.eimre@epfl.ch>",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -22,7 +22,8 @@
22
22
  },
23
23
  "scripts": {
24
24
  "start": "react-scripts start",
25
- "build": "SET NODE_ENV=production && rm -rf dist && npx babel src/MaterialsCloudHeader --out-dir dist --copy-files",
25
+ "prebuild": "rimraf dist",
26
+ "build": "SET NODE_ENV=production && npx babel src/MaterialsCloudHeader --out-dir dist --copy-files",
26
27
  "test": "react-scripts test",
27
28
  "eject": "react-scripts eject"
28
29
  },
@@ -49,6 +50,7 @@
49
50
  "@babel/core": "^7.20.2",
50
51
  "@babel/preset-env": "^7.20.2",
51
52
  "@babel/preset-react": "^7.18.6",
52
- "babel-loader": "^9.1.0"
53
+ "babel-loader": "^9.1.0",
54
+ "rimraf": "^4.3.1"
53
55
  }
54
56
  }
package/public/index.html CHANGED
@@ -1,43 +1,43 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <link rel="icon" href="%PUBLIC_URL%/favicon.png" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <meta name="theme-color" content="#000000" />
8
- <meta
9
- name="description"
10
- content="Web site created using create-react-app"
11
- />
12
- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
- <!--
14
- manifest.json provides metadata used when your web app is installed on a
15
- user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
- -->
17
- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
- <!--
19
- Notice the use of %PUBLIC_URL% in the tags above.
20
- It will be replaced with the URL of the `public` folder during the build.
21
- Only files inside the `public` folder can be referenced from the HTML.
22
-
23
- Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
- work correctly both with client-side routing and a non-root public URL.
25
- Learn how to configure a non-root public URL by running `npm run build`.
26
- -->
27
- <title>React App</title>
28
- </head>
29
- <body>
30
- <noscript>You need to enable JavaScript to run this app.</noscript>
31
- <div id="root"></div>
32
- <!--
33
- This HTML file is a template.
34
- If you open it directly in the browser, you will see an empty page.
35
-
36
- You can add webfonts, meta tags, or analytics to this file.
37
- The build step will place the bundled scripts into the <body> tag.
38
-
39
- To begin the development, run `npm start` or `yarn start`.
40
- To create a production bundle, use `npm run build` or `yarn build`.
41
- -->
42
- </body>
43
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="%PUBLIC_URL%/favicon.png" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <meta
9
+ name="description"
10
+ content="Web site created using create-react-app"
11
+ />
12
+ <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
+ <!--
14
+ manifest.json provides metadata used when your web app is installed on a
15
+ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
+ -->
17
+ <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
+ <!--
19
+ Notice the use of %PUBLIC_URL% in the tags above.
20
+ It will be replaced with the URL of the `public` folder during the build.
21
+ Only files inside the `public` folder can be referenced from the HTML.
22
+
23
+ Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
+ work correctly both with client-side routing and a non-root public URL.
25
+ Learn how to configure a non-root public URL by running `npm run build`.
26
+ -->
27
+ <title>React App</title>
28
+ </head>
29
+ <body>
30
+ <noscript>You need to enable JavaScript to run this app.</noscript>
31
+ <div id="root"></div>
32
+ <!--
33
+ This HTML file is a template.
34
+ If you open it directly in the browser, you will see an empty page.
35
+
36
+ You can add webfonts, meta tags, or analytics to this file.
37
+ The build step will place the bundled scripts into the <body> tag.
38
+
39
+ To begin the development, run `npm start` or `yarn start`.
40
+ To create a production bundle, use `npm run build` or `yarn build`.
41
+ -->
42
+ </body>
43
+ </html>
@@ -1,25 +1,25 @@
1
- {
2
- "short_name": "React App",
3
- "name": "Create React App Sample",
4
- "icons": [
5
- {
6
- "src": "favicon.ico",
7
- "sizes": "64x64 32x32 24x24 16x16",
8
- "type": "image/x-icon"
9
- },
10
- {
11
- "src": "logo192.png",
12
- "type": "image/png",
13
- "sizes": "192x192"
14
- },
15
- {
16
- "src": "logo512.png",
17
- "type": "image/png",
18
- "sizes": "512x512"
19
- }
20
- ],
21
- "start_url": ".",
22
- "display": "standalone",
23
- "theme_color": "#000000",
24
- "background_color": "#ffffff"
25
- }
1
+ {
2
+ "short_name": "React App",
3
+ "name": "Create React App Sample",
4
+ "icons": [
5
+ {
6
+ "src": "favicon.ico",
7
+ "sizes": "64x64 32x32 24x24 16x16",
8
+ "type": "image/x-icon"
9
+ },
10
+ {
11
+ "src": "logo192.png",
12
+ "type": "image/png",
13
+ "sizes": "192x192"
14
+ },
15
+ {
16
+ "src": "logo512.png",
17
+ "type": "image/png",
18
+ "sizes": "512x512"
19
+ }
20
+ ],
21
+ "start_url": ".",
22
+ "display": "standalone",
23
+ "theme_color": "#000000",
24
+ "background_color": "#ffffff"
25
+ }
package/public/robots.txt CHANGED
@@ -1,3 +1,3 @@
1
- # https://www.robotstxt.org/robotstxt.html
2
- User-agent: *
3
- Disallow:
1
+ # https://www.robotstxt.org/robotstxt.html
2
+ User-agent: *
3
+ Disallow:
package/src/App.css CHANGED
@@ -1,38 +1,38 @@
1
- .App {
2
- text-align: center;
3
- }
4
-
5
- .App-logo {
6
- height: 40vmin;
7
- pointer-events: none;
8
- }
9
-
10
- @media (prefers-reduced-motion: no-preference) {
11
- .App-logo {
12
- animation: App-logo-spin infinite 20s linear;
13
- }
14
- }
15
-
16
- .App-header {
17
- background-color: #282c34;
18
- min-height: 100vh;
19
- display: flex;
20
- flex-direction: column;
21
- align-items: center;
22
- justify-content: center;
23
- font-size: calc(10px + 2vmin);
24
- color: white;
25
- }
26
-
27
- .App-link {
28
- color: #61dafb;
29
- }
30
-
31
- @keyframes App-logo-spin {
32
- from {
33
- transform: rotate(0deg);
34
- }
35
- to {
36
- transform: rotate(360deg);
37
- }
38
- }
1
+ .App {
2
+ text-align: center;
3
+ }
4
+
5
+ .App-logo {
6
+ height: 40vmin;
7
+ pointer-events: none;
8
+ }
9
+
10
+ @media (prefers-reduced-motion: no-preference) {
11
+ .App-logo {
12
+ animation: App-logo-spin infinite 20s linear;
13
+ }
14
+ }
15
+
16
+ .App-header {
17
+ background-color: #282c34;
18
+ min-height: 100vh;
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: center;
22
+ justify-content: center;
23
+ font-size: calc(10px + 2vmin);
24
+ color: white;
25
+ }
26
+
27
+ .App-link {
28
+ color: #61dafb;
29
+ }
30
+
31
+ @keyframes App-logo-spin {
32
+ from {
33
+ transform: rotate(0deg);
34
+ }
35
+ to {
36
+ transform: rotate(360deg);
37
+ }
38
+ }
package/src/App.test.js CHANGED
@@ -1,14 +1,14 @@
1
- import { render, screen } from "@testing-library/react";
2
- import App from "./App";
3
-
4
- test("renders learn link", () => {
5
- render(<App />);
6
- const linkElement = screen.getByText(/LEARN/i);
7
- expect(linkElement).toBeInTheDocument();
8
- });
9
-
10
- test("renders work link", () => {
11
- render(<App />);
12
- const linkElement = screen.getByText(/WORK/i);
13
- expect(linkElement).toBeInTheDocument();
14
- });
1
+ import { render, screen } from "@testing-library/react";
2
+ import App from "./App";
3
+
4
+ test("renders learn link", () => {
5
+ render(<App />);
6
+ const linkElement = screen.getByText(/LEARN/i);
7
+ expect(linkElement).toBeInTheDocument();
8
+ });
9
+
10
+ test("renders work link", () => {
11
+ render(<App />);
12
+ const linkElement = screen.getByText(/WORK/i);
13
+ expect(linkElement).toBeInTheDocument();
14
+ });
@@ -46,6 +46,11 @@ ul.mc-breadcrumb li a[href]:hover {
46
46
  text-decoration: underline;
47
47
  }
48
48
 
49
+ /* prevent _reboot.scss from bootstrap to override this */
50
+ ul.mc-breadcrumb li a:not([href]):hover {
51
+ color: #303f9f;
52
+ }
53
+
49
54
  .mc-breadcrumb li a::after {
50
55
  content: " ";
51
56
  display: block;
package/src/index.css CHANGED
@@ -1,13 +1,13 @@
1
- body {
2
- margin: 0;
3
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
- sans-serif;
6
- -webkit-font-smoothing: antialiased;
7
- -moz-osx-font-smoothing: grayscale;
8
- }
9
-
10
- code {
11
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12
- monospace;
13
- }
1
+ body {
2
+ margin: 0;
3
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
+ sans-serif;
6
+ -webkit-font-smoothing: antialiased;
7
+ -moz-osx-font-smoothing: grayscale;
8
+ }
9
+
10
+ code {
11
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12
+ monospace;
13
+ }
package/src/index.js CHANGED
@@ -1,18 +1,18 @@
1
- import React from "react";
2
- import ReactDOM from "react-dom/client";
3
- import "./index.css";
4
- import App from "./App";
5
- import reportWebVitals from "./reportWebVitals";
6
-
7
- const root = ReactDOM.createRoot(document.getElementById("root"));
8
- document.body.style = "background: white;";
9
- root.render(
10
- <React.StrictMode>
11
- <App />
12
- </React.StrictMode>
13
- );
14
-
15
- // If you want to start measuring performance in your app, pass a function
16
- // to log results (for example: reportWebVitals(console.log))
17
- // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
18
- reportWebVitals();
1
+ import React from "react";
2
+ import ReactDOM from "react-dom/client";
3
+ import "./index.css";
4
+ import App from "./App";
5
+ import reportWebVitals from "./reportWebVitals";
6
+
7
+ const root = ReactDOM.createRoot(document.getElementById("root"));
8
+ document.body.style = "background: white;";
9
+ root.render(
10
+ <React.StrictMode>
11
+ <App />
12
+ </React.StrictMode>
13
+ );
14
+
15
+ // If you want to start measuring performance in your app, pass a function
16
+ // to log results (for example: reportWebVitals(console.log))
17
+ // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
18
+ reportWebVitals();
@@ -1,13 +1,13 @@
1
- const reportWebVitals = onPerfEntry => {
2
- if (onPerfEntry && onPerfEntry instanceof Function) {
3
- import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4
- getCLS(onPerfEntry);
5
- getFID(onPerfEntry);
6
- getFCP(onPerfEntry);
7
- getLCP(onPerfEntry);
8
- getTTFB(onPerfEntry);
9
- });
10
- }
11
- };
12
-
13
- export default reportWebVitals;
1
+ const reportWebVitals = onPerfEntry => {
2
+ if (onPerfEntry && onPerfEntry instanceof Function) {
3
+ import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4
+ getCLS(onPerfEntry);
5
+ getFID(onPerfEntry);
6
+ getFCP(onPerfEntry);
7
+ getLCP(onPerfEntry);
8
+ getTTFB(onPerfEntry);
9
+ });
10
+ }
11
+ };
12
+
13
+ export default reportWebVitals;
package/src/setupTests.js CHANGED
@@ -1,5 +1,5 @@
1
- // jest-dom adds custom jest matchers for asserting on DOM nodes.
2
- // allows you to do things like:
3
- // expect(element).toHaveTextContent(/react/i)
4
- // learn more: https://github.com/testing-library/jest-dom
5
- import '@testing-library/jest-dom';
1
+ // jest-dom adds custom jest matchers for asserting on DOM nodes.
2
+ // allows you to do things like:
3
+ // expect(element).toHaveTextContent(/react/i)
4
+ // learn more: https://github.com/testing-library/jest-dom
5
+ import '@testing-library/jest-dom';