mc-react-header 0.5.3 → 0.5.5

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/.gitignore ADDED
@@ -0,0 +1,26 @@
1
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
+
3
+ # dependencies
4
+ /node_modules
5
+ /.pnp
6
+ .pnp.js
7
+
8
+ # testing
9
+ /coverage
10
+
11
+ # production
12
+ /build
13
+
14
+ # misc
15
+ .DS_Store
16
+ .env.local
17
+ .env.development.local
18
+ .env.test.local
19
+ .env.production.local
20
+
21
+ npm-debug.log*
22
+ yarn-debug.log*
23
+ yarn-error.log*
24
+
25
+ .vscode
26
+ /dist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mc-react-header",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "author": "Kristjan Eimre <kristjan.eimre@epfl.ch>",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -50,39 +50,36 @@ ul.mc-breadcrumb li a:not([href]):hover {
50
50
  }
51
51
 
52
52
  .mc-breadcrumb li a::after {
53
- content: " ";
54
- display: block;
53
+ content: "";
55
54
  width: 0;
56
55
  height: 0;
57
- border-top: 50px solid transparent; /* Go big on the size, and let overflow hide */
56
+ top: 50%;
57
+ right: 0;
58
+ margin-top: -50px;
59
+ border-top: 50px solid transparent;
58
60
  border-bottom: 50px solid transparent;
59
61
  border-left: 30px solid #fafafa;
60
62
  position: absolute;
61
- top: 50%;
62
- margin-top: -50px;
63
- /* left: 100%; */
64
- z-index: 2;
65
- right: 0;
63
+ transform: translateX(30px);
66
64
  z-index: 2;
67
- transform: translate(30px, 0);
65
+ pointer-events: none;
68
66
  }
69
67
 
70
68
  .mc-breadcrumb li a::before {
71
- content: " ";
72
- display: block;
69
+ content: "";
70
+ position: absolute;
73
71
  width: 0;
74
72
  height: 0;
73
+ top: 50%;
74
+ right: 0;
75
+ margin-top: -50px;
76
+ margin-left: 0;
75
77
  border-top: 50px solid transparent;
76
78
  border-bottom: 50px solid transparent;
77
79
  border-left: 30px solid #d6d6d6;
78
- position: absolute;
79
- top: 50%;
80
- margin-top: -50px;
81
- margin-left: 2px;
82
- /* left: 100%; */
83
- right: 0;
80
+ transform: translateX(32px);
84
81
  z-index: 1;
85
- transform: translate(32px, 0);
82
+ pointer-events: none;
86
83
  }
87
84
 
