Skip to content

Commit 39cc286

Browse files
committed
create SubscriptAvatar component
1 parent 3817498 commit 39cc286

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

src/components/SubscriptAvatar.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React, {memo} from 'react';
2+
import PropTypes from 'prop-types';
3+
import {Image, View} from 'react-native';
4+
import styles from '../styles/styles';
5+
import Tooltip from './Tooltip';
6+
7+
const propTypes = {
8+
/** Array of avatar URL */
9+
avatarImageURLs: PropTypes.arrayOf(PropTypes.string).isRequired,
10+
11+
/** Tooltip for the Avatar */
12+
avatarTooltips: PropTypes.arrayOf(PropTypes.string).isRequired,
13+
};
14+
15+
const SubscriptAvatar = props => (
16+
<View style={styles.emptyAvatar}>
17+
<Tooltip text={props.avatarTooltips[0]} absolute>
18+
<Image
19+
source={{uri: props.avatarImageURLs[0]}}
20+
style={styles.avatarNormal}
21+
/>
22+
</Tooltip>
23+
<View
24+
style={[
25+
styles.secondAvatarSubscript,
26+
styles.secondAvatarHovered,
27+
]}
28+
>
29+
<Tooltip text={props.avatarTooltips[1]} absolute>
30+
<Image
31+
source={{uri: props.avatarImageURLs[1]}}
32+
style={styles.singleSubscript}
33+
/>
34+
</Tooltip>
35+
</View>
36+
</View>
37+
);
38+
39+
SubscriptAvatar.propTypes = propTypes;
40+
export default memo(SubscriptAvatar);

0 commit comments

Comments
 (0)