react-feather#FileText TypeScript Examples
The following examples show how to use
react-feather#FileText.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SideBar.tsx From bee-dashboard with BSD 3-Clause "New" or "Revised" License | 5 votes |
navBarItems = [
{
label: 'Info',
path: ROUTES.INFO,
icon: Home,
},
{
label: 'Files',
path: ROUTES.UPLOAD,
icon: FileText,
},
{
label: 'Feeds',
path: ROUTES.FEEDS,
icon: Bookmark,
},
{
label: 'Stamps',
path: ROUTES.STAMPS,
icon: Layers,
},
{
label: 'Accounting',
path: ROUTES.ACCOUNTING,
icon: DollarSign,
},
{
label: 'Settings',
path: ROUTES.SETTINGS,
icon: Settings,
},
{
label: 'Account',
path: ROUTES.WALLET,
icon: Briefcase,
},
{
label: 'Gift Wallets',
path: ROUTES.GIFT_CODES,
icon: Gift,
},
]
Example #2
Source File: RelatedPage.tsx From covidex with MIT License | 4 votes |
RelatedPage = () => {
const {
params: { articleId },
} = useRouteMatch<any>();
const [loading, setLoading] = useState<boolean>(false);
const [notFound, setNotFound] = useState<boolean>(false);
const [hasMore, setHasMore] = useState<boolean>(true);
const [page, setPage] = useState<number>(1);
const [queryId, setQueryId] = useState<string>('');
const [originalArticle, setOriginalArticle] = useState<RelatedArticle | null>(null);
const [relatedArticles, setRelatedArticles] = useState<RelatedArticle[] | null>(null);
useEffect(() => {
const fetchData = async () => {
if (articleId === undefined || articleId === null || articleId === '') {
setLoading(false);
setNotFound(true);
setPage(1);
return;
}
try {
setLoading(true);
setRelatedArticles(null);
let response = await fetch(
`${API_BASE}${RELATED_ENDPOINT}/${articleId.toLowerCase()}?page_number=${1}`,
);
setLoading(false);
let data = await response.json();
const { query_id, response: responseArticles } = data;
const originalArticle = responseArticles
? responseArticles.find((a: RelatedArticle) => a.id === articleId)
: null;
setQueryId(query_id);
setOriginalArticle(originalArticle);
setRelatedArticles(responseArticles.filter((a: RelatedArticle) => a.id !== articleId));
setPage(2);
} catch {
setLoading(false);
setNotFound(true);
setPage(2);
}
};
fetchData();
}, [articleId]);
const loadMoreResults = async () => {
let response = await fetch(
`${API_BASE}${RELATED_ENDPOINT}/${articleId.toLowerCase()}?page_number=${page}`,
);
setPage(page + 1);
if (response.status > 400) {
setHasMore(false);
}
let data = await response.json();
const { response: responseArticles } = data;
const currentArticles = relatedArticles || [];
setRelatedArticles([...currentArticles, ...responseArticles]);
};
const TitleRow = (
<Row>
<RelatedTitle>
Related Articles <FileText size={24} style={{ marginLeft: '8px' }} />
</RelatedTitle>
<SearchLink to={HOME_ROUTE}>
<ArrowLeft size={16} style={{ marginRight: '4px' }} />
Search All Articles
</SearchLink>
</Row>
);
return (
<PageWrapper>
<PageContent>
<ErrorBoundary FallbackComponent={NotFoundComponent}>
<RelatedContent>
{loading && <Loading />}
{notFound && (
<>
{TitleRow}
<NotFoundComponent />
</>
)}
{originalArticle && relatedArticles && (
<>
{TitleRow}
<OriginalArticle>
<SmallTitle>Showing articles related to:</SmallTitle>
<ArticleInfo article={originalArticle} boldTitle />
{originalArticle.abstract && (
<>
<AbstractTitle className="hideCollapsed">Abstract</AbstractTitle>
<Paragraph>{parseAbstract(originalArticle.abstract)}</Paragraph>
</>
)}
</OriginalArticle>
<InfiniteScroll
pageStart={page}
loadMore={loadMoreResults}
hasMore={hasMore}
loader={
<Row>
<Loading />
</Row>
}
>
{relatedArticles.map((article, idx) => (
<RelatedResult
key={article.id}
article={article}
position={idx}
queryId={queryId}
/>
))}
</InfiniteScroll>
{relatedArticles.length === 0 && <NotFound>No related articles found</NotFound>}
</>
)}
</RelatedContent>
</ErrorBoundary>
</PageContent>
</PageWrapper>
);
}