88
85
  .mc-breadcrumb li:last-child a {
@@ -1,108 +0,0 @@
1
- /* Style the list */
2
- ul.mc-breadcrumb {
3
- padding: 7px 10px 7px 20px;
4
- list-style: none;
5
- /* background-color: #f5f5f5; */
6
- background-color: #fafafa;
7
- /* border: 1px solid #d6d6d6; */
8
- border: 1px solid #d2d2d2;
9
- border-radius: 2px;
10
- font-size: 16px;
11
- font-family: "Open Sans", sans-serif;
12
- text-align: left;
13
- margin: 20px;
14
- overflow: hidden;
15
- display: flex;
16
- flex-direction: row;
17
- /* flex-wrap: wrap; */
18
- /* gap: 40px; */
19
- justify-content: start;
20
- align-items: center;
21
- box-shadow: 0 4px 4px rgba(0, 0, 0, 0.04);
22
- }
23
-
24
- /* Display list items side by side */
25
- ul.mc-breadcrumb li {
26
- display: inline;
27
- line-height: 1;
28
- margin-right: 46px;
29
- position: relative;
30
- }
31
-
32
- /* Add a color to all links inside the list */
33
- ul.mc-breadcrumb li a {
34
- color: rgb(62, 112, 187);
35
- text-decoration: none;
36
- /* position: relative; */
37
- /* padding: 0px 5px 0px 50px; */
38
- /* padding: 10px 0 10px 65px; */
39
- /* z-index: 3; */
40
- }
41
-
42
- /* Add a color on mouse-over, if the <a> has href defined */
43
- ul.mc-breadcrumb li a[href]:hover {
44
- text-decoration: underline;
45
- }
46
-
47
- /* prevent _reboot.scss from bootstrap to override this */
48
- ul.mc-breadcrumb li a:not([href]):hover {
49
- color: rgb(62, 112, 187);
50
- }
51
-
52
- .mc-breadcrumb li a::after {
53
- content: " ";
54
- display: block;
55
- width: 0;
56
- height: 0;
57
- border-top: 50px solid transparent; /* Go big on the size, and let overflow hide */
58
- border-bottom: 50px solid transparent;
59
- border-left: 30px solid #fafafa;
60
- position: absolute;
61
- top: 50%;
62
- margin-top: -50px;
63
- /* left: 100%; */
64
- z-index: 2;
65
- right: 0;
66
- z-index: 2;
67
- transform: translate(30px, 0);
68
- }
69
-
70
- .mc-breadcrumb li a::before {
71
- content: " ";
72
- display: block;
73
- width: 0;
74
- height: 0;
75
- border-top: 50px solid transparent;
76
- border-bottom: 50px solid transparent;
77
- border-left: 30px solid #d6d6d6;
78
- position: absolute;
79
- top: 50%;
80
- margin-top: -50px;
81
- margin-left: 2px;
82
- /* left: 100%; */
83
- right: 0;
84
- z-index: 1;
85
- transform: translate(32px, 0);
86
- }
87
-
88
- .mc-breadcrumb li:last-child a {
89
- background: transparent !important;
90
- color: rgb(62, 112, 187);
91
- /* pointer-events: none;
92
- cursor: default; */
93
- }
94
- .mc-breadcrumb li:last-child a::after,
95
- .mc-breadcrumb li:last-child a::before {
96
- border: 0;
97
- display: none;
98
- }
99
-
100
- @media screen and (max-width: 680px) {
101
- ul.mc-breadcrumb {
102
- font-size: clamp(10px, 2.2vw, 16px);
103
- margin-top: 4px;
104
- margin-bottom: 4px;
105
-
106
- padding: 8px 16px 8px 4px;
107
- }
108
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- require("./Breadcrumbs.css");
8
- var _react = _interopRequireDefault(require("react"));
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- const Breadcrumbs = _ref => {
11
- let breadcrumbsPath = _ref.breadcrumbsPath;
12
- return /*#__PURE__*/_react.default.createElement("ul", {
13
- className: "mc-breadcrumb"
14
- }, breadcrumbsPath.map((el, i) => {
15
- return /*#__PURE__*/_react.default.createElement("li", {
16
- key: i
17
- }, /*#__PURE__*/_react.default.createElement("a", {
18
- href: el.link
19
- }, el.name));
20
- }));
21
- };
22
- var _default = exports.default = Breadcrumbs;
package/dist/Navbar.css DELETED
@@ -1,159 +0,0 @@
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
- width: 1em;
54
- height: 1em;
55
- /* display: block; */
56
- text-decoration: none;
57
- font-weight: 700;
58
- cursor: pointer;
59
- text-align: center;
60
- padding: 21px 20px;
61
- /* border: 1px solid green; */
62
- /* margin: 0; Important for vertical align on mobile phones */
63
- user-select: none;
64
- }
65
-
66
- .more-btn svg {
67
- width: 1em;
68
- height: 1em;
69
- vertical-align: middle;
70
- display: inline-block;
71
- }
72
-
73
- .dropdown-content {
74
- display: none;
75
- position: absolute;
76
- right: 0;
77
- background-color: #ffffff;
78
- min-width: 220px;
79
- border-radius: 6px;
80
- border: 2px solid #dee6e6;
81
- z-index: 100;
82
- padding: 5px 0px;
83
- }
84
-
85
- .dropdown-content a {
86
- float: none;
87
- color: #455860;
88
- padding: 10px 14px;
89
- text-decoration: none;
90
- display: block;
91
- text-align: left;
92
- font-size: 16px;
93
- line-height: 10px;
94
- z-index: 100;
95
- }
96
-
97
- .dropdown-content a:hover {
98
- background-color: #fbfcfc;
99
- }
100
-
101
- .dropdown-open {
102
- display: block;
103
- }
104
-
105
- /* Show the dropdown menu on hover */
106
- /* .more-dropdown:hover .dropdown-content {
107
- display: block;
108
- } */
109
-
110
- @media screen and (max-width: 680px) {
111
- /* .mc-navbar a.menu {
112
- float: right;
113
- display: block;
114
- border: 2px solid #455860;
115
- } */
116
- /* .mc-navbar {
117
- position: relative;
118
- } */
119
- .mc-navbar .mc-navlink {
120
- position: relative;
121
- float: none;
122
- display: block;
123
- text-align: left;
124
- padding: 3px 20px 1px;
125
- z-index: 10;
126
- line-height: 20px;
127
- font-size: clamp(12px, 2.5vw, 16px);
128
- max-width: 160px;
129
- }
130
- .mc-navbar .mc-navbrand {
131
- float: none;
132
- display: block;
133
- text-align: left;
134
- }
135
-
136
- .mc-navbar .mc-navbrand img {
137
- width: 45px;
138
- height: auto;
139
- }
140
- .mc-navbar .more-dropdown {
141
- position: absolute;
142
- top: 0;
143
- right: 0;
144
- }
145
-
146
- .more-btn {
147
- font-size: clamp(12px, 2.5vw, 16px);
148
- }
149
-
150
- .dropdown-content a {
151
- font-size: clamp(10px, 2.3vw, 14px);
152
- padding: 4px 12px;
153
- min-width: 180px;
154
- }
155
- .more-btn svg {
156
- width: 14px;
157
- height: 14px;
158
- }
159
- }
package/dist/Navbar.js DELETED
@@ -1,143 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- require("./Navbar.css");
8
- var _mcloud_logo = _interopRequireDefault(require("./assets/mcloud_logo.png"));
9
- var _react = _interopRequireWildcard(require("react"));
10
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
13
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
17
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
18
- const mainSections = {
19
- learn: {
20
- name: "LEARN",
21
- link: "https://www.materialscloud.org/learn"
22
- },
23
- work: {
24
- name: "WORK",
25
- link: "https://www.materialscloud.org/work"
26
- },
27
- discover: {
28
- name: "DISCOVER",
29
- link: "https://www.materialscloud.org/discover"
30
- },
31
- explore: {
32
- name: "EXPLORE",
33
- link: "https://www.materialscloud.org/explore"
34
- },
35
- archive: {
36
- name: "ARCHIVE",
37
- link: "https://www.materialscloud.org/archive"
38
- }
39
- };
40
- const dropdownSections = {
41
- policies: {
42
- name: "Policies",
43
- link: "https://www.materialscloud.org/policies"
44
- },
45
- dmp: {
46
- name: "Data Management Plan",
47
- link: "https://www.materialscloud.org/dmp"
48
- },
49
- terms: {
50
- name: "Terms of Use",
51
- link: "https://www.materialscloud.org/termssummary"
52
- },
53
- infrastructure: {
54
- name: "Infrastructure",
55
- link: "https://www.materialscloud.org/infrastructure"
56
- },
57
- team: {
58
- name: "Team & Contact",
59
- link: "https://www.materialscloud.org/team"
60
- },
61
- partners: {
62
- name: "Partners",
63
- link: "https://www.materialscloud.org/home#partners"
64
- },
65
- restapi: {
66
- name: "Connect your REST API",
67
- link: "https://www.materialscloud.org/explore/connect"
68
- }
69
- };
70
- const DropdownMenu = _ref => {
71
- let activeSection = _ref.activeSection;
72
- const _useState = (0, _react.useState)(false),
73
- _useState2 = _slicedToArray(_useState, 2),
74
- dropdownOpen = _useState2[0],
75
- setDropdownOpen = _useState2[1];
76
- const wrapperRef = (0, _react.useRef)(null);
77
- (0, _react.useEffect)(() => {
78
- function handleClickOutside(event) {
79
- if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
80
- setDropdownOpen(false);
81
- }
82
- }
83
- document.addEventListener("mousedown", handleClickOutside);
84
- return () => document.removeEventListener("mousedown", handleClickOutside);
85
- }, []);
86
- const toggleDropdown = () => setDropdownOpen(prev => !prev);
87
- const dropdownContentClass = "dropdown-content" + (dropdownOpen ? " dropdown-open" : "");
88
- return /*#__PURE__*/_react.default.createElement("div", {
89
- ref: wrapperRef,
90
- className: "more-dropdown"
91
- }, /*#__PURE__*/_react.default.createElement("span", {
92
- className: "more-btn",
93
- onClick: toggleDropdown
94
- }, "More", " ", /*#__PURE__*/_react.default.createElement("svg", {
95
- xmlns: "http://www.w3.org/2000/svg",
96
- width: "18",
97
- height: "18",
98
- viewBox: "4 2 18 20",
99
- fill: "currentColor",
100
- style: {
101
- verticalAlign: "middle"
102
- }
103
- }, /*#__PURE__*/_react.default.createElement("path", {
104
- d: "M12 15l-7-7h14z"
105
- }))), /*#__PURE__*/_react.default.createElement("div", {
106
- className: dropdownContentClass
107
- }, Object.keys(dropdownSections).map((element, i) => {
108
- const _dropdownSections$ele = dropdownSections[element],
109
- link = _dropdownSections$ele.link,
110
- name = _dropdownSections$ele.name;
111
- const cname = element === activeSection ? "active" : "";
112
- return /*#__PURE__*/_react.default.createElement("a", {
113
- key: i,
114
- className: cname,
115
- href: link
116
- }, name);
117
- })));
118
- };
119
- const Navbar = _ref2 => {
120
- let activeSection = _ref2.activeSection;
121
- return /*#__PURE__*/_react.default.createElement("div", {
122
- className: "mc-navbar"
123
- }, /*#__PURE__*/_react.default.createElement("a", {
124
- className: "mc-navbrand",
125
- href: "https://www.materialscloud.org/home"
126
- }, /*#__PURE__*/_react.default.createElement("img", {
127
- src: _mcloud_logo.default,
128
- loading: "lazy",
129
- height: "50",
130
- alt: "MC logo"
131
- })), Object.keys(mainSections).map((key, i) => {
132
- let cname = "mc-navlink";
133
- if (key === activeSection) cname += " active";
134
- return /*#__PURE__*/_react.default.createElement("a", {
135
- key: i,
136
- className: cname,
137
- href: mainSections[key].link
138
- }, mainSections[key].name);
139
- }), /*#__PURE__*/_react.default.createElement(DropdownMenu, {
140
- activeSection: activeSection
141
- }));
142
- };
143
- var _default = exports.default = Navbar;
Binary file
package/dist/index.css DELETED
@@ -1,14 +0,0 @@
1
- .main-container {
2
- background-color: #f0f6f9;
3
- min-height: 100vh;
4
- }
5
-
6
- .content-container {
7
- background-color: white;
8
- margin: 5px;
9
- margin-top: 30px;
10
- margin-bottom: 10px;
11
- padding: 2px;
12
- padding-bottom: 20px;
13
- border-radius: 2px;
14
- }