shrub/pkg/interface/groups/tile/tile.js

59 lines
1.3 KiB
JavaScript
Raw Normal View History

2019-11-19 01:41:08 +03:00
import React, { Component } from 'react';
import classnames from 'classnames';
import _ from 'lodash';
export default class ContactTile extends Component {
render() {
const { props } = this;
2020-03-07 01:53:06 +03:00
let data = _.get(props.data, "invites", false);
let inviteNum = 0;
if (data && "/contacts" in data) {
inviteNum = Object.keys(data["/contacts"]).length;
}
let numNotificationsElem =
inviteNum > 0 ? (
<p
className="absolute green2 white-d"
style={{
bottom: 6,
fontWeight: 400,
fontSize: 12,
lineHeight: "20px"
}}>
{inviteNum > 99 ? "99+" : inviteNum}
</p>
) : (
<div />
);
2019-11-19 01:41:08 +03:00
return (
2020-03-07 01:53:06 +03:00
<div
className={
"w-100 h-100 relative bg-white bg-gray0-d " + "b--black b--gray1-d ba"
}>
<a className="w-100 h-100 db pa2 bn" href="/~groups">
2020-03-07 01:53:06 +03:00
<p className="black white-d absolute f9" style={{ left: 8, top: 8 }}>
Groups
2019-11-19 01:41:08 +03:00
</p>
<img
2020-02-22 05:58:02 +03:00
className="absolute invert-d"
style={{ left: 39, top: 39 }}
src="/~groups/img/Tile.png"
width={48}
height={48}
/>
2020-03-07 01:53:06 +03:00
{numNotificationsElem}
2019-11-19 01:41:08 +03:00
</a>
</div>
);
}
}
window['contact-viewTile'] = ContactTile;