show video previews on tag click

This commit is contained in:
2020-06-07 22:17:55 +02:00
parent 836f5f342a
commit ed0df26a79
3 changed files with 24 additions and 10 deletions

View File

@ -6,13 +6,14 @@ import "../css/CategoryPage.css"
import {TagPreview} from "../elements/Preview";
class CategoryPage extends React.Component {
constructor(props: P, context: any) {
constructor(props, context) {
super(props, context);
this.props = props;
this.state = {
loadedtags: []
loadedtags: [],
selected: false
};
}
@ -39,14 +40,17 @@ class CategoryPage extends React.Component {
<button className='btn btn-success'>Add a new Tag!</button>
</SideBar>
<div id='categorycontent'>
{this.state.loadedtags ?
{!this.state.selected ?
(this.state.loadedtags ?
this.state.loadedtags.map((m) => (
<TagPreview
name={m.tag_name}
tag_id={m.tag_id}
viewbinding={this.props.viewbinding}/>
viewbinding={this.props.viewbinding}
categorybinding={this.setPage}/>
)) :
"loading"
"loading") :
this.selectionelements
}
</div>
@ -54,6 +58,12 @@ class CategoryPage extends React.Component {
);
}
setPage = (element) => {
this.selectionelements = element;
this.setState({selected: true});
};
/**
* load all available tags from db.
*/
@ -73,4 +83,4 @@ class CategoryPage extends React.Component {
}
}
export default CategoryPage;
export default CategoryPage;