-
Notifications
You must be signed in to change notification settings - Fork 51
/
GroupTeaser.jsx
75 lines (72 loc) · 1.85 KB
/
GroupTeaser.jsx
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import React from 'react'
import PropTypes from 'prop-types'
import { Link, Icon } from '../../components'
import { getVersionGroupUrl } from '../../utils/UrlHelper'
const statusIcons = {
ACTIVE: '',
READONLY: 'locked',
OBSOLETE: 'trash'
}
/**
* Entry of Version Group search results
*/
const GroupTeaser = ({
details,
name,
...props
}) => {
const status = statusIcons[details.status]
const description = details.description
? (<div className='u-textMuted'>
{details.description}
</div>)
: (<div className='u-textMuted'>
<em>Group : {details.id}</em>
</div>)
const metaData = details.owner ? (
<div className='metaInfo'>
<Icon name='user' className='n1 iconUser-muted' />
<Link to={details.owner}>{details.owner}</Link>
<Icon name='users' className='iconUsers-muted n1' />
</div>
) : undefined
const link = getVersionGroupUrl(details.id)
const className = status !== statusIcons.ACTIVE
? 'text-muted-bold'
: 'text-bold'
return (
<div className='teaserView' name={name}>
{/* <View className='Mend(rh)'>
TODO: Statistics Donut here
</View> */}
<div className='teaser-inner'>
<div>
<Link link={link} useHref className={className}>
{status !== statusIcons.ACTIVE &&
(<Icon name={statusIcons[details.status]} className='s1 iconsStatus'
/>)}
{details.title}
</Link>
{description}
</div>
{metaData}
</div>
</div>
)
}
GroupTeaser.propTypes = {
/**
* Entry of the search results.
*/
details: PropTypes.shape({
id: PropTypes.string,
status: PropTypes.string,
description: PropTypes.string,
title: PropTypes.string
}),
/**
* Name for the component
*/
name: PropTypes.string
}
export default GroupTeaser