import * as React from "react" import intl from "react-intl-universal" import { FeedProps } from "./feed" import { PrimaryButton, FocusZone, FocusZoneDirection, List } from 'office-ui-fabric-react'; import { RSSItem } from "../../scripts/models/item"; import { AnimationClassNames } from "@fluentui/react"; import { ViewType } from "../../schema-types"; import ListCard from "../cards/list-card"; import MagazineCard from "../cards/magazine-card"; import CompactCard from "../cards/compact-card"; class ListFeed extends React.Component { onRenderItem = (item: RSSItem) => { const props = { feedId: this.props.feed._id, key: item._id, item: item, source: this.props.sourceMap[item.source], filter: this.props.filter, shortcuts: this.props.shortcuts, markRead: this.props.markRead, contextMenu: this.props.contextMenu, showItem: this.props.showItem, } switch (this.props.viewType) { case (ViewType.Magazine): return case (ViewType.Compact): return default: return } } getClassName = () => { switch (this.props.viewType) { case (ViewType.Magazine): return "magazine-feed" case (ViewType.Compact): return "compact-feed" default: return "list-feed" } } canFocusChild = (el: HTMLElement) => { if (el.id === "load-more") { const container = document.getElementById("refocus") const result = container.scrollTop > container.scrollHeight - 2 * container.offsetHeight if (!result) container.scrollTop += 100 return result } else { return true } } render() { return this.props.feed.loaded && ( { (this.props.feed.loaded && !this.props.feed.allLoaded) ?
this.props.loadMore(this.props.feed)} />
: null } { this.props.items.length === 0 && (
{intl.get("article.empty")}
)}
) } } export default ListFeed