From 1323ff8ee1378507314cb9dd8b93d9a37e1af055 Mon Sep 17 00:00:00 2001 From: terence Date: Mon, 9 Jan 2017 11:16:53 +0800 Subject: [PATCH] add factor parameter --- src/Avatar/Avatar.react.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Avatar/Avatar.react.js b/src/Avatar/Avatar.react.js index 251706bc..abca2014 100644 --- a/src/Avatar/Avatar.react.js +++ b/src/Avatar/Avatar.react.js @@ -28,9 +28,14 @@ const propTypes = { container: View.propTypes.style, content: Text.propTypes.style, }), + /** + * Padding factor + */ + factor: PropTypes.number, }; const defaultProps = { style: {}, + factor: 1, }; const contextTypes = { uiTheme: PropTypes.object.isRequired, @@ -38,15 +43,14 @@ const contextTypes = { function getStyles(props, context) { const { avatar } = context.uiTheme; - const { size } = props; - + const { size, factor } = props; const local = {}; if (size) { local.container = { - height: size, - width: size, - borderRadius: size / 2, + height: size * factor, + width: size * factor, + borderRadius: size * factor / 2, }; } @@ -83,10 +87,8 @@ class Avatar extends PureComponent { return ( - - - {content} - + + {content} ); }