Skip to content

Commit 8cb84ea

Browse files
committed
fix lint errors
1 parent 156b4ec commit 8cb84ea

File tree

5 files changed

+16
-15
lines changed

5 files changed

+16
-15
lines changed

src/components/Avatar/Avatar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function Avatar({
5555
&&
5656
<AvatarHandleFullWidthTag modifiers={ rest } onClick={ onPick } >
5757
<AvatarHandleIconContainerTag modifiers={ rest }>
58-
<Icon name="Camera" color="WHITE" size="custom" customSize={ CAMERA_ICON_SIZE[rest.size] } />
58+
<Icon name="Camera" color="WHITE" size="custom" customSize={ CAMERA_ICON_SIZE[rest.size || 'lg'] } />
5959
<div>
6060
{ pickLabel }
6161
</div>

src/components/Avatar/Avatar.stories.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const withPick = () => (
4848
/>
4949
<Avatar
5050
src="https://randomuser.me/api/portraits/women/17.jpg"
51+
size="xxl"
5152
onPick={ () => alert(1) }
5253
pickLabel="Update"
5354
pickVariant="fullWidth"

src/components/Icon/Icon.theme.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ const [IconSvgTag, themeSvg] = createThemeTag(`${name}Svg`, {
3535
width: '100%',
3636
},
3737
},
38-
modifiers: {
39-
size: (props) => ({
38+
modifiers: (props) => ({
39+
size: {
4040
xs: {
4141
width: '12px',
4242
height: '12px',
@@ -65,8 +65,8 @@ const [IconSvgTag, themeSvg] = createThemeTag(`${name}Svg`, {
6565
height: props.customSize,
6666
width: props.customSize,
6767
},
68-
}),
69-
},
68+
},
69+
}),
7070
});
7171

7272

Lines changed: 2 additions & 2 deletions
Loading

src/theme/createThemeTag.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ const getModifiersStyles = (themeName: string, props: Object) => {
3535
const themeModifiers = fp.getOr({}, ['theme', 'components', themeName, 'modifiers'], props);
3636
const omittedProps = fp.omit(['theme'], props);
3737

38-
return Object.entries(themeModifiers)
39-
.reduce(
40-
(result, [modifierName, modifierData]) => {
41-
const modifierStyles = typeof modifierData === 'function'
42-
? modifierData(omittedProps)
43-
: modifierData || {};
38+
const themeStyles = typeof themeModifiers === 'function'
39+
? themeModifiers(omittedProps)
40+
: themeModifiers;
4441

42+
return Object.keys(themeStyles)
43+
.reduce(
44+
(result, modifierName) => {
4545
const modifierValue = props[modifierName];
4646

4747
let styles = {};
4848

4949
if (typeof modifierValue !== 'boolean') {
50-
styles = modifierStyles[modifierValue] || {};
50+
styles = themeStyles[modifierName][modifierValue] || {};
5151
} else if (modifierValue === true) {
52-
styles = themeModifiers[modifierName];
52+
styles = themeStyles[modifierName];
5353
}
5454

5555
return { ...result, ...styles };

0 commit comments

Comments
 (0)