Skip to content

Commit bed7f89

Browse files
committed
fix(lint): fixed lint issues for another components
1 parent 0ae32c9 commit bed7f89

File tree

5 files changed

+65
-39
lines changed

5 files changed

+65
-39
lines changed

packages/react/src/components/LinkWithIcon/LinkWithIcon.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const LinkWithIcon = ({ children, href, ...props }) => {
3737
* @property propTypes
3838
* @description Defined property types for component
3939
*
40-
* @type {{children: array, href: string}}
40+
* @type {{children: Array, href: string}}
4141
*/
4242
LinkWithIcon.propTypes = {
4343
children: PropTypes.array,

packages/react/src/components/LocaleModal/LocaleModalCountries.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ const LocaleModalCountries = ({
137137
/**
138138
* @property propTypes
139139
* @description Defined property types for component
140-
* @type {{regionList: array, availabilityText: string, unavailabilityText: string, placeHolderText: string, labelText: string,}}
140+
* @type {{regionList: Array, availabilityText: string, unavailabilityText: string, placeHolderText: string, labelText: string}}
141141
*/
142142
LocaleModalCountries.propTypes = {
143143
regionList: PropTypes.array,

packages/utilities/src/utilities/sameHeight/sameHeight.js

+5-18
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
import { baseFontSize, breakpoints } from '@carbon/layout';
9+
810
/**
911
* Utility that sets an array of elements to the same height.
1012
*
@@ -22,24 +24,9 @@
2224
*/
2325
function sameHeight(elemCollection, minSize = false) {
2426
const elemArr = Array.prototype.slice.call(elemCollection);
25-
let targetWidth = 0;
26-
if (minSize) {
27-
switch (minSize) {
28-
case 'md':
29-
targetWidth = 671;
30-
break;
31-
case 'lg':
32-
targetWidth = 1055;
33-
break;
34-
case 'xlg':
35-
targetWidth = 1311;
36-
break;
37-
case 'max':
38-
targetWidth = 1583;
39-
break;
40-
}
41-
}
42-
27+
let targetWidth = minSize
28+
? parseFloat(breakpoints[minSize].width) * baseFontSize
29+
: 0;
4330
if (window.innerWidth > targetWidth) {
4431
elemArr.forEach(elem => {
4532
elem.style.height = 'auto';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* Copyright IBM Corp. 2016, 2018
3+
*
4+
* This source code is licensed under the Apache-2.0 license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
import { baseFontSize, breakpoints } from '@carbon/layout';
9+
10+
/**
11+
* Utility that sets an array of elements to the same height.
12+
*
13+
* @example
14+
* import {sameheight} from '@carbon/ibmdotcom-utilities';
15+
*
16+
* sameheight(ElementArray, 'md');
17+
*
18+
* if you want the utility to refresh the sizes as you resize the screen, consider using a listener:
19+
* window.addEventListener('resize', sameheight(ElementArray, 'md'));
20+
*
21+
* @param {Array} elemCollection Html objects array
22+
* @param {string} minSize Minimum size for the utility to be activated, empty for small,
23+
* md for medium, lg for large, xlg for xlarge, max for maximum
24+
*/
25+
function sameHeight(elemCollection, minSize = false) {
26+
const elemArr = Array.prototype.slice.call(elemCollection);
27+
let targetWidth = minSize
28+
? parseFloat(breakpoints[minSize].width) * baseFontSize
29+
: 0;
30+
if (window.innerWidth > targetWidth) {
31+
elemArr.forEach(elem => {
32+
elem.style.height = 'auto';
33+
});
34+
let targetHeight = 0;
35+
36+
elemArr.forEach(elem => {
37+
elem.offsetHeight > targetHeight
38+
? (targetHeight = elem.offsetHeight)
39+
: false;
40+
});
41+
42+
elemArr.forEach(elem => {
43+
elem.offsetHeight == targetHeight;
44+
elem.style.height = targetHeight + 'px';
45+
});
46+
} else {
47+
elemArr.forEach(elem => {
48+
elem.style.height = 'auto';
49+
});
50+
}
51+
}
52+
53+
export default sameHeight;

packages/utilities/src/utilities/sameheight/sameheight.js

+5-19
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
import { baseFontSize, breakpoints } from '@carbon/layout';
9+
810
/**
911
* Utility that sets an array of elements to the same height.
1012
*
11-
*
1213
* @example
1314
* import {sameheight} from '@carbon/ibmdotcom-utilities';
1415
*
@@ -23,24 +24,9 @@
2324
*/
2425
function sameHeight(elemCollection, minSize = false) {
2526
const elemArr = Array.prototype.slice.call(elemCollection);
26-
let targetWidth = 0;
27-
if (minSize) {
28-
switch (minSize) {
29-
case 'md':
30-
targetWidth = 671;
31-
break;
32-
case 'lg':
33-
targetWidth = 1055;
34-
break;
35-
case 'xlg':
36-
targetWidth = 1311;
37-
break;
38-
case 'max':
39-
targetWidth = 1583;
40-
break;
41-
}
42-
}
43-
27+
let targetWidth = minSize
28+
? parseFloat(breakpoints[minSize].width) * baseFontSize
29+
: 0;
4430
if (window.innerWidth > targetWidth) {
4531
elemArr.forEach(elem => {
4632
elem.style.height = 'auto';

0 commit comments

Comments
 (0)