Skip to content

Commit 1fe45e8

Browse files
committed
fix(utility): changed same-height utility name to camel case
1 parent 2fd7c90 commit 1fe45e8

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

packages/utilities/src/utilities/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ export * from './featureflag';
1111
export * from './geolocation';
1212
export * from './ipcinfoCookie';
1313
export * from './markdownToHtml';
14-
export * from './sameheight';
14+
export * from './sameHeight';
1515
export * from './serialize';
1616
export * from './settings';

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

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

8-
export { default as sameheight } from './sameheight';
8+
export { default as sameHeight } from './sameHeight';

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

+12-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* @param {string} minSize Minimum size for the utility to be activated, empty for small,
2121
* md for medium, lg for large, xlg for xlarge, max for maximum
2222
*/
23-
function sameheight(elemCollection, minSize) {
23+
function sameHeight(elemCollection, minSize = false) {
2424
const elemArr = Array.prototype.slice.call(elemCollection);
2525
let targetWidth = 0;
2626
if (minSize) {
@@ -41,19 +41,26 @@ function sameheight(elemCollection, minSize) {
4141
}
4242

4343
if (window.innerWidth > targetWidth) {
44+
elemArr.forEach(elem => {
45+
elem.style.height = 'auto';
46+
});
4447
let targetHeight = 0;
48+
4549
elemArr.forEach(elem => {
4650
elem.offsetHeight > targetHeight
4751
? (targetHeight = elem.offsetHeight)
4852
: false;
4953
});
5054

5155
elemArr.forEach(elem => {
52-
elem.offsetHeight == targetHeight
53-
? (elem.style.height = 'auto')
54-
: (elem.style.height = targetHeight + 'px');
56+
elem.offsetHeight == targetHeight;
57+
elem.style.height = targetHeight + 'px';
58+
});
59+
} else {
60+
elemArr.forEach(elem => {
61+
elem.style.height = 'auto';
5562
});
5663
}
5764
}
5865

59-
export default sameheight;
66+
export default sameHeight;

0 commit comments

Comments
 (0)