-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'create-abstract-table-display' into create-abstract-gal…
…lery-display
- Loading branch information
Showing
5 changed files
with
136 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<script context="module"> | ||
// this will go into the backend at the end? | ||
export function splitDataIntoPages(datasize, pagesize) { | ||
let start = 0; | ||
let stop = pagesize; | ||
let indices = []; | ||
while (stop < datasize - pagesize) { | ||
stop = start + pagesize; | ||
indices.push([start, stop]); | ||
start = stop; | ||
} | ||
// add last element | ||
indices.push([start, datasize]); | ||
return indices; | ||
} | ||
</script> | ||
|
||
<script> | ||
import CardDisplay from '$lib/components/DataDisplay/CardDisplay.svelte'; | ||
import { Gallery } from 'flowbite-svelte'; | ||
export let data; | ||
export let n = 3; | ||
export let m = 2; | ||
export let header = 'Currently monitored children'; | ||
let pageindices = splitDataIntoPages(Object.keys(data).length, n * m); | ||
</script> | ||
|
||
<h1 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">{header}</h1> | ||
<Gallery class="grid-cols-2 gap-4 md:grid-cols-3"> | ||
{#each data.slice(pageindices[0][0], pageindices[0][1]) as item} | ||
<CardDisplay | ||
header={item.name} | ||
link={item.link} | ||
image="/children.png" | ||
button={'Current surveys'} | ||
/> | ||
{/each} | ||
</Gallery> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<script> | ||
import AbstractContent from '$lib/components/AbstractContent.svelte'; | ||
import GalleryDisplay from '$lib/components/DataDisplay/GalleryDisplay.svelte'; | ||
const data = [ | ||
{ | ||
name: 'A', | ||
age: 2, | ||
surveys: { | ||
name: 'making a mess', | ||
status: 'good' | ||
}, | ||
tag: 'cohort1', | ||
image: '/lib/assets/children.png' | ||
}, | ||
{ | ||
name: 'B', | ||
age: 2, | ||
surveys: { | ||
name: 'making a mess', | ||
status: 'good' | ||
}, | ||
tag: 'cohort1', | ||
image: '/lib/assets/children.png' | ||
}, | ||
{ | ||
name: 'C', | ||
age: 4, | ||
surveys: { | ||
name: 'making a mess', | ||
status: 'good' | ||
}, | ||
tag: 'cohort2', | ||
image: '/lib/assets/children.png' | ||
}, | ||
{ | ||
name: 'D', | ||
age: 1, | ||
surveys: { | ||
name: 'making a mess', | ||
status: 'good' | ||
}, | ||
tag: 'cohort1', | ||
image: '/lib/assets/children.png' | ||
}, | ||
{ | ||
name: 'E', | ||
age: 2, | ||
surveys: { | ||
name: 'making a mess', | ||
status: 'good' | ||
}, | ||
tag: 'cohort1', | ||
image: '/lib/assets/children.png' | ||
}, | ||
{ | ||
name: 'F', | ||
age: 4, | ||
surveys: { | ||
name: 'making a mess', | ||
status: 'good' | ||
}, | ||
tag: 'cohort2', | ||
image: '/lib/assets/children.png' | ||
} | ||
]; | ||
</script> | ||
|
||
<AbstractContent | ||
showBottomNavbar={false} | ||
lastpage={'/'} | ||
nextpage={'/firstdropdown'} | ||
infopage="/info" | ||
> | ||
<GalleryDisplay {data} /> | ||
</AbstractContent> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.