40 lines
1.7 KiB
TypeScript
Raw Normal View History

2020-06-08 16:54:53 +08:00
import * as React from "react"
2020-06-11 21:24:18 +08:00
import intl = require("react-intl-universal")
2020-06-08 16:54:53 +08:00
import { FeedProps } from "./feed"
2020-06-19 21:51:04 +08:00
import { DefaultButton, FocusZone, FocusZoneDirection } from 'office-ui-fabric-react';
2020-06-08 16:54:53 +08:00
import ListCard from "../cards/list-card";
class ListFeed extends React.Component<FeedProps> {
render() {
return this.props.feed.loaded && (
2020-06-19 21:51:04 +08:00
<FocusZone as="div" id="refocus" direction={FocusZoneDirection.vertical} className="list-feed">
2020-06-08 16:54:53 +08:00
{
this.props.items.map((item) => (
<ListCard
2020-06-10 11:33:25 +08:00
feedId={this.props.feed._id}
key={item._id}
2020-06-08 16:54:53 +08:00
item={item}
source={this.props.sourceMap[item.source]}
2020-06-20 15:09:26 +08:00
shortcuts={this.props.shortcuts}
2020-06-08 16:54:53 +08:00
markRead={this.props.markRead}
contextMenu={this.props.contextMenu}
showItem={this.props.showItem} />
))
}
{
(this.props.feed.loaded && !this.props.feed.allLoaded)
2020-06-09 14:03:38 +08:00
? <div className="load-more-wrapper"><DefaultButton
2020-06-11 21:24:18 +08:00
text={intl.get("loadMore")}
2020-06-08 16:54:53 +08:00
disabled={this.props.feed.loading}
onClick={() => this.props.loadMore(this.props.feed)} /></div>
: null
}
2020-06-15 14:16:49 +08:00
{ this.props.items.length === 0 && (
<div className="empty">{intl.get("article.empty")}</div>
)}
2020-06-19 21:51:04 +08:00
</FocusZone>
2020-06-08 16:54:53 +08:00
)
}
}
export default ListFeed