1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-12-25 16:38:08 +00:00

Set default prop values in function parameter

This commit is contained in:
Vasek Mlejnsky 2018-08-16 09:00:52 +02:00
parent 6258adb007
commit be49f6901e
2 changed files with 6 additions and 14 deletions

View File

@ -1,27 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';
const Icon = (props) => {
const Icon = ({ icon, size = 30, color = 'black' }) => {
const styles = {
svg: {
display: 'inline-block',
verticalAlign: 'middle',
},
path: {
fill: props.color,
fill: color,
},
};
return (
<svg
style={styles.svg}
width={`${props.size}`}
height={`${props.size}`}
width={`${size}`}
height={`${size}`}
viewBox="0 0 16 16"
>
<path
style={styles.path}
d={props.icon}
d={icon}
/>
</svg>
@ -34,9 +34,5 @@ Icon.propTypes = {
color: PropTypes.string,
};
Icon.defaultProps = {
size: 30,
color: 'black',
};
export default Icon;

View File

@ -21,7 +21,7 @@ const Wrapper = styled.div`
transition: background-color ${TRANSITION_TIME.BASE}, color ${TRANSITION_TIME.BASE};
`;
const AsideRow = ({ children, column }) => (
const AsideRow = ({ children, column = false }) => (
<Wrapper
column={column}
>{children}
@ -32,8 +32,4 @@ AsideRow.propTypes = {
column: PropTypes.bool,
};
AsideRow.defaultProps = {
column: false,
}
export default AsideRow;