Skip to content

Commit

Permalink
Merge branch 'main' into add-stores-for-data
Browse files Browse the repository at this point in the history
  • Loading branch information
MaHaWo committed Aug 27, 2024
2 parents d903627 + 58f1af7 commit 1c3a035
Show file tree
Hide file tree
Showing 27 changed files with 811 additions and 151 deletions.
57 changes: 32 additions & 25 deletions src/lib/components/AbstractContent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,49 @@
// variables for communication upon hitting the page
// FIXME: these are placeholders and must later be changed using contexts or other better mechanisms for inter component comunication
export let lastpage = '/';
export let nextpage = '/';
export let infopage = '/';
export let lastpage = null;
export let nextpage = null;
export let infopage = null;
</script>

<!-- Top element: basic navigation-->

<!--Page content goes here-->
<div class="mx-auto max-w-6xl flex-1 overflow-x-auto overflow-y-auto p-4 pb-20">
<div
class="container mx-auto max-w-6xl flex-1 items-center justify-center overflow-x-auto overflow-y-auto p-4 pb-20"
>
<slot></slot>
</div>

{#if showBottomNavbar}
<BottomNav
class="fixed bottom-0 left-0 right-0 border-t border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800"
class="fixed bottom-0 left-0 right-0 justify-center border-t border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800"
classInner="grid-cols-3"
>
<BottomNavElement
href={lastpage}
description={'Zurück'}
Icon={CaretLeftSolid}
tooltip={'Zur letzten Seite'}
/>

<BottomNavElement
href={infopage}
description={'Hilfe'}
Icon={LightbulbSolid}
tooltip={'Zusätzliche Informationen'}
/>

<BottomNavElement
href={nextpage}
description={'Weiter'}
Icon={CaretRightSolid}
tooltip={'Zur nächsten Seite'}
/>
{#if lastpage}
<BottomNavElement
href={lastpage}
description={'Zurück'}
Icon={CaretLeftSolid}
tooltip={'Zur letzten Seite'}
/>
{/if}

{#if infopage}
<BottomNavElement
href={infopage}
description={'Hilfe'}
Icon={LightbulbSolid}
tooltip={'Zusätzliche Informationen'}
/>
{/if}
{#if nextpage}
<BottomNavElement
href={nextpage}
description={'Weiter'}
Icon={CaretRightSolid}
tooltip={'Zur nächsten Seite'}
/>
{/if}
</BottomNav>
{/if}
117 changes: 117 additions & 0 deletions src/lib/components/ChildrenRegistration.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<script>
import AbstractDropdownItem from '$lib/components/DataInput/AbstractDropdownItem.svelte';
import AbstractRegistrationForm from '$lib/components/DataInput/AbstractRegistrationForm.svelte';
import { Input, Textarea } from 'flowbite-svelte';
const data = [
{
itemComponent: Input,
componentProps: {
type: 'text',
name: 'name',
label: 'Name',
value: '',
required: true
}
},
{
itemComponent: Input,
componentProps: {
type: 'date',
name: 'dateofbirth',
label: 'Geburtsdatum',
value: '',
required: true
}
},
{
itemComponent: AbstractDropdownItem,
componentProps: {
name: 'Bitte auswählen',
items: ['Ja', 'Nein'],
label: 'Frühgeburt',
value: '',
required: true
}
},
{
itemComponent: AbstractDropdownItem,
componentProps: {
name: 'Bitte auswählen',
items: ['Männlich', 'Weiblich'],
label: 'Geschlecht',
value: '',
required: true
}
},
{
itemComponent: AbstractDropdownItem,
componentProps: {
name: 'Bitte auswählen',
items: ['De', 'US', 'Fr', 'IT', 'Es'],
label: 'Nationalität',
value: '',
required: true
}
},
{
itemComponent: AbstractDropdownItem,
componentProps: {
name: 'Bitte auswählen',
items: ['Deutsch', 'Englisch (UK)', 'Englisch (Us)', 'Mandarin', 'Arabisch'],
label: 'Bitte geben sie die erste Sprache an die das Kind gelernt hat',
value: '',
required: true
}
},
{
itemComponent: AbstractDropdownItem,
componentProps: {
name: 'Bitte auswählen',
items: [
'Kind',
'Enkelkind',
'Neffe/Nichte',
'Pflegekind',
'Adoptivkind',
'Betreuung extern',
'Betreuung zu Hause'
],
value: '',
label: 'Verhältnis des Kindes zu ihnen',
required: true
}
},
{
itemComponent: AbstractDropdownItem,
componentProps: {
name: 'Bitte auswählen',
items: ['Hörprobleme', 'Fehlsichtigkeit', 'Sprachfehler'],
value: '',
label: 'Entwicklungsauffälligkeiten',
required: true
}
},
{
itemComponent: Textarea,
componentProps: {
name: 'Bitte eintragen',
label: 'Sonstige Anmerkungen',
rows: 5,
value: '',
required: true
}
}
];
const heading = 'Neues Kind registrieren';
const buttons = [
{
label: 'Weiter',
href: '/'
}
];
</script>

<div class="container m-1 mx-auto w-full max-w-md">
<AbstractRegistrationForm {heading} props={data} {buttons} />
</div>
112 changes: 112 additions & 0 deletions src/lib/components/Childrenpage.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<script context="module">
export function convertData(rawdata) {
let data = rawdata.map((item) => {
return {
header: item.name,
summary: item.info,
image: item.image,
href: item.href ? item.href : '/'
};
});
// put in new element at the front which adds new child
data.unshift({
header: 'Neu',
summary: 'Ein neues Kind anmelden',
href: '/childLand/childDataInput'
});
return data;
}
// dynamically create the styles for individual gallery tiles based on the data.
// The 'Neu' element needs to be styled differently in particular
export function createStyle(data) {
return data.map((item) => ({
card:
item.header === 'Neu'
? {
class:
'm-2 max-w-prose bg-primary-700 dark:bg-primary-600 hover:bg-primary-800 dark:hover:bg-primary-700',
horizontal: false
}
: { horizontal: item.image ? true : false },
header:
item.header == 'Neu'
? {
class: 'mb-2 text-2xl font-bold tracking-tight text-white dark:text-white'
}
: null,
summary:
item.header == 'Neu'
? {
class: 'mb-3 flex font-normal leading-tight text-white dark:text-white'
}
: null,
button: null
}));
}
</script>

<script>
import CardDisplay from '$lib/components/DataDisplay/CardDisplay.svelte';
import GalleryDisplay from '$lib/components/DataDisplay/GalleryDisplay.svelte';
import { Heading } from 'flowbite-svelte';
import AbstractContent from './AbstractContent.svelte';
const rawdata = [
{
name: 'Anna',
info: 'A child that is making a mess and is doing good. Click to view more.',
image: 'child_avatar.png',
href: '/surveyfeedback'
},
{
name: 'Ben',
image: 'children.png',
info: 'A child that is making a mess and is doing good. Click to view more.',
href: '/surveyfeedback'
},
{
name: 'C',
info: 'A child that is making a mess and is doing good. Click to view more.',
href: '/surveyfeedback',
image: 'child_avatar.png'
},
{
name: 'Dora',
image: '/children.png',
info: 'A child that is making a mess and is doing good. Click to view more.',
href: '/surveyfeedback'
},
{
name: 'E',
image: 'children.png',
info: 'A child that is making a mess and is doing good. Click to view more.',
href: '/surveyfeedback'
},
{
name: 'F',
image: 'children.png',
info: 'A child that is making a mess and is doing good. Click to view more.',
href: '/surveyfeedback'
}
];
const data = convertData(rawdata);
</script>

<AbstractContent showNavIcons={false} iconProps={{ class: 'w-10 h-10' }}>
<Heading tag="h1" class="mb-2" color="text-gray-700 dark:text-gray-400">Übersicht</Heading>

<div class="cols-1 grid gap-y-8">
<p class="text-lg text-gray-700 dark:text-gray-400">
Wählen sie ein Kind zur Beobachtung aus oder legen melden sie ein neues Kind an.
</p>
<GalleryDisplay
{data}
itemComponent={CardDisplay}
searchableCol={'header'}
componentProps={createStyle(data)}
/>
</div>
</AbstractContent>
58 changes: 44 additions & 14 deletions src/lib/components/DataDisplay/CardDisplay.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,50 @@
<script>
import { Button, Card } from 'flowbite-svelte';
import { ArrowRightOutline } from 'flowbite-svelte-icons';
export let header = 'header';
export let summary = 'summary';
export let button = 'button';
export let link = '/';
export let data = {
header: undefined,
summary: undefined,
button: undefined,
href: undefined,
image: undefined
};
export let styleProps = {
card: {},
header: {},
summary: {},
button: {}
};
</script>

<Card class="m-4 w-full p-6">
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
{header}
</h5>
<p class="mb-3 font-normal leading-tight text-gray-700 dark:text-gray-400">
{summary}
</p>
<Button href={link} class="w-fit"
>{button} <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button
>
<Card
img={data.image}
imgClass="max-md:hidden object-scale-down"
href={data.button ? null : data.href}
class={data.button
? 'm-2 max-w-prose'
: 'hover:transition-color m-2 max-w-prose cursor-pointer hover:bg-gray-300 dark:hover:bg-gray-600'}
{...styleProps.card}
>
{#if data.header}
<h5
class="mb-2 text-2xl font-bold tracking-tight text-gray-700 dark:text-white"
{...styleProps.header}
>
{data.header}
</h5>
{/if}
{#if data.summary}
<p
class="mb-3 flex font-normal leading-tight text-gray-700 dark:text-gray-400"
{...styleProps.summary}
>
{data.summary}
</p>
{/if}
{#if data.button}
<Button href={data.href} class="w-fit" {...styleProps.button}
>{data.button} <ArrowRightOutline class="ms-2 h-6 w-6 text-white" /></Button
>
{/if}
</Card>
Loading

0 comments on commit 1c3a035

Please sign in to comment.