11import React from 'react' ;
2+ import { Text } from '../Text' ;
3+ import { Stack } from '../Stack' ;
4+ import { Icon } from '../Icon' ;
25
36export const HeartIcon = props => (
47 < svg width = { 16 } height = { 16 } fill = "none" viewBox = "0 0 16 16" { ...props } >
@@ -37,3 +40,38 @@ export const formatNumber = (count: number): string | number => {
3740
3841 return count ;
3942} ;
43+
44+ export const Stats = ( { sandbox, ...props } ) => (
45+ < Stack gap = { 4 } { ...props } >
46+ { typeof sandbox . likeCount !== 'undefined' && (
47+ < Stack gap = { 2 } align = "center" >
48+ < Text variant = "muted" style = { { display : 'flex' , alignItems : 'center' } } >
49+ < Icon name = "heart" size = { 13 } />
50+ </ Text >
51+ < Text size = { 3 } variant = "muted" >
52+ { formatNumber ( sandbox . likeCount ) }
53+ </ Text >
54+ </ Stack >
55+ ) }
56+ { typeof sandbox . viewCount !== 'undefined' && (
57+ < Stack gap = { 2 } align = "center" >
58+ < Text variant = "muted" style = { { display : 'flex' , alignItems : 'center' } } >
59+ < Icon name = "eye" size = { 16 } />
60+ </ Text >
61+ < Text size = { 3 } variant = "muted" >
62+ { formatNumber ( sandbox . viewCount ) }
63+ </ Text >
64+ </ Stack >
65+ ) }
66+ { typeof sandbox . forkCount !== 'undefined' && (
67+ < Stack gap = { 2 } align = "center" >
68+ < Text variant = "muted" style = { { display : 'flex' , alignItems : 'center' } } >
69+ < Icon name = "forkFilled" size = { 14 } />
70+ </ Text >
71+ < Text size = { 3 } variant = "muted" >
72+ { formatNumber ( sandbox . forkCount ) }
73+ </ Text >
74+ </ Stack >
75+ ) }
76+ </ Stack >
77+ ) ;
0 commit comments