2019-09-05 19:26:37 +00:00
|
|
|
import React from "react";
|
2020-01-22 19:44:51 +00:00
|
|
|
import { observe } from "@embarklabs/subspace/react";
|
2019-09-05 19:26:37 +00:00
|
|
|
|
|
|
|
const RankItem = ({ items, onUpvote, onDownvote }) => {
|
|
|
|
if (!items) return null;
|
|
|
|
|
|
|
|
return items.map((item, i) => (
|
|
|
|
<div key={i} className="item">
|
|
|
|
<b>{i + 1}</b> - {item.addr}
|
|
|
|
<br />
|
|
|
|
Upvotes: {item.upvotes} - Downvotes: {item.downvotes}
|
|
|
|
<br />
|
|
|
|
<button onClick={onUpvote(item.addr)}>Upvote</button> |{" "}
|
|
|
|
<button onClick={onDownvote(item.addr)}>Downvote</button>
|
|
|
|
</div>
|
|
|
|
));
|
|
|
|
};
|
|
|
|
|
|
|
|
export default observe(RankItem);
|