Skip to content

Commit

Permalink
Merge branch 'main' into componentize-front-page-better
Browse files Browse the repository at this point in the history
  • Loading branch information
MaHaWo committed Aug 21, 2024
2 parents 85c3296 + fff3a6e commit f36ce20
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 12 deletions.
17 changes: 17 additions & 0 deletions src/lib/components/DataInput/AbstractDataInput.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script>
// @ts-nocheck
/**
* @type {any[]}
*/
// @ts-ignore
export let data;
export let heading;
export let itemComponent; // = AbstractDropdownItem;
</script>

<div class="items-center space-x-4 rtl:space-x-reverse">
<h1 class="mb-2 text-2xl font-bold tracking-tight text-gray-700 dark:text-gray-400">{heading}</h1>
{#each data as data_element}
<svelte:component this={itemComponent} data={data_element} />
{/each}
</div>
21 changes: 21 additions & 0 deletions src/lib/components/DataInput/AbstractDropdownItem.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script>
import { Label, Select, Tooltip } from 'flowbite-svelte';
export let data;
// have the data processing here to coerce the input into the format that the component expects
// @ts-ignore
data.items = data.items.map((item) => ({ name: item, value: item }));
</script>

<div>
<div class="flex items-center space-x-2">
<Label for="select-lg" class="mb-2 text-lg text-gray-700 dark:text-gray-400">{data.name}</Label>
<Tooltip>{data.about}</Tooltip>
</div>
<Select
size="lg"
class="mb-3 font-normal leading-tight text-gray-700 dark:text-gray-400"
items={data.items}
bind:value={data.selected}
/>
</div>
39 changes: 29 additions & 10 deletions src/lib/components/Frontpage.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script>
import { Button, Card, Gallery } from 'flowbite-svelte';
import { ArrowRightOutline } from 'flowbite-svelte-icons';
export let getStarted = '/';
console.log('get started: ', getStarted);
</script>

<!-- This is a dummy landing page that is only there to check that the AbstractComponent works as it should-->
Expand All @@ -13,7 +15,9 @@
<i>Mondey</i> ist ein wissentschaftlich geprüftes Programm zure Dokumentation der Entwicklung von
Kindern bis 6 Jahren.
</p>
<Button class="w-fit">Mehr Info <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button>
<Button href="/info" class="w-fit"
>Mehr Info <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button
>
</Card>

<Card class="m-4 w-full p-6">
Expand All @@ -25,7 +29,9 @@
Entwicklungsstand des Kindes und können so frühzeitig Fördermaßnahmen einleiten. Dies folgt
einem übersichtlichen Ampelsystem.
</p>
<Button class="w-fit">Mehr Info <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button>
<Button href="/info" class="w-fit"
>Mehr Info <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button
>
</Card>

<Card class="m-4 w-full p-6">
Expand All @@ -37,9 +43,10 @@
6 Jahren. Dazu gehören unter anderem Grob-und feinmotorik, Wahrnehmung, Denkne, Sprache und Soziale
Beziehungen.
</p>
<Button class="w-fit">Mehr Info <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button>
<Button href="/info" class="w-fit"
>Mehr Info <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button
>
</Card>

<Card class="m-4 w-full p-6">
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
Wie funktioniert Mondey?
Expand All @@ -48,7 +55,9 @@
Sie bewerten wie gut das Kind bestimmte Alltagshandlungen durchführen kann mit Hilfe einer
Liste von Fragen.
</p>
<Button class="w-fit">Mehr Info <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button>
<Button href="/info" class="w-fit"
>Mehr Info <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button
>
</Card>

<Card class="m-4 w-full p-6">
Expand All @@ -58,7 +67,9 @@
<p class="mb-3 font-normal leading-tight text-gray-700 dark:text-gray-400">
Um zu beginnen, müssen sie sich registrieren und ein Profil für ihr Kind anlegen.
</p>
<Button class="w-fit">Los geht's <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button>
<Button class="w-fit" href={getStarted}
>Los geht's <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button
>
</Card>

<Card class="m-4 w-full p-6">
Expand All @@ -69,7 +80,9 @@
facilis! Voluptas corrupti recusandae sapiente doloribus voluptatem fugiat ducimus.
</i>
</p>
<Button class="w-fit">dummy <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button>
<Button href="/info" class="w-fit"
>dummy <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button
>
</Card>

<Card class="m-4 w-full p-6">
Expand All @@ -80,7 +93,9 @@
facilis! Voluptas corrupti recusandae sapiente doloribus voluptatem fugiat ducimus.
</i>
</p>
<Button class="w-fit">dummy <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button>
<Button href="/info" class="w-fit"
>dummy <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button
>
</Card>

<Card class="m-4 w-full p-6">
Expand All @@ -91,7 +106,9 @@
facilis! Voluptas corrupti recusandae sapiente doloribus voluptatem fugiat ducimus.
</i>
</p>
<Button class="w-fit">dummy <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button>
<Button href="/info" class="w-fit"
>dummy <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button
>
</Card>

<Card class="m-4 w-full p-6">
Expand All @@ -102,6 +119,8 @@
facilis! Voluptas corrupti recusandae sapiente doloribus voluptatem fugiat ducimus.
</i>
</p>
<Button class="w-fit">dummy <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button>
<Button href="/info" class="w-fit"
>dummy <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button
>
</Card>
</Gallery>
4 changes: 2 additions & 2 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import Frontpage from '$lib/components/Frontpage.svelte';
</script>

<AbstractContent showBottomNavbar={true}>
<Frontpage />
<AbstractContent showBottomNavbar={false}>
<Frontpage getStarted={'/firstdropdown'} />
</AbstractContent>
5 changes: 5 additions & 0 deletions src/routes/firstdropdown/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import '../../app.css';
</script>

<slot></slot>
1 change: 1 addition & 0 deletions src/routes/firstdropdown/+layout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const prerender = true;
36 changes: 36 additions & 0 deletions src/routes/firstdropdown/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<script>
import AbstractContent from '$lib/components/AbstractContent.svelte';
import AbstractDataInput from '$lib/components/DataInput/AbstractDataInput.svelte';
import AbstractDropdownItem from '$lib/components/DataInput/AbstractDropdownItem.svelte';
const letteroptions = ['a', 'b', 'c', 'd'];
const defaultOptions = ['gar nicht', 'ansatzweise', 'weitgehend', 'zuverlässig'];
const data_to_display = [
{
name: 'standing up',
items: letteroptions,
about:
'How well can the child stand up from sitting or crawling around and how readily is it able to do so',
selected: false
},
{
name: 'gripping a pen the right way',
items: defaultOptions,
about: 'How well can the child hold a pen or pencil and how coordinated can it use it',
selected: false
},
{
name: 'talking in full sentences',
items: letteroptions,
about: 'How well articulated is the child in its speech and how well can it express itself',
selected: false
}
];
const heading = 'some initial dummy dropdown page';
</script>

<AbstractContent showBottomNavbar={true} lastPage="/" nextPage="/nextdropdown" infoPage="/info">
<AbstractDataInput data={data_to_display} {heading} itemComponent={AbstractDropdownItem} />
</AbstractContent>
5 changes: 5 additions & 0 deletions src/routes/info/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import '../../app.css';
</script>

<slot></slot>
1 change: 1 addition & 0 deletions src/routes/info/+layout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const prerender = true;
7 changes: 7 additions & 0 deletions src/routes/info/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script>
import AbstractContent from '$lib/components/AbstractContent.svelte';
</script>

<AbstractContent showBottomNavbar={true} lastPage="/" nextPage="/" infoPage="/info">
<h1>Info page</h1>
</AbstractContent>
5 changes: 5 additions & 0 deletions src/routes/nextdropdown/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import '../../app.css';
</script>

<slot></slot>
1 change: 1 addition & 0 deletions src/routes/nextdropdown/+layout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const prerender = true;
42 changes: 42 additions & 0 deletions src/routes/nextdropdown/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<script>
import AbstractContent from '$lib/components/AbstractContent.svelte';
import AbstractDataInput from '$lib/components/DataInput/AbstractDataInput.svelte';
import AbstractDropdownItem from '$lib/components/DataInput/AbstractDropdownItem.svelte';
const defaultOptions = ['gar nicht', 'ansatzweise', 'weitgehend', 'zuverlässig'];
const dropdownData = [
{
name: 'standing up',
items: defaultOptions,
about:
'How well can the child stand up from sitting or crawling around and how readily is it able to do so',
selected: false
},
{
name: 'making a mess',
items: defaultOptions,
about:
'This describes how efficiently the child can distribute toys in every single corner of every single room in the house',
selected: false
},
{
name: 'gripping a pen the right way',
items: defaultOptions,
about: 'How well can the child hold a pen or pencil and how coordinated can it use it',
selected: false
},
{
name: 'talking in full sentences',
items: defaultOptions,
about: 'How well articulated is the child in its speech and how well can it express itself',
selected: false
}
];
const heading = 'the second data selection page';
</script>

<AbstractContent showBottomNavbar={true} lastPage="/firstdropdown" nextPage="/" infoPage="/info">
<AbstractDataInput data={dropdownData} {heading} itemComponent={AbstractDropdownItem} />
</AbstractContent>

0 comments on commit f36ce20

Please sign in to comment.