Created
December 31, 2017 13:55
-
-
Save Hajto/d30fc82b73853d6af9ec9ac93e899e11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { Segment, Header, Comment } from 'semantic-ui-react'; | |
import _ from 'lodash/fp' | |
const ownerDetails = (owner) => (owner.details.name + " " + owner.details.surname) | |
const capitalize = (role) => role.substr(0, 1).toUpperCase() + role.substr(1) | |
const commentsView = (comments) => ( | |
<Comment.Group> | |
{ | |
_.map((comment) => ( | |
<Comment key={comment.id}> | |
<Comment.Content> | |
<Comment.Author as='a'>{ ownerDetails(comment.user) }</Comment.Author> | |
<Comment.Metadata> | |
, { capitalize(comment.user.role) } | |
</Comment.Metadata> | |
<Comment.Text>{ comment.text }</Comment.Text> | |
</Comment.Content> | |
</Comment> | |
), comments) | |
} | |
</Comment.Group> | |
) | |
export const Order = ({order}) => ( | |
<div> | |
<Segment> | |
<Header as="h3"> Owner </Header> | |
<p> {ownerDetails(order.distributor)} </p> | |
<Header as="h3"> Price </Header> | |
<p> {order.price} </p> | |
</Segment> | |
<Segment> | |
{ commentsView(order.messages) } | |
</Segment> | |
</div> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment