mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-28 03:08:30 +00:00
Set default prop values in function parameter
This commit is contained in:
parent
6258adb007
commit
be49f6901e
@ -1,27 +1,27 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
const Icon = (props) => {
|
const Icon = ({ icon, size = 30, color = 'black' }) => {
|
||||||
const styles = {
|
const styles = {
|
||||||
svg: {
|
svg: {
|
||||||
display: 'inline-block',
|
display: 'inline-block',
|
||||||
verticalAlign: 'middle',
|
verticalAlign: 'middle',
|
||||||
},
|
},
|
||||||
path: {
|
path: {
|
||||||
fill: props.color,
|
fill: color,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
style={styles.svg}
|
style={styles.svg}
|
||||||
width={`${props.size}`}
|
width={`${size}`}
|
||||||
height={`${props.size}`}
|
height={`${size}`}
|
||||||
viewBox="0 0 16 16"
|
viewBox="0 0 16 16"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
style={styles.path}
|
style={styles.path}
|
||||||
d={props.icon}
|
d={icon}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
@ -34,9 +34,5 @@ Icon.propTypes = {
|
|||||||
color: PropTypes.string,
|
color: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
Icon.defaultProps = {
|
|
||||||
size: 30,
|
|
||||||
color: 'black',
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Icon;
|
export default Icon;
|
@ -21,7 +21,7 @@ const Wrapper = styled.div`
|
|||||||
transition: background-color ${TRANSITION_TIME.BASE}, color ${TRANSITION_TIME.BASE};
|
transition: background-color ${TRANSITION_TIME.BASE}, color ${TRANSITION_TIME.BASE};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const AsideRow = ({ children, column }) => (
|
const AsideRow = ({ children, column = false }) => (
|
||||||
<Wrapper
|
<Wrapper
|
||||||
column={column}
|
column={column}
|
||||||
>{children}
|
>{children}
|
||||||
@ -32,8 +32,4 @@ AsideRow.propTypes = {
|
|||||||
column: PropTypes.bool,
|
column: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
AsideRow.defaultProps = {
|
|
||||||
column: false,
|
|
||||||
}
|
|
||||||
|
|
||||||
export default AsideRow;
|
export default AsideRow;
|
||||||
|
Loading…
Reference in New Issue
Block a user