aboutsummaryrefslogtreecommitdiff
path: root/src/components/comments/CommentsCount.tsx
blob: 905141932d7a6ec6a8d061da8d42622e2883c9d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import {useNavigation} from '@react-navigation/core';
import React from 'react';
import {StyleSheet, Text} from 'react-native';
import {TouchableOpacity} from 'react-native-gesture-handler';
import CommentsIcon from '../../assets/icons/moment-comment-icon.svg';
import {MomentPostType, ScreenType} from '../../types';
import {normalize} from '../../utils';

interface CommentsCountProps {
  moment: MomentPostType;
  screenType: ScreenType;
}

const CommentsCount: React.FC<CommentsCountProps> = ({moment, screenType}) => {
  const navigation = useNavigation();
  return (
    <TouchableOpacity
      style={styles.countContainer}
      onPress={() =>
        navigation.navigate('MomentCommentsScreen', {
          moment_id: moment.moment_id,
          screenType,
        })
      }>
      <CommentsIcon width={25} height={25} />
      <Text style={styles.count}>{moment.comments_count}</Text>
    </TouchableOpacity>
  );
};

const styles = StyleSheet.create({
  countContainer: {
    minWidth: 50,
    flexDirection: 'column',
    justifyContent: 'center',
    alignItems: 'center',
  },
  count: {
    fontWeight: '500',
    fontSize: normalize(11),
    lineHeight: normalize(13),
    letterSpacing: normalize(0.05),
    textAlign: 'center',
    color: 'white',
    marginTop: normalize(5),
  },
});
export default CommentsCount;