abstract dynamic video tile load within new dynamicloader class to allow to load other elements dynamically.

This commit is contained in:
2021-04-16 18:20:39 +02:00
parent dfd92b1730
commit 57a7a9a827
7 changed files with 144 additions and 111 deletions

View File

@ -1,6 +1,5 @@
import {TagType} from '../../types/VideoTypes';
import React from 'react';
import videocontainerstyle from '../../elements/VideoContainer/VideoContainer.module.css';
import {Link} from 'react-router-dom';
import {TagPreview} from '../../elements/Preview/Preview';
import {APINode, callAPI} from '../../utils/Api';
@ -9,6 +8,7 @@ import SideBar, {SideBarTitle} from '../../elements/SideBar/SideBar';
import Tag from '../../elements/Tag/Tag';
import {DefaultTags} from '../../types/GeneralTypes';
import NewTagPopup from '../../elements/Popups/NewTagPopup/NewTagPopup';
import DynamicContentContainer from '../../elements/DynamicContentContainer/DynamicContentContainer';
interface TagViewState {
loadedtags: TagType[];
@ -53,15 +53,19 @@ class TagView extends React.Component<Props, TagViewState> {
Add a new Tag!
</button>
</SideBar>
<div className={videocontainerstyle.maincontent}>
{this.state.loadedtags
? this.state.loadedtags.map((m) => (
<Link to={'/categories/' + m.TagId} key={m.TagId}>
<TagPreview name={m.TagName} />
</Link>
))
: 'loading'}
</div>
{this.state.loadedtags.length !== 0 ? (
<DynamicContentContainer
data={this.state.loadedtags}
renderElement={(m): JSX.Element => (
<Link to={'/categories/' + m.TagId} key={m.TagId}>
<TagPreview name={m.TagName} />
</Link>
)}
initialLoadNr={20}
/>
) : (
'loading'
)}
{this.handlePopups()}
</>
);