Makes templates into clickable links
This commit is contained in:
@@ -1,10 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let templates: any;
|
import type { Template } from '$src/Types';
|
||||||
|
export let templates: Template[];
|
||||||
|
|
||||||
|
const slugify = (title: string) => {
|
||||||
|
return `/${title.toLowerCase().replace(/[^a-zA-Z ]/g, "").replaceAll(' ', '-')}`;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section class="templates">
|
<section class="templates">
|
||||||
{#each templates as template}
|
{#each templates as template}
|
||||||
<div class="template-card">
|
<a class="template-card" href={slugify(template.title)}>
|
||||||
<h3>{template.title}</h3>
|
<h3>{template.title}</h3>
|
||||||
<div class="template-summary">
|
<div class="template-summary">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
@@ -14,7 +19,7 @@
|
|||||||
<p class="description" title={template.description}>{template.description}</p>
|
<p class="description" title={template.description}>{template.description}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</a>
|
||||||
{/each}
|
{/each}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -35,6 +40,8 @@ section.templates {
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
transition:all 0.3s ease-in-out;
|
transition:all 0.3s ease-in-out;
|
||||||
max-width: 28rem;
|
max-width: 28rem;
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--foreground);
|
||||||
&:hover {
|
&:hover {
|
||||||
box-shadow: var(--shadow);
|
box-shadow: var(--shadow);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user