diff --git a/src/AddressBook.tsx b/src/AddressBook.tsx index 01181da..c2f6295 100644 --- a/src/AddressBook.tsx +++ b/src/AddressBook.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import * as colors from 'material-ui/styles/colors'; +import { Avatar } from './Avatar'; import { List, ListItem } from './List'; import { ContactType } from './pim-types'; @@ -59,26 +60,6 @@ class AddressBook extends React.PureComponent { const uid = entry.uid; const name = entry.fn; - let itemProps: any = { - leftAvatar: ( -
- {name[0].toUpperCase()} -
- ), - }; - return ( - {itemProps.leftAvatar} {name} + + {name[0].toUpperCase()} + + {name} ); }); diff --git a/src/Avatar.tsx b/src/Avatar.tsx new file mode 100644 index 0000000..f42612f --- /dev/null +++ b/src/Avatar.tsx @@ -0,0 +1,25 @@ +import * as React from 'react'; +import { pure } from 'recompose'; + +export const Avatar = pure((props: { children: React.ReactNode[] | React.ReactNode, size?: number, style?: any }) => { + const size = (props.size) ? props.size : 40; + + return ( +
+ {props.children} +
+ ); +});