mc-react-header 0.4.5 → 0.5.2

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.
@@ -8,21 +8,25 @@ on:
8
8
  jobs:
9
9
  release_and_publish:
10
10
  runs-on: ubuntu-latest
11
+
11
12
  steps:
12
13
  - name: Checkout code
13
- uses: actions/checkout@v2
14
+ uses: actions/checkout@v4
14
15
 
15
- - name: Set up Node.js
16
- uses: actions/setup-node@v3
16
+ - name: Setup Node.js
17
+ uses: actions/setup-node@v4
17
18
  with:
18
19
  node-version: "22"
19
20
  registry-url: "https://registry.npmjs.org/"
20
21
 
21
- - name: Install project dependencies
22
- run: npm ci
22
+ - name: Enable pnpm
23
+ run: corepack enable
24
+
25
+ - name: Install dependencies
26
+ run: pnpm install --frozen-lockfile
23
27
 
24
- - name: Build the dist folder
25
- run: npm run build
28
+ - name: Build
29
+ run: pnpm build
26
30
 
27
31
  - name: Create GitHub Release
28
32
  id: create_release
@@ -30,12 +34,12 @@ jobs:
30
34
  env:
31
35
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32
36
  with:
33
- tag_name: ${{ github.ref }}
34
- release_name: ${{ github.ref }}
37
+ tag_name: ${{ github.ref_name }}
38
+ release_name: ${{ github.ref_name }}
35
39
  draft: false
36
40
  prerelease: false
37
41
 
38
42
  - name: Publish to npm
39
- run: npm publish
43
+ run: pnpm publish --no-git-checks
40
44
  env:
41
45
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/README.md CHANGED
@@ -9,13 +9,13 @@ Published to npm, install with `npm install mc-react-header`.
9
9
  ## Development
10
10
 
11
11
  ```bash
12
- npm install
13
- npm start
12
+ pnpm install
13
+ pnpm start
14
14
  ```
15
15
 
16
16
  To make a new version and publish to npm via GitHub Actions:
17
17
 
18
18
  ```bash
19
- npm version <major/minor/patch>
19
+ pnpm version <major/minor/patch>
20
20
  git push --follow-tags
21
21
  ```
