umwd-components 0.1.129 → 0.1.130

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.
@@ -12,6 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
12
12
  var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.js');
13
13
  var Link = require('next/link');
14
14
  var React = require('react');
15
+ var material = require('@mui/material');
15
16
 
16
17
  // mirror the props of next/link component
17
18
 
@@ -23,23 +24,23 @@ const ScrollLink = _ref => {
23
24
  } = _ref;
24
25
  const handleScroll = e => {
25
26
  e.preventDefault();
26
- //remove everything before the hash
27
+
28
+ // remove everything before the hash
27
29
  const targetId = e.currentTarget.href.replace(/.*\#/, "");
28
- //console.log("targetId", targetId);
29
30
  const elem = document.getElementById(targetId);
30
- //console.log("elem", elem);
31
- //console.log(elem?.getBoundingClientRect().top);
32
- //console.log(window.scrollY);
33
31
  const scrollDistance = window.scrollY + (elem === null || elem === void 0 ? void 0 : elem.getBoundingClientRect().top);
34
- //console.log(scrollDistance);
35
32
  window.scrollTo({
36
- //top: elem?.getBoundingClientRect().top,
37
33
  top: scrollDistance,
38
34
  behavior: "smooth"
39
35
  });
40
36
  };
37
+ const theme = material.useTheme();
38
+ console.log(theme.palette.text);
41
39
  return /*#__PURE__*/React.createElement(Link, _rollupPluginBabelHelpers.extends({}, props, {
42
- onClick: handleScroll
40
+ onClick: handleScroll,
41
+ style: {
42
+ color: theme.palette.primary.contrastText
43
+ }
43
44
  }), children);
44
45
  };
45
46
 
@@ -8,6 +8,7 @@
8
8
  import { extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import Link from 'next/link';
10
10
  import React__default from 'react';
11
+ import { useTheme } from '@mui/material';
11
12
 
12
13
  // mirror the props of next/link component
13
14
 
@@ -19,23 +20,23 @@ const ScrollLink = _ref => {
19
20
  } = _ref;
20
21
  const handleScroll = e => {
21
22
  e.preventDefault();
22
- //remove everything before the hash
23
+
24
+ // remove everything before the hash
23
25
  const targetId = e.currentTarget.href.replace(/.*\#/, "");
24
- //console.log("targetId", targetId);
25
26
  const elem = document.getElementById(targetId);
26
- //console.log("elem", elem);
27
- //console.log(elem?.getBoundingClientRect().top);
28
- //console.log(window.scrollY);
29
27
  const scrollDistance = window.scrollY + (elem === null || elem === void 0 ? void 0 : elem.getBoundingClientRect().top);
30
- //console.log(scrollDistance);
31
28
  window.scrollTo({
32
- //top: elem?.getBoundingClientRect().top,
33
29
  top: scrollDistance,
34
30
  behavior: "smooth"
35
31
  });
36
32
  };
33
+ const theme = useTheme();
34
+ console.log(theme.palette.text);
37
35
  return /*#__PURE__*/React__default.createElement(Link, _extends({}, props, {
38
- onClick: handleScroll
36
+ onClick: handleScroll,
37
+ style: {
38
+ color: theme.palette.primary.contrastText
39
+ }
39
40
  }), children);
40
41
  };
41
42
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.129",
3
+ "version": "0.1.130",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -33,8 +33,12 @@ const ScrollLink = ({ children, ...props }: ScrollLinkProps) => {
33
33
  console.log(theme.palette.text);
34
34
 
35
35
  return (
36
- <Link {...props} onClick={handleScroll}>
37
- <Box sx={{ color: theme.palette.primary.contrastText }}>{children}</Box>
36
+ <Link
37
+ {...props}
38
+ onClick={handleScroll}
39
+ style={{ color: theme.palette.primary.contrastText }}
40
+ >
41
+ {children}
38
42
  </Link>
39
43
  );
40
44
  };