mc-react-header 0.2.0
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.
- package/README.md +78 -0
- package/dist/Breadcrumbs.css +96 -0
- package/dist/Breadcrumbs.js +22 -0
- package/dist/Navbar.css +129 -0
- package/dist/Navbar.js +192 -0
- package/dist/assets/mcloud_logo.png +0 -0
- package/dist/index.css +15 -0
- package/dist/index.js +49 -0
- package/package.json +54 -0
- package/public/favicon.png +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/src/App.css +38 -0
- package/src/App.js +23 -0
- package/src/App.test.js +14 -0
- package/src/MaterialsCloudHeader/Breadcrumbs.css +96 -0
- package/src/MaterialsCloudHeader/Breadcrumbs.js +19 -0
- package/src/MaterialsCloudHeader/Navbar.css +129 -0
- package/src/MaterialsCloudHeader/Navbar.js +131 -0
- package/src/MaterialsCloudHeader/assets/mcloud_logo.png +0 -0
- package/src/MaterialsCloudHeader/index.css +15 -0
- package/src/MaterialsCloudHeader/index.js +25 -0
- package/src/index.css +13 -0
- package/src/index.js +18 -0
- package/src/reportWebVitals.js +13 -0
- package/src/setupTests.js +5 -0
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Materials Cloud header component
|
|
2
|
+
|
|
3
|
+
A React component for Materials Cloud header, built just with CSS.
|
|
4
|
+
|
|
5
|
+
See `src/App.js` on how to use it.
|
|
6
|
+
|
|
7
|
+
Published to npm, install with `npm install mc-react-header`.
|
|
8
|
+
|
|
9
|
+
# Getting Started with Create React App
|
|
10
|
+
|
|
11
|
+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
|
12
|
+
|
|
13
|
+
## Available Scripts
|
|
14
|
+
|
|
15
|
+
In the project directory, you can run:
|
|
16
|
+
|
|
17
|
+
### `npm start`
|
|
18
|
+
|
|
19
|
+
Runs the app in the development mode.\
|
|
20
|
+
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
|
21
|
+
|
|
22
|
+
The page will reload when you make changes.\
|
|
23
|
+
You may also see any lint errors in the console.
|
|
24
|
+
|
|
25
|
+
### `npm test`
|
|
26
|
+
|
|
27
|
+
Launches the test runner in the interactive watch mode.\
|
|
28
|
+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
29
|
+
|
|
30
|
+
### `npm run build`
|
|
31
|
+
|
|
32
|
+
Builds the app for production to the `build` folder.\
|
|
33
|
+
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
34
|
+
|
|
35
|
+
The build is minified and the filenames include the hashes.\
|
|
36
|
+
Your app is ready to be deployed!
|
|
37
|
+
|
|
38
|
+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
39
|
+
|
|
40
|
+
### `npm run eject`
|
|
41
|
+
|
|
42
|
+
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
|
43
|
+
|
|
44
|
+
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
45
|
+
|
|
46
|
+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
|
47
|
+
|
|
48
|
+
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
|
49
|
+
|
|
50
|
+
## Learn More
|
|
51
|
+
|
|
52
|
+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
53
|
+
|
|
54
|
+
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
55
|
+
|
|
56
|
+
### Code Splitting
|
|
57
|
+
|
|
58
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
|
59
|
+
|
|
60
|
+
### Analyzing the Bundle Size
|
|
61
|
+
|
|
62
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
|
63
|
+
|
|
64
|
+
### Making a Progressive Web App
|
|
65
|
+
|
|
66
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
|
67
|
+
|
|
68
|
+
### Advanced Configuration
|
|
69
|
+
|
|
70
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
|
71
|
+
|
|
72
|
+
### Deployment
|
|
73
|
+
|
|
74
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
|
75
|
+
|
|
76
|
+
### `npm run build` fails to minify
|
|
77
|
+
|
|
78
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* Style the list */
|
|
2
|
+
ul.mc-breadcrumb {
|
|
3
|
+
padding: 7px 10px 7px 20px;
|
|
4
|
+
list-style: none;
|
|
5
|
+
background-color: #f5f5f5;
|
|
6
|
+
border-radius: 2px;
|
|
7
|
+
border: 1px solid #d6d6d6;
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
font-weight: 300;
|
|
10
|
+
font-family: "Open Sans", sans-serif;
|
|
11
|
+
text-align: left;
|
|
12
|
+
margin: 6px;
|
|
13
|
+
margin-bottom: 20px;
|
|
14
|
+
/* margin-top: 20px; */
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
/* flex-wrap: wrap; */
|
|
19
|
+
/* gap: 40px; */
|
|
20
|
+
justify-content: start;
|
|
21
|
+
align-items: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/* Display list items side by side */
|
|
26
|
+
ul.mc-breadcrumb li {
|
|
27
|
+
display: inline;
|
|
28
|
+
line-height: 1.0;
|
|
29
|
+
margin-right: 46px;
|
|
30
|
+
position: relative;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Add a color to all links inside the list */
|
|
34
|
+
ul.mc-breadcrumb li a {
|
|
35
|
+
color: #303f9f;
|
|
36
|
+
text-decoration: none;
|
|
37
|
+
/* position: relative; */
|
|
38
|
+
/* padding: 0px 5px 0px 50px; */
|
|
39
|
+
/* padding: 10px 0 10px 65px; */
|
|
40
|
+
/* z-index: 3; */
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/* Add a color on mouse-over, if the <a> has href defined */
|
|
45
|
+
ul.mc-breadcrumb li a[href]:hover {
|
|
46
|
+
text-decoration: underline;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.mc-breadcrumb li a::after {
|
|
50
|
+
content: " ";
|
|
51
|
+
display: block;
|
|
52
|
+
width: 0;
|
|
53
|
+
height: 0;
|
|
54
|
+
border-top: 50px solid transparent; /* Go big on the size, and let overflow hide */
|
|
55
|
+
border-bottom: 50px solid transparent;
|
|
56
|
+
border-left: 30px solid #f5f5f5;
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 50%;
|
|
59
|
+
margin-top: -50px;
|
|
60
|
+
/* left: 100%; */
|
|
61
|
+
z-index: 2;
|
|
62
|
+
right: 0;
|
|
63
|
+
z-index: 2;
|
|
64
|
+
transform: translate(30px, 0);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.mc-breadcrumb li a::before {
|
|
68
|
+
content: " ";
|
|
69
|
+
display: block;
|
|
70
|
+
width: 0;
|
|
71
|
+
height: 0;
|
|
72
|
+
border-top: 50px solid transparent;
|
|
73
|
+
border-bottom: 50px solid transparent;
|
|
74
|
+
border-left: 30px solid #d6d6d6;
|
|
75
|
+
position: absolute;
|
|
76
|
+
top: 50%;
|
|
77
|
+
margin-top: -50px;
|
|
78
|
+
margin-left: 2px;
|
|
79
|
+
/* left: 100%; */
|
|
80
|
+
right: 0;
|
|
81
|
+
z-index: 1;
|
|
82
|
+
transform: translate(32px, 0);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.mc-breadcrumb li:last-child a {
|
|
86
|
+
background: transparent !important;
|
|
87
|
+
color: #303f9f;
|
|
88
|
+
/* pointer-events: none;
|
|
89
|
+
cursor: default; */
|
|
90
|
+
}
|
|
91
|
+
.mc-breadcrumb li:last-child a::after,
|
|
92
|
+
.mc-breadcrumb li:last-child a::before {
|
|
93
|
+
border: 0;
|
|
94
|
+
display: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
require("./Breadcrumbs.css");
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function Breadcrumbs(props) {
|
|
11
|
+
return /*#__PURE__*/_react.default.createElement("ul", {
|
|
12
|
+
className: "mc-breadcrumb"
|
|
13
|
+
}, props.breadcrumbsPath.map(function (el, i) {
|
|
14
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
15
|
+
key: i
|
|
16
|
+
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
17
|
+
href: el.link
|
|
18
|
+
}, el.name));
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
var _default = Breadcrumbs;
|
|
22
|
+
exports.default = _default;
|
package/dist/Navbar.css
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
.mc-navbar {
|
|
2
|
+
background-color: rgb(255, 255, 255);
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
border-bottom: 3px solid #dee6e6;
|
|
5
|
+
z-index: 10;
|
|
6
|
+
font-family: "Open Sans", sans-serif;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.mc-navbar .mc-navbrand {
|
|
10
|
+
float: left;
|
|
11
|
+
display: block;
|
|
12
|
+
text-align: center;
|
|
13
|
+
font-size: 0px;
|
|
14
|
+
padding: 7px 15px 5px 20px;
|
|
15
|
+
/* border: 1px solid green; */
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.mc-navbar .mc-navlink {
|
|
19
|
+
float: left;
|
|
20
|
+
display: block;
|
|
21
|
+
color: #455860;
|
|
22
|
+
font-size: 16px;
|
|
23
|
+
line-height: 32px;
|
|
24
|
+
font-weight: 700;
|
|
25
|
+
text-align: center;
|
|
26
|
+
padding: 14px 15px;
|
|
27
|
+
text-decoration: none;
|
|
28
|
+
/* border: 1px solid green; */
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Change the color of links on hover */
|
|
32
|
+
.mc-navbar a:hover {
|
|
33
|
+
color: #8fa5af;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Add an active class to highlight the current page */
|
|
37
|
+
.mc-navbar a.active {
|
|
38
|
+
background-color: #fbfcfc;
|
|
39
|
+
color: #cc1b30;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.more-dropdown {
|
|
43
|
+
padding: 14px 0px;
|
|
44
|
+
float: right;
|
|
45
|
+
/* border: 1px solid rgb(128, 0, 0); */
|
|
46
|
+
/* overflow: hidden; */
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.more-btn {
|
|
50
|
+
color: #455860;
|
|
51
|
+
font-size: 16px;
|
|
52
|
+
line-height: 32px;
|
|
53
|
+
/* display: block; */
|
|
54
|
+
text-decoration: none;
|
|
55
|
+
font-weight: 700;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
text-align: center;
|
|
58
|
+
padding: 21px 20px;
|
|
59
|
+
/* border: 1px solid green; */
|
|
60
|
+
/* margin: 0; Important for vertical align on mobile phones */
|
|
61
|
+
user-select: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.dropdown-content {
|
|
65
|
+
display: none;
|
|
66
|
+
position: absolute;
|
|
67
|
+
right: 0;
|
|
68
|
+
background-color: #ffffff;
|
|
69
|
+
min-width: 220px;
|
|
70
|
+
border-radius: 6px;
|
|
71
|
+
border: 2px solid #dee6e6;
|
|
72
|
+
z-index: 100;
|
|
73
|
+
padding: 5px 0px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.dropdown-content a {
|
|
77
|
+
float: none;
|
|
78
|
+
color: #455860;
|
|
79
|
+
font-weight: 300;
|
|
80
|
+
padding: 10px 14px;
|
|
81
|
+
text-decoration: none;
|
|
82
|
+
display: block;
|
|
83
|
+
text-align: left;
|
|
84
|
+
font-size: 16px;
|
|
85
|
+
line-height: 10px;
|
|
86
|
+
z-index: 100;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.dropdown-content a:hover {
|
|
90
|
+
background-color: #fbfcfc;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.dropdown-open {
|
|
94
|
+
display: block;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Show the dropdown menu on hover */
|
|
98
|
+
/* .more-dropdown:hover .dropdown-content {
|
|
99
|
+
display: block;
|
|
100
|
+
} */
|
|
101
|
+
|
|
102
|
+
@media screen and (max-width: 680px) {
|
|
103
|
+
/* .mc-navbar a.menu {
|
|
104
|
+
float: right;
|
|
105
|
+
display: block;
|
|
106
|
+
border: 2px solid #455860;
|
|
107
|
+
} */
|
|
108
|
+
/* .mc-navbar {
|
|
109
|
+
position: relative;
|
|
110
|
+
} */
|
|
111
|
+
.mc-navbar .mc-navlink {
|
|
112
|
+
position: relative;
|
|
113
|
+
float: none;
|
|
114
|
+
display: block;
|
|
115
|
+
text-align: left;
|
|
116
|
+
padding: 2px 20px 2px;
|
|
117
|
+
z-index: 10;
|
|
118
|
+
}
|
|
119
|
+
.mc-navbar .mc-navbrand {
|
|
120
|
+
float: none;
|
|
121
|
+
display: block;
|
|
122
|
+
text-align: left;
|
|
123
|
+
}
|
|
124
|
+
.mc-navbar .more-dropdown {
|
|
125
|
+
position: absolute;
|
|
126
|
+
top: 0;
|
|
127
|
+
right: 0;
|
|
128
|
+
}
|
|
129
|
+
}
|
package/dist/Navbar.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
require("./Navbar.css");
|
|
9
|
+
var _mcloud_logo = _interopRequireDefault(require("./assets/mcloud_logo.png"));
|
|
10
|
+
require("font-awesome/css/font-awesome.min.css");
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
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
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
17
|
+
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); }
|
|
18
|
+
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); }
|
|
19
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
20
|
+
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); }; }
|
|
21
|
+
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); }
|
|
22
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
23
|
+
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; } }
|
|
24
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
25
|
+
var mainSections = {
|
|
26
|
+
learn: {
|
|
27
|
+
name: "LEARN",
|
|
28
|
+
link: "https://www.materialscloud.org/learn"
|
|
29
|
+
},
|
|
30
|
+
work: {
|
|
31
|
+
name: "WORK",
|
|
32
|
+
link: "https://www.materialscloud.org/work"
|
|
33
|
+
},
|
|
34
|
+
discover: {
|
|
35
|
+
name: "DISCOVER",
|
|
36
|
+
link: "https://www.materialscloud.org/discover"
|
|
37
|
+
},
|
|
38
|
+
explore: {
|
|
39
|
+
name: "EXPLORE",
|
|
40
|
+
link: "https://www.materialscloud.org/explore"
|
|
41
|
+
},
|
|
42
|
+
archive: {
|
|
43
|
+
name: "ARCHIVE",
|
|
44
|
+
link: "https://www.materialscloud.org/archive"
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var dropdownSections = {
|
|
48
|
+
policies: {
|
|
49
|
+
name: "Policies",
|
|
50
|
+
link: "https://www.materialscloud.org/policies"
|
|
51
|
+
},
|
|
52
|
+
dmp: {
|
|
53
|
+
name: "Data Management Plan",
|
|
54
|
+
link: "https://www.materialscloud.org/dmp"
|
|
55
|
+
},
|
|
56
|
+
terms: {
|
|
57
|
+
name: "Terms of Use",
|
|
58
|
+
link: "https://www.materialscloud.org/termssummary"
|
|
59
|
+
},
|
|
60
|
+
infrastructure: {
|
|
61
|
+
name: "Infrastructure",
|
|
62
|
+
link: "https://www.materialscloud.org/infrastructure"
|
|
63
|
+
},
|
|
64
|
+
team: {
|
|
65
|
+
name: "Team & Contact",
|
|
66
|
+
link: "https://www.materialscloud.org/team"
|
|
67
|
+
},
|
|
68
|
+
partners: {
|
|
69
|
+
name: "Partners",
|
|
70
|
+
link: "https://www.materialscloud.org/home#partners"
|
|
71
|
+
},
|
|
72
|
+
restapi: {
|
|
73
|
+
name: "Connect your REST API",
|
|
74
|
+
link: "https://www.materialscloud.org/explore/connect"
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
var DropdownMenu = /*#__PURE__*/function (_React$Component) {
|
|
78
|
+
_inherits(DropdownMenu, _React$Component);
|
|
79
|
+
var _super = _createSuper(DropdownMenu);
|
|
80
|
+
function DropdownMenu(props) {
|
|
81
|
+
var _this;
|
|
82
|
+
_classCallCheck(this, DropdownMenu);
|
|
83
|
+
_this = _super.call(this, props);
|
|
84
|
+
_this.state = {
|
|
85
|
+
dropdownOpen: false
|
|
86
|
+
};
|
|
87
|
+
_this.toggleDropdown = _this.toggleDropdown.bind(_assertThisInitialized(_this));
|
|
88
|
+
_this.setWrapperRef = _this.setWrapperRef.bind(_assertThisInitialized(_this));
|
|
89
|
+
_this.handleClickOutside = _this.handleClickOutside.bind(_assertThisInitialized(_this));
|
|
90
|
+
return _this;
|
|
91
|
+
}
|
|
92
|
+
_createClass(DropdownMenu, [{
|
|
93
|
+
key: "componentDidMount",
|
|
94
|
+
value: function componentDidMount() {
|
|
95
|
+
document.addEventListener("mousedown", this.handleClickOutside);
|
|
96
|
+
}
|
|
97
|
+
}, {
|
|
98
|
+
key: "componentWillUnmount",
|
|
99
|
+
value: function componentWillUnmount() {
|
|
100
|
+
document.removeEventListener("mousedown", this.handleClickOutside);
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
key: "setWrapperRef",
|
|
104
|
+
value: function setWrapperRef(node) {
|
|
105
|
+
this.wrapperRef = node;
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
key: "handleClickOutside",
|
|
109
|
+
value: function handleClickOutside(event) {
|
|
110
|
+
if (this.wrapperRef && !this.wrapperRef.contains(event.target)) {
|
|
111
|
+
if (this.state.dropdownOpen) {
|
|
112
|
+
this.setState({
|
|
113
|
+
dropdownOpen: false
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, {
|
|
119
|
+
key: "toggleDropdown",
|
|
120
|
+
value: function toggleDropdown() {
|
|
121
|
+
this.setState({
|
|
122
|
+
dropdownOpen: !this.state.dropdownOpen
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
key: "render",
|
|
127
|
+
value: function render() {
|
|
128
|
+
var _this2 = this;
|
|
129
|
+
var dropdownContentClass = "dropdown-content";
|
|
130
|
+
if (this.state.dropdownOpen) {
|
|
131
|
+
dropdownContentClass += " dropdown-open";
|
|
132
|
+
}
|
|
133
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
134
|
+
ref: this.setWrapperRef,
|
|
135
|
+
className: "more-dropdown"
|
|
136
|
+
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
137
|
+
className: "more-btn",
|
|
138
|
+
onClick: this.toggleDropdown
|
|
139
|
+
}, "More ", /*#__PURE__*/_react.default.createElement("i", {
|
|
140
|
+
className: "fa fa-caret-down"
|
|
141
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
142
|
+
className: dropdownContentClass
|
|
143
|
+
}, Object.keys(dropdownSections).map(function (element, i) {
|
|
144
|
+
var cname = "";
|
|
145
|
+
if (element == _this2.props.activeSection) cname = "active";
|
|
146
|
+
return /*#__PURE__*/_react.default.createElement("a", {
|
|
147
|
+
key: i,
|
|
148
|
+
className: cname,
|
|
149
|
+
href: dropdownSections[element].link
|
|
150
|
+
}, dropdownSections[element].name);
|
|
151
|
+
})));
|
|
152
|
+
}
|
|
153
|
+
}]);
|
|
154
|
+
return DropdownMenu;
|
|
155
|
+
}(_react.default.Component);
|
|
156
|
+
var Navbar = /*#__PURE__*/function (_React$Component2) {
|
|
157
|
+
_inherits(Navbar, _React$Component2);
|
|
158
|
+
var _super2 = _createSuper(Navbar);
|
|
159
|
+
function Navbar() {
|
|
160
|
+
_classCallCheck(this, Navbar);
|
|
161
|
+
return _super2.apply(this, arguments);
|
|
162
|
+
}
|
|
163
|
+
_createClass(Navbar, [{
|
|
164
|
+
key: "render",
|
|
165
|
+
value: function render() {
|
|
166
|
+
var _this3 = this;
|
|
167
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
168
|
+
className: "mc-navbar"
|
|
169
|
+
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
170
|
+
className: "mc-navbrand",
|
|
171
|
+
href: "https://www.materialscloud.org/home"
|
|
172
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
173
|
+
src: _mcloud_logo.default,
|
|
174
|
+
height: "50",
|
|
175
|
+
alt: "MC logo"
|
|
176
|
+
})), Object.keys(mainSections).map(function (key, i) {
|
|
177
|
+
var cname = "mc-navlink";
|
|
178
|
+
if (key == _this3.props.activeSection) cname += " active";
|
|
179
|
+
return /*#__PURE__*/_react.default.createElement("a", {
|
|
180
|
+
key: i,
|
|
181
|
+
className: cname,
|
|
182
|
+
href: mainSections[key].link
|
|
183
|
+
}, mainSections[key].name);
|
|
184
|
+
}), /*#__PURE__*/_react.default.createElement(DropdownMenu, {
|
|
185
|
+
activeSection: this.props.activeSection
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
}]);
|
|
189
|
+
return Navbar;
|
|
190
|
+
}(_react.default.Component);
|
|
191
|
+
var _default = Navbar;
|
|
192
|
+
exports.default = _default;
|
|
Binary file
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.main-container {
|
|
2
|
+
background-color: #f0f6f9;
|
|
3
|
+
height: 100%;
|
|
4
|
+
padding-bottom: 10px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.content-container {
|
|
8
|
+
background-color: white;
|
|
9
|
+
margin: 5px;
|
|
10
|
+
margin-top: 30px;
|
|
11
|
+
margin-bottom: 10px;
|
|
12
|
+
padding: 2px;
|
|
13
|
+
padding-bottom: 20px;
|
|
14
|
+
border-radius: 2px;
|
|
15
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
require("./index.css");
|
|
10
|
+
var _Navbar = _interopRequireDefault(require("./Navbar"));
|
|
11
|
+
var _Breadcrumbs = _interopRequireDefault(require("./Breadcrumbs"));
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
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
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
17
|
+
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); }
|
|
18
|
+
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); }
|
|
19
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
20
|
+
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); }; }
|
|
21
|
+
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); }
|
|
22
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
23
|
+
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; } }
|
|
24
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
25
|
+
var MaterialsCloudHeader = /*#__PURE__*/function (_React$Component) {
|
|
26
|
+
_inherits(MaterialsCloudHeader, _React$Component);
|
|
27
|
+
var _super = _createSuper(MaterialsCloudHeader);
|
|
28
|
+
function MaterialsCloudHeader(props) {
|
|
29
|
+
_classCallCheck(this, MaterialsCloudHeader);
|
|
30
|
+
return _super.call(this, props);
|
|
31
|
+
}
|
|
32
|
+
_createClass(MaterialsCloudHeader, [{
|
|
33
|
+
key: "render",
|
|
34
|
+
value: function render() {
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
|
+
className: "main-container"
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement(_Navbar.default, {
|
|
38
|
+
activeSection: this.props.activeSection
|
|
39
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
40
|
+
className: "content-container"
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement(_Breadcrumbs.default, {
|
|
42
|
+
breadcrumbsPath: this.props.breadcrumbsPath
|
|
43
|
+
}), this.props.children));
|
|
44
|
+
}
|
|
45
|
+
}]);
|
|
46
|
+
return MaterialsCloudHeader;
|
|
47
|
+
}(_react.default.Component);
|
|
48
|
+
var _default = MaterialsCloudHeader;
|
|
49
|
+
exports.default = _default;
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mc-react-header",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"author": "Kristjan Eimre <kristjan.eimre@epfl.ch>",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"babel": {
|
|
8
|
+
"presets": [
|
|
9
|
+
"@babel/preset-react",
|
|
10
|
+
"@babel/preset-env"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
15
|
+
"@testing-library/react": "^13.4.0",
|
|
16
|
+
"@testing-library/user-event": "^13.5.0",
|
|
17
|
+
"font-awesome": "^4.7.0",
|
|
18
|
+
"react": "^18.2.0",
|
|
19
|
+
"react-dom": "^18.2.0",
|
|
20
|
+
"react-scripts": "5.0.1",
|
|
21
|
+
"web-vitals": "^2.1.4"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"start": "react-scripts start",
|
|
25
|
+
"build": "SET NODE_ENV=production && rm -rf dist && npx babel src/MaterialsCloudHeader --out-dir dist --copy-files",
|
|
26
|
+
"test": "react-scripts test",
|
|
27
|
+
"eject": "react-scripts eject"
|
|
28
|
+
},
|
|
29
|
+
"eslintConfig": {
|
|
30
|
+
"extends": [
|
|
31
|
+
"react-app",
|
|
32
|
+
"react-app/jest"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"browserslist": {
|
|
36
|
+
"production": [
|
|
37
|
+
">0.2%",
|
|
38
|
+
"not dead",
|
|
39
|
+
"not op_mini all"
|
|
40
|
+
],
|
|
41
|
+
"development": [
|
|
42
|
+
"last 1 chrome version",
|
|
43
|
+
"last 1 firefox version",
|
|
44
|
+
"last 1 safari version"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@babel/cli": "^7.19.3",
|
|
49
|
+
"@babel/core": "^7.20.2",
|
|
50
|
+
"@babel/preset-env": "^7.20.2",
|
|
51
|
+
"@babel/preset-react": "^7.18.6",
|
|
52
|
+
"babel-loader": "^9.1.0"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
Binary file
|
|
@@ -0,0 +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>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +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
|
+
}
|
package/src/App.css
ADDED
|
@@ -0,0 +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
|
+
}
|
package/src/App.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "./App.css";
|
|
2
|
+
|
|
3
|
+
import MaterialsCloudHeader from "./MaterialsCloudHeader";
|
|
4
|
+
|
|
5
|
+
function App() {
|
|
6
|
+
return (
|
|
7
|
+
<div className="App">
|
|
8
|
+
<MaterialsCloudHeader
|
|
9
|
+
activeSection={"discover"} // see the corresponding key in MaterialsCloudHeader/Navbar.js
|
|
10
|
+
breadcrumbsPath={[
|
|
11
|
+
{ name: "Discover", link: "https://www.materialscloud.org/discover" },
|
|
12
|
+
{ name: "Materials Cloud three-dimensional crystals database", link: "https://www.materialscloud.org/discover/mc3d" },
|
|
13
|
+
{ name: "test", link: null },
|
|
14
|
+
]}
|
|
15
|
+
>
|
|
16
|
+
<h3>Test content</h3>
|
|
17
|
+
<p>Test content</p>
|
|
18
|
+
</MaterialsCloudHeader>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default App;
|
package/src/App.test.js
ADDED
|
@@ -0,0 +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
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* Style the list */
|
|
2
|
+
ul.mc-breadcrumb {
|
|
3
|
+
padding: 7px 10px 7px 20px;
|
|
4
|
+
list-style: none;
|
|
5
|
+
background-color: #f5f5f5;
|
|
6
|
+
border-radius: 2px;
|
|
7
|
+
border: 1px solid #d6d6d6;
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
font-weight: 300;
|
|
10
|
+
font-family: "Open Sans", sans-serif;
|
|
11
|
+
text-align: left;
|
|
12
|
+
margin: 6px;
|
|
13
|
+
margin-bottom: 20px;
|
|
14
|
+
/* margin-top: 20px; */
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
/* flex-wrap: wrap; */
|
|
19
|
+
/* gap: 40px; */
|
|
20
|
+
justify-content: start;
|
|
21
|
+
align-items: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/* Display list items side by side */
|
|
26
|
+
ul.mc-breadcrumb li {
|
|
27
|
+
display: inline;
|
|
28
|
+
line-height: 1.0;
|
|
29
|
+
margin-right: 46px;
|
|
30
|
+
position: relative;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Add a color to all links inside the list */
|
|
34
|
+
ul.mc-breadcrumb li a {
|
|
35
|
+
color: #303f9f;
|
|
36
|
+
text-decoration: none;
|
|
37
|
+
/* position: relative; */
|
|
38
|
+
/* padding: 0px 5px 0px 50px; */
|
|
39
|
+
/* padding: 10px 0 10px 65px; */
|
|
40
|
+
/* z-index: 3; */
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/* Add a color on mouse-over, if the <a> has href defined */
|
|
45
|
+
ul.mc-breadcrumb li a[href]:hover {
|
|
46
|
+
text-decoration: underline;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.mc-breadcrumb li a::after {
|
|
50
|
+
content: " ";
|
|
51
|
+
display: block;
|
|
52
|
+
width: 0;
|
|
53
|
+
height: 0;
|
|
54
|
+
border-top: 50px solid transparent; /* Go big on the size, and let overflow hide */
|
|
55
|
+
border-bottom: 50px solid transparent;
|
|
56
|
+
border-left: 30px solid #f5f5f5;
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 50%;
|
|
59
|
+
margin-top: -50px;
|
|
60
|
+
/* left: 100%; */
|
|
61
|
+
z-index: 2;
|
|
62
|
+
right: 0;
|
|
63
|
+
z-index: 2;
|
|
64
|
+
transform: translate(30px, 0);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.mc-breadcrumb li a::before {
|
|
68
|
+
content: " ";
|
|
69
|
+
display: block;
|
|
70
|
+
width: 0;
|
|
71
|
+
height: 0;
|
|
72
|
+
border-top: 50px solid transparent;
|
|
73
|
+
border-bottom: 50px solid transparent;
|
|
74
|
+
border-left: 30px solid #d6d6d6;
|
|
75
|
+
position: absolute;
|
|
76
|
+
top: 50%;
|
|
77
|
+
margin-top: -50px;
|
|
78
|
+
margin-left: 2px;
|
|
79
|
+
/* left: 100%; */
|
|
80
|
+
right: 0;
|
|
81
|
+
z-index: 1;
|
|
82
|
+
transform: translate(32px, 0);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.mc-breadcrumb li:last-child a {
|
|
86
|
+
background: transparent !important;
|
|
87
|
+
color: #303f9f;
|
|
88
|
+
/* pointer-events: none;
|
|
89
|
+
cursor: default; */
|
|
90
|
+
}
|
|
91
|
+
.mc-breadcrumb li:last-child a::after,
|
|
92
|
+
.mc-breadcrumb li:last-child a::before {
|
|
93
|
+
border: 0;
|
|
94
|
+
display: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import "./Breadcrumbs.css";
|
|
4
|
+
|
|
5
|
+
function Breadcrumbs(props) {
|
|
6
|
+
return (
|
|
7
|
+
<ul className="mc-breadcrumb">
|
|
8
|
+
{props.breadcrumbsPath.map((el, i) => {
|
|
9
|
+
return (
|
|
10
|
+
<li key={i}>
|
|
11
|
+
<a href={el.link}>{el.name}</a>
|
|
12
|
+
</li>
|
|
13
|
+
);
|
|
14
|
+
})}
|
|
15
|
+
</ul>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default Breadcrumbs;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
.mc-navbar {
|
|
2
|
+
background-color: rgb(255, 255, 255);
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
border-bottom: 3px solid #dee6e6;
|
|
5
|
+
z-index: 10;
|
|
6
|
+
font-family: "Open Sans", sans-serif;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.mc-navbar .mc-navbrand {
|
|
10
|
+
float: left;
|
|
11
|
+
display: block;
|
|
12
|
+
text-align: center;
|
|
13
|
+
font-size: 0px;
|
|
14
|
+
padding: 7px 15px 5px 20px;
|
|
15
|
+
/* border: 1px solid green; */
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.mc-navbar .mc-navlink {
|
|
19
|
+
float: left;
|
|
20
|
+
display: block;
|
|
21
|
+
color: #455860;
|
|
22
|
+
font-size: 16px;
|
|
23
|
+
line-height: 32px;
|
|
24
|
+
font-weight: 700;
|
|
25
|
+
text-align: center;
|
|
26
|
+
padding: 14px 15px;
|
|
27
|
+
text-decoration: none;
|
|
28
|
+
/* border: 1px solid green; */
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Change the color of links on hover */
|
|
32
|
+
.mc-navbar a:hover {
|
|
33
|
+
color: #8fa5af;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Add an active class to highlight the current page */
|
|
37
|
+
.mc-navbar a.active {
|
|
38
|
+
background-color: #fbfcfc;
|
|
39
|
+
color: #cc1b30;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.more-dropdown {
|
|
43
|
+
padding: 14px 0px;
|
|
44
|
+
float: right;
|
|
45
|
+
/* border: 1px solid rgb(128, 0, 0); */
|
|
46
|
+
/* overflow: hidden; */
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.more-btn {
|
|
50
|
+
color: #455860;
|
|
51
|
+
font-size: 16px;
|
|
52
|
+
line-height: 32px;
|
|
53
|
+
/* display: block; */
|
|
54
|
+
text-decoration: none;
|
|
55
|
+
font-weight: 700;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
text-align: center;
|
|
58
|
+
padding: 21px 20px;
|
|
59
|
+
/* border: 1px solid green; */
|
|
60
|
+
/* margin: 0; Important for vertical align on mobile phones */
|
|
61
|
+
user-select: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.dropdown-content {
|
|
65
|
+
display: none;
|
|
66
|
+
position: absolute;
|
|
67
|
+
right: 0;
|
|
68
|
+
background-color: #ffffff;
|
|
69
|
+
min-width: 220px;
|
|
70
|
+
border-radius: 6px;
|
|
71
|
+
border: 2px solid #dee6e6;
|
|
72
|
+
z-index: 100;
|
|
73
|
+
padding: 5px 0px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.dropdown-content a {
|
|
77
|
+
float: none;
|
|
78
|
+
color: #455860;
|
|
79
|
+
font-weight: 300;
|
|
80
|
+
padding: 10px 14px;
|
|
81
|
+
text-decoration: none;
|
|
82
|
+
display: block;
|
|
83
|
+
text-align: left;
|
|
84
|
+
font-size: 16px;
|
|
85
|
+
line-height: 10px;
|
|
86
|
+
z-index: 100;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.dropdown-content a:hover {
|
|
90
|
+
background-color: #fbfcfc;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.dropdown-open {
|
|
94
|
+
display: block;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Show the dropdown menu on hover */
|
|
98
|
+
/* .more-dropdown:hover .dropdown-content {
|
|
99
|
+
display: block;
|
|
100
|
+
} */
|
|
101
|
+
|
|
102
|
+
@media screen and (max-width: 680px) {
|
|
103
|
+
/* .mc-navbar a.menu {
|
|
104
|
+
float: right;
|
|
105
|
+
display: block;
|
|
106
|
+
border: 2px solid #455860;
|
|
107
|
+
} */
|
|
108
|
+
/* .mc-navbar {
|
|
109
|
+
position: relative;
|
|
110
|
+
} */
|
|
111
|
+
.mc-navbar .mc-navlink {
|
|
112
|
+
position: relative;
|
|
113
|
+
float: none;
|
|
114
|
+
display: block;
|
|
115
|
+
text-align: left;
|
|
116
|
+
padding: 2px 20px 2px;
|
|
117
|
+
z-index: 10;
|
|
118
|
+
}
|
|
119
|
+
.mc-navbar .mc-navbrand {
|
|
120
|
+
float: none;
|
|
121
|
+
display: block;
|
|
122
|
+
text-align: left;
|
|
123
|
+
}
|
|
124
|
+
.mc-navbar .more-dropdown {
|
|
125
|
+
position: absolute;
|
|
126
|
+
top: 0;
|
|
127
|
+
right: 0;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import "./Navbar.css";
|
|
2
|
+
|
|
3
|
+
import Logo from "./assets/mcloud_logo.png";
|
|
4
|
+
|
|
5
|
+
import "font-awesome/css/font-awesome.min.css";
|
|
6
|
+
import React from "react";
|
|
7
|
+
|
|
8
|
+
const mainSections = {
|
|
9
|
+
learn: { name: "LEARN", link: "https://www.materialscloud.org/learn" },
|
|
10
|
+
work: { name: "WORK", link: "https://www.materialscloud.org/work" },
|
|
11
|
+
discover: {
|
|
12
|
+
name: "DISCOVER",
|
|
13
|
+
link: "https://www.materialscloud.org/discover",
|
|
14
|
+
},
|
|
15
|
+
explore: { name: "EXPLORE", link: "https://www.materialscloud.org/explore" },
|
|
16
|
+
archive: { name: "ARCHIVE", link: "https://www.materialscloud.org/archive" },
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const dropdownSections = {
|
|
20
|
+
policies: {
|
|
21
|
+
name: "Policies",
|
|
22
|
+
link: "https://www.materialscloud.org/policies",
|
|
23
|
+
},
|
|
24
|
+
dmp: {
|
|
25
|
+
name: "Data Management Plan",
|
|
26
|
+
link: "https://www.materialscloud.org/dmp",
|
|
27
|
+
},
|
|
28
|
+
terms: {
|
|
29
|
+
name: "Terms of Use",
|
|
30
|
+
link: "https://www.materialscloud.org/termssummary",
|
|
31
|
+
},
|
|
32
|
+
infrastructure: {
|
|
33
|
+
name: "Infrastructure",
|
|
34
|
+
link: "https://www.materialscloud.org/infrastructure",
|
|
35
|
+
},
|
|
36
|
+
team: { name: "Team & Contact", link: "https://www.materialscloud.org/team" },
|
|
37
|
+
partners: {
|
|
38
|
+
name: "Partners",
|
|
39
|
+
link: "https://www.materialscloud.org/home#partners",
|
|
40
|
+
},
|
|
41
|
+
restapi: {
|
|
42
|
+
name: "Connect your REST API",
|
|
43
|
+
link: "https://www.materialscloud.org/explore/connect",
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
class DropdownMenu extends React.Component {
|
|
48
|
+
constructor(props) {
|
|
49
|
+
super(props);
|
|
50
|
+
this.state = { dropdownOpen: false };
|
|
51
|
+
this.toggleDropdown = this.toggleDropdown.bind(this);
|
|
52
|
+
this.setWrapperRef = this.setWrapperRef.bind(this);
|
|
53
|
+
this.handleClickOutside = this.handleClickOutside.bind(this);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
componentDidMount() {
|
|
57
|
+
document.addEventListener("mousedown", this.handleClickOutside);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
componentWillUnmount() {
|
|
61
|
+
document.removeEventListener("mousedown", this.handleClickOutside);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
setWrapperRef(node) {
|
|
65
|
+
this.wrapperRef = node;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
handleClickOutside(event) {
|
|
69
|
+
if (this.wrapperRef && !this.wrapperRef.contains(event.target)) {
|
|
70
|
+
if (this.state.dropdownOpen) {
|
|
71
|
+
this.setState({ dropdownOpen: false });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
toggleDropdown() {
|
|
77
|
+
this.setState({ dropdownOpen: !this.state.dropdownOpen });
|
|
78
|
+
}
|
|
79
|
+
render() {
|
|
80
|
+
let dropdownContentClass = "dropdown-content";
|
|
81
|
+
if (this.state.dropdownOpen) {
|
|
82
|
+
dropdownContentClass += " dropdown-open";
|
|
83
|
+
}
|
|
84
|
+
return (
|
|
85
|
+
<div ref={this.setWrapperRef} className="more-dropdown">
|
|
86
|
+
<a className="more-btn" onClick={this.toggleDropdown}>
|
|
87
|
+
More <i className="fa fa-caret-down"></i>
|
|
88
|
+
</a>
|
|
89
|
+
<div className={dropdownContentClass}>
|
|
90
|
+
{Object.keys(dropdownSections).map((element, i) => {
|
|
91
|
+
let cname = "";
|
|
92
|
+
if (element == this.props.activeSection) cname = "active";
|
|
93
|
+
return (
|
|
94
|
+
<a
|
|
95
|
+
key={i}
|
|
96
|
+
className={cname}
|
|
97
|
+
href={dropdownSections[element].link}
|
|
98
|
+
>
|
|
99
|
+
{dropdownSections[element].name}
|
|
100
|
+
</a>
|
|
101
|
+
);
|
|
102
|
+
})}
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
class Navbar extends React.Component {
|
|
110
|
+
render() {
|
|
111
|
+
return (
|
|
112
|
+
<div className="mc-navbar">
|
|
113
|
+
<a className="mc-navbrand" href="https://www.materialscloud.org/home">
|
|
114
|
+
<img src={Logo} height="50" alt="MC logo" />
|
|
115
|
+
</a>
|
|
116
|
+
{Object.keys(mainSections).map((key, i) => {
|
|
117
|
+
let cname = "mc-navlink";
|
|
118
|
+
if (key == this.props.activeSection) cname += " active";
|
|
119
|
+
return (
|
|
120
|
+
<a key={i} className={cname} href={mainSections[key].link}>
|
|
121
|
+
{mainSections[key].name}
|
|
122
|
+
</a>
|
|
123
|
+
);
|
|
124
|
+
})}
|
|
125
|
+
<DropdownMenu activeSection={this.props.activeSection} />
|
|
126
|
+
</div>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export default Navbar;
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.main-container {
|
|
2
|
+
background-color: #f0f6f9;
|
|
3
|
+
height: 100%;
|
|
4
|
+
padding-bottom: 10px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.content-container {
|
|
8
|
+
background-color: white;
|
|
9
|
+
margin: 5px;
|
|
10
|
+
margin-top: 30px;
|
|
11
|
+
margin-bottom: 10px;
|
|
12
|
+
padding: 2px;
|
|
13
|
+
padding-bottom: 20px;
|
|
14
|
+
border-radius: 2px;
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.css";
|
|
3
|
+
|
|
4
|
+
import Navbar from "./Navbar";
|
|
5
|
+
import Breadcrumbs from "./Breadcrumbs";
|
|
6
|
+
|
|
7
|
+
class MaterialsCloudHeader extends React.Component {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super(props);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
render() {
|
|
13
|
+
return (
|
|
14
|
+
<div className="main-container">
|
|
15
|
+
<Navbar activeSection={this.props.activeSection} />
|
|
16
|
+
<div className="content-container">
|
|
17
|
+
<Breadcrumbs breadcrumbsPath={this.props.breadcrumbsPath} />
|
|
18
|
+
{this.props.children}
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default MaterialsCloudHeader;
|
package/src/index.css
ADDED
|
@@ -0,0 +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
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +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();
|
|
@@ -0,0 +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;
|