Skip to content

Commit

Permalink
type fixes in icon-button
Browse files Browse the repository at this point in the history
  • Loading branch information
atabel committed May 27, 2017
1 parent f1d8954 commit 5d7a50f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/components/icon-button.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
// @flow
import React from 'react';

const iconStyle = {width: 24, height: 24};

type Props = {
icon: string,
icon: string | React$Element<*>,
label?: string,
onPress: () => void,
style?: Object,
};

const IconButton = ({icon, label, onPress, style}: Props) =>
(typeof icon === 'string'
? <img src={icon} onClick={onPress} alt={label} style={{iconStyle, ...style}} />
: <div onClick={onPress} style={{iconStyle, ...style}}>
typeof icon === 'string'
? <img src={icon} onClick={onPress} alt={label} style={style} />
: <div onClick={onPress} style={style}>
{icon}
</div>);
</div>;

export default IconButton;

0 comments on commit 5d7a50f

Please sign in to comment.