contentoh-components-library 21.2.25 → 21.2.26

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.
@@ -24,7 +24,8 @@ var _reactRouterDom = require("react-router-dom");
24
24
  var _jsxRuntime = require("react/jsx-runtime");
25
25
 
26
26
  var VerticalSideMenuMainPage = function VerticalSideMenuMainPage(_ref) {
27
- var menuoption = _ref.menuoption;
27
+ var _ref$menuoption = _ref.menuoption,
28
+ menuoption = _ref$menuoption === void 0 ? [] : _ref$menuoption;
28
29
 
29
30
  var _useState = (0, _react.useState)(),
30
31
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -32,7 +33,6 @@ var VerticalSideMenuMainPage = function VerticalSideMenuMainPage(_ref) {
32
33
  setTrueBar = _useState2[1];
33
34
 
34
35
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
35
- className: trueBar,
36
36
  bar: trueBar,
37
37
  onMouseOver: function onMouseOver() {
38
38
  return setTrueBar(true);
@@ -51,7 +51,7 @@ var VerticalSideMenuMainPage = function VerticalSideMenuMainPage(_ref) {
51
51
  children: menuoption.map(function (item, index) {
52
52
  var _item$suboption;
53
53
 
54
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
54
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.RouterComponent, {
55
55
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouterDom.NavLink, {
56
56
  to: item.path,
57
57
  className: "option-link",
@@ -5,23 +5,25 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.Container = void 0;
8
+ exports.RouterComponent = exports.Container = void 0;
9
9
 
10
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
11
11
 
12
12
  var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
- var _templateObject;
14
+ var _reactRouterDom = require("react-router-dom");
15
+
16
+ var _templateObject, _templateObject2;
15
17
 
16
18
  var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n height: 98%;\n box-sizing: border-box;\n padding: 23px 10px 70px 10px;\n flex-direction: column;\n justify-content: space-between;\n overflow: auto;\n width: ", "px;\n border-radius: ", "px;\n background: linear-gradient(180deg, #e33aa9 0%, #3b1366 100%);\n scrollbar-width: none;\n display: flex;\n text-align: center;\n transition: width 0.3s linear;\n margin: 10px 0 10px 20px;\n & + * {\n margin-left: 30px;\n }\n .navbar-top {\n transition: all 0.3s linear;\n .option {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n margin-top: ", "%;\n padding-left: ", "px;\n .active {\n background: #e33aa9;\n }\n & + div {\n margin-top: 5px;\n }\n a {\n height: ", "px;\n display: flex;\n justify-content: ", ";\n border-radius: ", "px;\n align-items: center;\n font-family: sans-serif;\n font-style: normal;\n font-weight: 400;\n font-size: 18px;\n line-height: 21px;\n letter-spacing: -0.015em;\n color: #fafafa;\n text-decoration: none;\n &.option-link {\n cursor: pointer;\n width: ", "px;\n margin: 5px 0;\n padding-left: ", "px;\n }\n p {\n cursor: pointer;\n margin: 0%;\n pointer-events: none;\n }\n img {\n width: 22px;\n & + * {\n margin-left: 12px;\n }\n }\n }\n .option-link:hover {\n background: #e33aa9;\n }\n .sub-option {\n display: flex;\n flex-direction: column;\n padding-left: ", "px;\n height: auto;\n width: auto;\n a {\n display: flex;\n justify-content: flex-start;\n text-decoration: none;\n position: relative;\n font-size: 13px;\n border-left: 1px solid #f0eef2;\n border-radius: 0;\n color: #f0eef2;\n padding-top: 14px;\n padding-left: 12px;\n height: 25px;\n &::before {\n border-left: 1px solid #e33aa9;\n width: 10px;\n content: \"\";\n border-radius: 50%;\n height: 10px;\n background-color: white;\n position: absolute;\n bottom: 0;\n left: ", "%;\n }\n &.active {\n background: none;\n &::before {\n background-color: #e33aa9;\n }\n }\n }\n }\n }\n }\n"])), function (_ref) {
17
19
  var bar = _ref.bar;
18
- return bar ? 270 : 58;
20
+ return bar ? 260 : 58;
19
21
  }, function (_ref2) {
20
22
  var bar = _ref2.bar;
21
23
  return bar ? 20 : 50;
22
24
  }, function (_ref3) {
23
25
  var bar = _ref3.bar;
24
- return bar === "" ? 145 : 50;
26
+ return bar === "" ? 145 : 40;
25
27
  }, function (_ref4) {
26
28
  var bar = _ref4.bar;
27
29
  return bar ? 5 : 0;
@@ -45,7 +47,9 @@ var Container = _styledComponents.default.div(_templateObject || (_templateObjec
45
47
  return bar ? 28 : 20;
46
48
  }, function (_ref11) {
47
49
  var bar = _ref11.bar;
48
- return bar ? -4 : -34;
50
+ return bar ? -9 : -40;
49
51
  });
50
52
 
51
- exports.Container = Container;
53
+ exports.Container = Container;
54
+ var RouterComponent = (0, _styledComponents.default)(_reactRouterDom.BrowserRouter)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)([""])));
55
+ exports.RouterComponent = RouterComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.2.25",
3
+ "version": "21.2.26",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -1,17 +1,19 @@
1
- import { Container } from "./styles";
1
+ import {
2
+ Container,
3
+ RouterComponent
4
+ } from "./styles";
2
5
  import iconLogoContentoh from "../../../assets/images/verticalSideMenuMainPage/iconLogoContentoh.svg";
3
6
  import iconLogo from "../../../assets/images/verticalSideMenuMainPage/iconLogo.svg";
4
7
  import React, { useState } from "react";
5
8
  import { NavLink } from "react-router-dom";
6
9
 
7
- export const VerticalSideMenuMainPage = ({ menuoption }) => {
10
+ export const VerticalSideMenuMainPage = ({ menuoption = []}) => {
8
11
  const [trueBar, setTrueBar] = useState();
9
12
  return (
10
13
  <Container
11
- className={trueBar}
12
14
  bar={trueBar}
13
15
  onMouseOver={() => setTrueBar(true)}
14
- onMouseOut={() => setTrueBar(false)}
16
+ onMouseOut={() => setTrueBar(false)}
15
17
  >
16
18
  <div className="navbar-top">
17
19
  <img
@@ -21,7 +23,7 @@ export const VerticalSideMenuMainPage = ({ menuoption }) => {
21
23
  ></img>
22
24
  <div className="option">
23
25
  {menuoption.map((item, index) => (
24
- <div key={index}>
26
+ <RouterComponent key={index}>
25
27
  <NavLink to={item.path} className="option-link">
26
28
  <img src={item.icon} alt={item.title}></img>
27
29
  {trueBar && <p>{item.title}</p>}
@@ -30,14 +32,17 @@ export const VerticalSideMenuMainPage = ({ menuoption }) => {
30
32
  <>
31
33
  {item?.suboption?.map((subitem) => (
32
34
  <div className="sub-option">
33
- <NavLink to={subitem.path} className="sub-option-link">
35
+ <NavLink
36
+ to={subitem.path}
37
+ className="sub-option-link"
38
+ >
34
39
  {trueBar && <p>{subitem.title}</p>}
35
40
  </NavLink>
36
41
  </div>
37
42
  ))}
38
43
  </>
39
44
  )}
40
- </div>
45
+ </RouterComponent>
41
46
  ))}
42
47
  </div>
43
48
  </div>
@@ -1,4 +1,5 @@
1
1
  import styled from "styled-components";
2
+ import { BrowserRouter as Router } from "react-router-dom";
2
3
 
3
4
  export const Container = styled.div`
4
5
  height: 98%;
@@ -7,7 +8,7 @@ export const Container = styled.div`
7
8
  flex-direction: column;
8
9
  justify-content: space-between;
9
10
  overflow: auto;
10
- width: ${({ bar }) => (bar ? 270 : 58)}px;
11
+ width: ${({ bar }) => (bar ? 260 : 58)}px;
11
12
  border-radius: ${({ bar }) => (bar ? 20 : 50)}px;
12
13
  background: linear-gradient(180deg, #e33aa9 0%, #3b1366 100%);
13
14
  scrollbar-width: none;
@@ -24,7 +25,7 @@ export const Container = styled.div`
24
25
  display: flex;
25
26
  flex-direction: column;
26
27
  align-items: flex-start;
27
- margin-top: ${({ bar }) => (bar === "" ? 145 : 50)}%;
28
+ margin-top: ${({ bar }) => (bar === "" ? 145 : 40)}%;
28
29
  padding-left: ${({ bar }) => (bar ? 5 : 0)}px;
29
30
  .active {
30
31
  background: #e33aa9;
@@ -94,7 +95,7 @@ export const Container = styled.div`
94
95
  background-color: white;
95
96
  position: absolute;
96
97
  bottom: 0;
97
- left: ${({ bar }) => (bar ? -4 : -34)}%;
98
+ left: ${({ bar }) => (bar ? -9 : -40)}%;
98
99
  }
99
100
  &.active {
100
101
  background: none;
@@ -107,3 +108,5 @@ export const Container = styled.div`
107
108
  }
108
109
  }
109
110
  `;
111
+
112
+ export const RouterComponent = styled(Router)``;