Add custom source for avatar picture while conserving default bongo cat picture

This commit is contained in:
Tanguy Herbron 2021-04-19 15:30:44 +02:00
parent 505358dfeb
commit 6e3440a5ec

View File

@ -6,7 +6,7 @@ export default function Avatar(props) {
return ( return (
<img <img
className={styles[props.size]} className={styles[props.size]}
src="/images/bongo.png" src={props.src}
alt="The one and only bongo cat!" alt="The one and only bongo cat!"
/> />
); );
@ -14,4 +14,9 @@ export default function Avatar(props) {
Avatar.propTypes = { Avatar.propTypes = {
size: PropTypes.string.isRequired, size: PropTypes.string.isRequired,
src: PropTypes.string
};
Avatar.defaultProps = {
src: "/images/bongo.png"
}; };