Skip to content

Instantly share code, notes, and snippets.

@ihorkatkov
Created September 19, 2018 08:52
Show Gist options
  • Save ihorkatkov/a545b56c5c0df2bca67d91bab4257a6e to your computer and use it in GitHub Desktop.
Save ihorkatkov/a545b56c5c0df2bca67d91bab4257a6e to your computer and use it in GitHub Desktop.
Small react component example
// @flow
import React from 'react'
import moment from 'moment'
import capitalize from '@/utils/capitalize'
import type { Event } from '@/modules/types/event'
type Props = {
event: Event,
}
const RecentEvent = ({ event }: Props) => (
<a href={`/dashboard/deals/${event.relationId}`} data-cy="recentEvent">
<div className="dashboard-card">
<div className="card-text">
<h4>{capitalize(event.eventType)}</h4>
<div>
<p className="events-description">{event.summary}</p>
</div>
</div>
<span className="hours-ago">{moment(event.insertedAt).fromNow()}</span>
</div>
</a>
)
export default RecentEvent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment