Skip to content

Commit b1fa073

Browse files
author
Mahesh Kothur
committed
feat(utility): removed smoothScroll args, parameters from curly braces
1 parent 89c550c commit b1fa073

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

packages/react/src/components/CTA/CTA.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const renderCTA = ({ style, type, ...otherProps }) => {
9090
* @private
9191
* @returns {*} behaviour object
9292
*/
93-
const _jump = (e, type) => (type === 'jump' ? smoothScroll({ e }) : null);
93+
const _jump = (e, type) => (type === 'jump' ? smoothScroll(e) : null);
9494

9595
/**
9696
* sets target

packages/react/src/patterns/sub-patterns/TableOfContents/TOCDesktop.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const TOCDesktop = ({ menuItems, selectedId, updateState }) => {
6666
const title = filteredItems[0].title;
6767
updateState(id, title);
6868
const selector = `a[name="${id}"]`;
69-
smoothScroll({ selector });
69+
smoothScroll(null, selector);
7070
};
7171

7272
/**

packages/react/src/patterns/sub-patterns/TableOfContents/TOCMobile.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import React, { useState, useEffect } from 'react';
99
import { settings as ddsSettings } from '@carbon/ibmdotcom-utilities';
1010
import PropTypes from 'prop-types';
11-
import root from 'window-or-global';
1211
import { settings } from 'carbon-components';
1312
import { smoothScroll } from '@carbon/ibmdotcom-utilities';
1413
import { TableOfContents20 } from '@carbon/icons-react';
@@ -72,7 +71,7 @@ const TOCMobile = ({ menuItems, selectedId, menuLabel, updateState }) => {
7271
const title = filteredItems[0].title;
7372
updateState(id, title);
7473
const selector = `a[name="${id}"]`;
75-
smoothScroll({ selector });
74+
smoothScroll(null, selector);
7675
};
7776

7877
/**

packages/utilities/src/utilities/smoothScroll/smoothScroll.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
* You can use this for jump to target element by providing event object.
1818
* it will scroll into view of target by selecting attribute and assigning to id.
1919
*
20-
* @param {object} { e: Event, Selector: QuerySelector for the target element }
20+
* @param {*} e event object
21+
* @param {*} selector menu item selector id
2122
*/
22-
const smoothScroll = ({ e, selector }) => {
23+
const smoothScroll = (e, selector) => {
2324
let getSelector;
2425
if (e) {
2526
e.preventDefault();

0 commit comments

Comments
 (0)