Skip to content

Commit 9ec7d9c

Browse files
committed
Remove need for lodash defaults
1 parent b1128a8 commit 9ec7d9c

1 file changed

Lines changed: 8 additions & 19 deletions

File tree

src/components/token/token.tsx

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import React, { FunctionComponent, HTMLAttributes } from 'react';
1010
import classNames from 'classnames';
11-
import defaults from 'lodash/defaults';
1211
import { CommonProps } from '../common';
1312
import { useEuiTheme, isColorDark, hexToRgb } from '../../services';
1413

@@ -106,26 +105,16 @@ export const EuiToken: FunctionComponent<EuiTokenProps> = ({
106105
finalSize = 'm';
107106
}
108107

109-
const currentDisplay = {
110-
color,
111-
fill,
112-
shape,
113-
};
114-
115-
let finalDisplay;
116-
117108
// If the iconType passed is one of the prefab token types,
118109
// grab its properties
119-
if (typeof iconType === 'string' && iconType in TOKEN_MAP) {
120-
const tokenDisplay = TOKEN_MAP[iconType as EuiTokenMapType];
121-
finalDisplay = defaults(currentDisplay, tokenDisplay);
122-
} else {
123-
finalDisplay = currentDisplay;
124-
}
125-
126-
const finalColor = finalDisplay.color || 'gray';
127-
const finalShape = finalDisplay.shape || 'circle';
128-
let finalFill = finalDisplay.fill || 'light';
110+
const tokenDefaults =
111+
typeof iconType === 'string' && iconType in TOKEN_MAP
112+
? TOKEN_MAP[iconType as EuiTokenMapType]
113+
: {};
114+
115+
const finalColor = color || tokenDefaults.color || 'gray';
116+
const finalShape = shape || tokenDefaults.shape || 'circle';
117+
let finalFill = fill || 'light';
129118

130119
const euiTheme = useEuiTheme();
131120
const styles = euiTokenStyles(euiTheme);

0 commit comments

Comments
 (0)