randomize order of recipes based on day

This commit is contained in:
2023-07-10 13:00:11 +02:00
parent 51289117cf
commit 71d5dd14df
10 changed files with 41 additions and 77 deletions

View File

@ -7,6 +7,7 @@
export let data: PageData;
export let current_month = new Date().getMonth() + 1
const all_categories = [ ...new Set (data.all_brief.map(item => item.category))];
import { rand_array } from '$lib/js/randomize';
</script>
<style>
h1{
@ -20,7 +21,7 @@ h1{
<h1>Rezepte</h1>
<section>
<MediaScroller title="In Saison:">
{#each data.season as recipe}
{#each rand_array(data.season) as recipe}
<Card {recipe} {current_month} search=""></Card>
{/each}
</MediaScroller>
@ -29,7 +30,7 @@ h1{
{#each all_categories as category}
<MediaScroller title={category}>
{#each data.all_brief.filter(recipe => recipe.category == category) as recipe}
{#each rand_array(data.all_brief.filter(recipe => recipe.category == category)) as recipe}
<Card {recipe} {current_month}></Card>
{/each}
</MediaScroller>