@@ -96,3 +96,13 @@ ul.mc-breadcrumb li a:not([href]):hover {
96
96
  border: 0;
97
97
  display: none;
98
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
+ }
@@ -8,9 +8,7 @@ require("./Breadcrumbs.css");
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
10
  const Breadcrumbs = _ref => {
11
- let {
12
- breadcrumbsPath
13
- } = _ref;
11
+ let breadcrumbsPath = _ref.breadcrumbsPath;
14
12
  return /*#__PURE__*/_react.default.createElement("ul", {
15
13
  className: "mc-breadcrumb"
16
14
  }, breadcrumbsPath.map((el, i) => {
package/dist/Navbar.css CHANGED
@@ -112,17 +112,39 @@
112
112
  float: none;
113
113
  display: block;
114
114
  text-align: left;
115
- padding: 2px 20px 2px;
115
+ padding: 3px 20px 1px;
116
116
  z-index: 10;
117
+ line-height: 20px;
118
+ font-size: clamp(12px, 2.5vw, 16px);
119
+ max-width: 160px;
117
120
  }
118
121
  .mc-navbar .mc-navbrand {
119
122
  float: none;
120
123
  display: block;
121
124
  text-align: left;
122
125
  }
126
+
127
+ .mc-navbar .mc-navbrand img {
128
+ width: 45px;
129
+ height: auto;
130
+ }
123
131
  .mc-navbar .more-dropdown {
124
132
  position: absolute;
125
133
  top: 0;
126
134
  right: 0;
127
135
  }
136
+
137
+ .more-btn {
138
+ font-size: clamp(12px, 2.5vw, 16px);
139
+ }
140
+
141
+ .dropdown-content a {
142
+ font-size: clamp(10px, 2.3vw, 14px);
143
+ padding: 4px 12px;
144
+ min-width: 180px;
145
+ }
146
+ .more-btn svg {
147
+ width: 14px;
148
+ height: 14px;
149
+ }
128
150
  }
package/dist/Navbar.js CHANGED
@@ -6,10 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  require("./Navbar.css");
8
8
  var _mcloud_logo = _interopRequireDefault(require("./assets/mcloud_logo.png"));
9
- require("font-awesome/css/font-awesome.min.css");
10
9
  var _react = _interopRequireWildcard(require("react"));
11
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); }
12
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; }
13
18
  const mainSections = {
14
19
  learn: {
15
20
  name: "LEARN",
@@ -63,10 +68,11 @@ const dropdownSections = {
63
68
  }
64
69
  };
65
70
  const DropdownMenu = _ref => {
66
- let {
67
- activeSection
68
- } = _ref;
69
- const [dropdownOpen, setDropdownOpen] = (0, _react.useState)(false);
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];
70
76
  const wrapperRef = (0, _react.useRef)(null);
71
77
  (0, _react.useEffect)(() => {
72
78
  function handleClickOutside(event) {
@@ -85,15 +91,23 @@ const DropdownMenu = _ref => {
85
91
  }, /*#__PURE__*/_react.default.createElement("span", {
86
92
  className: "more-btn",
87
93
  onClick: toggleDropdown
88
- }, "More ", /*#__PURE__*/_react.default.createElement("i", {
89
- className: "fa fa-caret-down"
90
- })), /*#__PURE__*/_react.default.createElement("div", {
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", {
91
106
  className: dropdownContentClass
92
107
  }, Object.keys(dropdownSections).map((element, i) => {
93
- const {
94
- link,
95
- name
96
- } = dropdownSections[element];
108
+ const _dropdownSections$ele = dropdownSections[element],
109
+ link = _dropdownSections$ele.link,
110
+ name = _dropdownSections$ele.name;
97
111
  const cname = element === activeSection ? "active" : "";
98
112
  return /*#__PURE__*/_react.default.createElement("a", {
99
113
  key: i,
@@ -103,9 +117,7 @@ const DropdownMenu = _ref => {
103
117
  })));
104
118
  };
105
119
  const Navbar = _ref2 => {
106
- let {
107
- activeSection
108
- } = _ref2;
120
+ let activeSection = _ref2.activeSection;
109
121
  return /*#__PURE__*/_react.default.createElement("div", {
110
122
  className: "mc-navbar"
111
123
  }, /*#__PURE__*/_react.default.createElement("a", {
package/dist/index.js CHANGED
@@ -10,10 +10,8 @@ var _Navbar = _interopRequireDefault(require("./Navbar"));
10
10
  var _Breadcrumbs = _interopRequireDefault(require("./Breadcrumbs"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  const MaterialsCloudHeader = _ref => {
13
- let {
14
- activeSection,
15
- breadcrumbsPath
16
- } = _ref;
13
+ let activeSection = _ref.activeSection,
14
+ breadcrumbsPath = _ref.breadcrumbsPath;
17
15
  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Navbar.default, {
18
16
  activeSection: activeSection
19
17
  }), /*#__PURE__*/_react.default.createElement(_Breadcrumbs.default, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mc-react-header",
3
- "version": "0.4.5",
3
+ "version": "0.5.2",
4
4
  "author": "Kristjan Eimre <kristjan.eimre@epfl.ch>",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -10,23 +10,6 @@
10
10
  "@babel/preset-env"
11
11
  ]
12
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
- "prebuild": "rimraf dist",
26
- "build": "cross-env NODE_ENV=production npx babel src/MaterialsCloudHeader --out-dir dist --copy-files",
27
- "test": "react-scripts test",
28
- "eject": "react-scripts eject"
29
- },
30
13
  "eslintConfig": {
31
14
  "extends": [
32
15
  "react-app",
@@ -45,13 +28,31 @@
45
28
  "last 1 safari version"
46
29
  ]
47
30
  },
31
+ "peerDependencies": {
32
+ "react": "^18.2.0",
33
+ "react-dom": "^18.2.0"
34
+ },
48
35
  "devDependencies": {
49
36
  "@babel/cli": "^7.19.3",
50
37
  "@babel/core": "^7.20.2",
51
38
  "@babel/preset-env": "^7.20.2",
52
39
  "@babel/preset-react": "^7.18.6",
40
+ "@testing-library/jest-dom": "^5.16.5",
41
+ "@testing-library/react": "^13.4.0",
42
+ "@testing-library/user-event": "^13.5.0",
53
43
  "babel-loader": "^9.1.0",
54
44
  "cross-env": "^7.0.3",
55
- "rimraf": "^4.3.1"
45
+ "react": "^18.2.0",
46
+ "react-dom": "^18.2.0",
47
+ "react-scripts": "^5.0.1",
48
+ "rimraf": "^4.3.1",
49
+ "web-vitals": "^2.1.4"
50
+ },
51
+ "scripts": {
52
+ "start": "react-scripts start",
53
+ "prebuild": "rimraf dist",
54
+ "build": "cross-env NODE_ENV=production npx babel src/MaterialsCloudHeader --out-dir dist --copy-files",
55
+ "test": "react-scripts test",
56
+ "eject": "react-scripts eject"
56
57
  }
57
- }
58
+ }
@@ -0,0 +1,3 @@
1
+ allowBuilds:
2
+ core-js: true
3
+ core-js-pure: true
@@ -96,3 +96,13 @@ ul.mc-breadcrumb li a:not([href]):hover {
96
96
  border: 0;
97
97
  display: none;
98
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
+ }
@@ -112,17 +112,39 @@
112
112
  float: none;
113
113
  display: block;
114
114
  text-align: left;
115
- padding: 2px 20px 2px;
115
+ padding: 3px 20px 1px;
116
116
  z-index: 10;
117
+ line-height: 20px;
118
+ font-size: clamp(12px, 2.5vw, 16px);
119
+ max-width: 160px;
117
120
  }
118
121
  .mc-navbar .mc-navbrand {
119
122
  float: none;
120
123
  display: block;
121
124
  text-align: left;
122
125
  }
126
+
127
+ .mc-navbar .mc-navbrand img {
128
+ width: 45px;
129
+ height: auto;
130
+ }
123
131
  .mc-navbar .more-dropdown {
124
132
  position: absolute;
125
133
  top: 0;
126
134
  right: 0;
127
135
  }
136
+
137
+ .more-btn {
138
+ font-size: clamp(12px, 2.5vw, 16px);
139
+ }
140
+
141
+ .dropdown-content a {
142
+ font-size: clamp(10px, 2.3vw, 14px);
143
+ padding: 4px 12px;
144
+ min-width: 180px;
145
+ }
146
+ .more-btn svg {
147
+ width: 14px;
148
+ height: 14px;
149
+ }
128
150
  }
@@ -2,7 +2,6 @@ import "./Navbar.css";
2
2
 
3
3
  import Logo from "./assets/mcloud_logo.png";
4
4
 
5
- import "font-awesome/css/font-awesome.min.css";
6
5
  import React, { useEffect, useRef, useState } from "react";
7
6
 
8
7
  const mainSections = {
@@ -66,7 +65,17 @@ const DropdownMenu = ({ activeSection }) => {
66
65
  return (
67
66
  <div ref={wrapperRef} className="more-dropdown">
68
67
  <span className="more-btn" onClick={toggleDropdown}>
69
- More <i className="fa fa-caret-down" />
68
+ More{" "}
69
+ <svg
70
+ xmlns="http://www.w3.org/2000/svg"
71
+ width="18"
72
+ height="18"
73
+ viewBox="4 2 18 20"
74
+ fill="currentColor"
75
+ style={{ verticalAlign: "middle" }}
76
+ >
77
+ <path d="M12 15l-7-7h14z" />
78
+ </svg>
70
79
  </span>
71
80
  <div className={dropdownContentClass}>
72
81
  {Object.keys(dropdownSections).map((element, i) => {