Start splitting in component the page.
This commit is contained in:
14
src/lib/components/ServiceCard.svelte
Normal file
14
src/lib/components/ServiceCard.svelte
Normal file
@@ -0,0 +1,14 @@
|
||||
<script lang="ts">
|
||||
import type { ServiceConfig } from '$lib/config';
|
||||
import { getServiceComponent } from '$lib/services/services';
|
||||
|
||||
export let service: ServiceConfig;
|
||||
export let data: any;
|
||||
|
||||
const component = getServiceComponent(service.type || '');
|
||||
</script>
|
||||
|
||||
<p>{service.title}</p>
|
||||
{#if component != undefined}
|
||||
<svelte:component this={component} {data} />
|
||||
{/if}
|
||||
11
src/lib/components/ServiceGroup.svelte
Normal file
11
src/lib/components/ServiceGroup.svelte
Normal file
@@ -0,0 +1,11 @@
|
||||
<script lang="ts">
|
||||
import type { ServiceGroupConfig } from '$lib/config';
|
||||
import ServiceCard from './ServiceCard.svelte';
|
||||
|
||||
export let group: ServiceGroupConfig;
|
||||
export let groupData: Array<unknown>;
|
||||
</script>
|
||||
|
||||
{#each group.items as service, i}
|
||||
<ServiceCard {service} data={groupData[i]} />
|
||||
{/each}
|
||||
Reference in New Issue
Block a user