Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the card gallery to one card on the main page #145

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added frontend/src/lib/assets/baby-flower.png
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this png file is huge! try converting it to a jpg :-) also I don't see it being used anywhere?

Copy link
Collaborator

@MaHaWo MaHaWo Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

second what @lkeegan said. Do we need it at all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! I've added it for use in the next element. I'll compress it and add it again later

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 5 additions & 7 deletions frontend/src/lib/components/DataDisplay/CardDisplay.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,34 @@ export let styleProps = {
imgClass="max-md:hidden object-scale-down"
href={data.button ? null : data.href}
class={data.button
? 'm-2 max-w-prose items-center text-gray-700 dark:text-white'
? 'm-2 max-w-prose min-w-full items-center bg-[#a4d2d0] text-gray-700 dark:text-white'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the CardDisplay and GalleryDisplay components are used in multiple places, not just on the front page (@MaHaWo?).
It might make more sense for you to directly use a single <Card> element on the frontpage which you can customize however you like, rather than modifying these components?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, they are indeed, I would also suggest to use Card directly if you need only one of them. also, I would suggest using colors that are defined centrally in tailwind-config.ts, because a unified style will depend on the color hexcode being copied everywhere we need it, which is brittle

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your help and suggestions! I'll use the Card element in those cases and add other colors to tailwind-config.ts

: 'hover:transition-color m-2 max-w-prose cursor-pointer items-center text-gray-700 hover:bg-gray-300 dark:text-white dark:hover:bg-gray-600 '}
{...styleProps.card}
on:click={data.events['onclick']}
>
{#if data.header}
<h5 class="mb-2 text-2xl font-bold tracking-tight" {...styleProps.header}>
<h5 class="mb-2 mt-4 text-2xl font-bold text-center tracking-wide" {...styleProps.header}>
{data.header}
</h5>
{/if}
{#if data.summary}
<p class=" mb-3 flex font-normal leading-tight" {...styleProps.summary}>
<p class=" mb-3 flex font-normal font-center leading-tight" {...styleProps.summary}>
{data.summary}
</p>
{/if}
{#if data.button}
<Button
href={data.href}
class="w-fit"
class="w-44 mb-3 mt-4 font-bold text-md hover:text-white dark:text-white bg-white text-gray-700"
{...styleProps.button}
on:click={data.button.events.onclick}
>{data.button}

{#if data.buttonIcon}
<svelte:component this={data.buttonIcon} class="ms-2 h-6 w-6 text-white" />
{:else}
<ArrowRightOutline class="ms-2 h-6 w-6 text-white" />
{/if}
</Button>
<Tooltip>Fortfahren</Tooltip>
<Tooltip>Anmelden oder ein neues Konto erstellen</Tooltip>
{/if}

{#if data.progress}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ $: filteredComponentProps = filteredItems.map((item) => {
{/if}

<Gallery
class="grid w-full grid-cols-1 justify-center gap-8 p-4 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"
class="w-full justify-items-center"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here. While the styling isn´t final, some of the other components that use the GalleryDisplay depend on it being styled as originally defined and their styling will break if it is changed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, get it.

>
{#each filteredItems as item, index}
<svelte:component
Expand Down
56 changes: 3 additions & 53 deletions frontend/src/lib/components/Frontpage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,60 +13,10 @@ export let getStarted = "";

export let items = [
{
header: "Was ist Mondey?",
summary:
"Mondey ist ein wissentschaftlich geprüftes Programm zure Dokumentation der Entwicklung von Kindern bis 6 Jahren.",
header: "Möchten Sie die Entwicklung von Kindern begleiten und fördern?",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use the svelte-i18n package to make use of localization. There is currently one default localization file under frontend/src/locales which is called de.json. You can define a section "frontpage" there and add all the items you need:

"frontpage": {
    "heading": "Möchten Sie die Entwicklung von Kindern begleiten und fördern?",
     "summary": "Hier sind Sie genau richtig!",
     "buttonLabel": "Anmeldung"
} 

which then can be used in the *.svelte files like so:

import {_} from "svelte-i18n";

export let items = [
       {header: $_("frontpage.heading"), ... }

and so on. If you want to use these in the markup section of the component, you have to wrap it in {}.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'll do it.

Thank you!

summary: "Hier sin Sie genau richtig!",
href: `${base}/info`,
button: "Mehr Info",
},
{
header: "Wozu ist Mondey gut?",
summary:
"Anhand ihrer Bewertungen der Fähigkeiten des Kindes erhalten sie Feedback zum Entwicklungsstand des Kindes und können so frühzeitig Fördermaßnahmen einleiten. Dies folgt einem übersichtlichen Ampelsystem.",
href: `${base}/info`,
button: "Mehr Info",
},
{
header: "Was umfasst Mondey?",
summary:
"Mondey umfasst unterschiedliche Entwicklungsbereiche wie von Kindern im Alter von 0 bis 6 Jahren. Dazu gehören unter anderem Grob-und feinmotorik, Wahrnehmung, Denkne, Sprache und Soziale Beziehungen.",
href: `${base}/info`,
button: "Mehr Info",
},
{
header: "Wie funktioniert Mondey?",
summary:
"Sie bewerten wie gut das Kind bestimmte Alltagshandlungen durchführen kann mit Hilfe einer Liste von Fragen.",
href: `${base}/info`,
button: "Mehr Info",
},
{
header: "Wo fange ich an?",
summary:
"Um zu beginnen, müssen sie sich registrieren und ein Profil für ihr Kind anlegen.",
href: getStarted,
button: "Los geht´s",
},
{
header: "dummy?",
summary:
"Lorem, ipsum dolor sit amet consectetur adipisicing elit. Impedit repellendus distinctio facilis! Voluptas corrupti recusandae sapiente doloribus voluptatem fugiat ducimus.",
href: `${base}/info`,
button: "Mehr Info",
},
{
header: "dummy?",
summary:
"Lorem, ipsum dolor sit amet consectetur adipisicing elit. Impedit repellendus distinctio facilis! Voluptas corrupti recusandae sapiente doloribus voluptatem fugiat ducimus.",
href: `${base}/info`,
button: "Mehr Info",
},
{
header: "dummy?",
summary:
"Lorem, ipsum dolor sit amet consectetur adipisicing elit. Impedit repellendus distinctio facilis! Voluptas corrupti recusandae sapiente doloribus voluptatem fugiat ducimus.",
href: `${base}/info`,
button: "Mehr Info",
button: "Anmeldung",
},
];

Expand Down