forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
55 lines (50 loc) · 1.2 KB
/
index.tsx
File metadata and controls
55 lines (50 loc) · 1.2 KB
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
49
50
51
52
53
54
55
import React from 'react';
import EyeIcon from 'react-icons/lib/fa/eye';
import ForkIcon from 'react-icons/lib/go/repo-forked';
import LikeHeart from 'react-icons/lib/go/heart';
import Stat from './Stat';
import { Stats } from './elements';
type StatsComponentProps = {
viewCount: number;
likeCount: number;
forkCount: number;
vertical?: boolean;
text?: boolean;
style?: React.CSSProperties;
};
function StatsComponent({
viewCount,
likeCount,
forkCount,
vertical = false,
text = false,
style,
...props
}: StatsComponentProps) {
return (
<Stats vertical={vertical} {...props}>
<Stat
text={text ? 'views' : undefined}
textOne={text ? 'view' : undefined}
vertical={vertical}
Icon={<EyeIcon />}
count={viewCount}
/>
<Stat
text={text ? 'likes' : undefined}
textOne={text ? 'like' : undefined}
vertical={vertical}
Icon={<LikeHeart />}
count={likeCount}
/>
<Stat
text={text ? 'forks' : undefined}
textOne={text ? 'fork' : undefined}
vertical={vertical}
Icon={<ForkIcon />}
count={forkCount}
/>
</Stats>
);
}
export default StatsComponent;