randomize order of recipes based on day
This commit is contained in:
@ -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>
|
||||
|
Reference in New Issue
Block a user