should work
This commit is contained in:
@@ -1,14 +1,42 @@
|
||||
<script lang="ts">
|
||||
export let title: string;
|
||||
export let data: {
|
||||
title: string;
|
||||
description?: string;
|
||||
path: string;
|
||||
date?: string;
|
||||
tags?: string[];
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<h1>{title}</h1>
|
||||
</div>
|
||||
<a href={data.path}>
|
||||
<div class="card">
|
||||
<h2>{data.title}</h2>
|
||||
{#if data.description}
|
||||
<p>{data.description}</p>
|
||||
{/if}
|
||||
{#if data.tags}
|
||||
<div class="tags">
|
||||
{#each data.tags as tag}
|
||||
<span class="tag">{tag}</span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<style>
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: var(--color-nav);
|
||||
}
|
||||
|
||||
.card {
|
||||
margin: 1rem 0;
|
||||
overflow: hidden;
|
||||
border-radius: 0.25rem;
|
||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
||||
@@ -16,5 +44,22 @@
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 1rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.tags {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.tag {
|
||||
background-color: var(--color-bg-tag);
|
||||
color: var(--color-tag);
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
20
src/lib/projects.ts
Normal file
20
src/lib/projects.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { create_ssr_component } from 'svelte/internal';
|
||||
|
||||
export type Mdsvex = {
|
||||
metadata: {
|
||||
title: string;
|
||||
description?: string;
|
||||
date?: string;
|
||||
tags?: string[];
|
||||
};
|
||||
default: ReturnType<typeof create_ssr_component>;
|
||||
};
|
||||
|
||||
export const projects = new Map(
|
||||
Object.entries(
|
||||
import.meta.glob<Mdsvex>('../routes/projects/*/*{.md,.svelte,index.md.index.svelte}')
|
||||
).map(([path, load]) => [
|
||||
path.replace(/(\.md|\.svelte|\/index\.md|\/index\.svelte)$/, '').replace(/^\.\.\/routes/, ''),
|
||||
load
|
||||
])
|
||||
);
|
||||
20
src/lib/shs.ts
Normal file
20
src/lib/shs.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { create_ssr_component } from 'svelte/internal';
|
||||
|
||||
export type Mdsvex = {
|
||||
metadata: {
|
||||
title: string;
|
||||
description?: string;
|
||||
date?: string;
|
||||
tags?: string[];
|
||||
};
|
||||
default: ReturnType<typeof create_ssr_component>;
|
||||
};
|
||||
|
||||
export const shs = new Map(
|
||||
Object.entries(
|
||||
import.meta.glob<Mdsvex>('../routes/shs/*/*{.md,.svelte,index.md.index.svelte}')
|
||||
).map(([path, load]) => [
|
||||
path.replace(/(\.md|\.svelte|\/index\.md|\/index\.svelte)$/, '').replace(/^\.\.\/routes/, ''),
|
||||
load
|
||||
])
|
||||
);
|
||||
Reference in New Issue
Block a user