cinema/filters.riot

54 lines
1.9 KiB
Plaintext
Raw Normal View History

2022-04-02 12:00:24 +02:00
<filters>
2022-04-03 01:58:58 +02:00
<div class="buttons-filters">
2022-04-02 12:00:24 +02:00
<button onclick={setFilter} class="w3-button w3-blue w3-round" id="popular">Populaires</button>
<button onclick={setFilter} class="w3-button w3-blue w3-round" id="top_rated">Mieux notés</button>
<button onclick={setFilter} class="w3-button w3-blue w3-round" id="coming_soon">À venir</button>
<button onclick={setFilter} class="w3-button w3-blue w3-round" id="new">À l'affiche</button>
</div>
2022-04-03 01:58:58 +02:00
<ul class="filters">
<li>
<button onclick={toPreviousPage}><</button>
{this.props.currentPageNum}/{this.props.maxPageNum}
<button onclick={toNextPage}>></button>
</li>
</ul>
2022-04-02 12:00:24 +02:00
<script>
export default {
onBeforeMount (props,state) {
console.log(localStorage.getItem('currfilter'));
2022-04-03 01:58:58 +02:00
console.log(props.getMovieList());
2022-04-02 12:00:24 +02:00
},
setFilter(e) {
localStorage.setItem('currfilter', e.target.id);
2022-04-03 01:58:58 +02:00
this.props.updateMovieList();
},
toPreviousPage() {
if (this.props.currentPageNum > 1) {
localStorage.setItem('curr_page', this.props.currentPageNum-1);
this.props.updateMovieList();
}
else {
localStorage.setItem('curr_page', this.props.maxPageNum);
this.props.updateMovieList();
}
},
toNextPage() {
if (this.props.currentPageNum < this.props.maxPageNum) {
localStorage.setItem('curr_page', this.props.currentPageNum+1);
this.props.updateMovieList();
}
else {
localStorage.setItem('curr_page', 1);
this.props.updateMovieList();
}
2022-04-02 12:00:24 +02:00
},
}
</script>
</filters>