Skip to content

Commit 13f8217

Browse files
Display links on item pages
1 parent a33c55a commit 13f8217

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

src/routes/[group]/[item]/+page.svelte

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<script lang="ts">
2-
import { Navbar, Markdown } from '$components';
2+
import { Navbar } from '$components';
33
import { IconCard, RepoCard, PackageCard, CardList } from '$components/card';
4+
import { ItemChipList } from '$components/chip';
45
import Background from '$components/Background.svelte';
56
import Paper from '$components/Paper.svelte';
6-
import EditableMarkdown from '$components/markdown';
7-
import api from '$endpoints';
7+
import EditableMarkdown from '$components/markdown';
8+
import api from '$endpoints';
89
// import AsciinemaPlayer from "$components";
910
1011
export let data: import('./$types').PageData;
@@ -41,12 +42,24 @@
4142
editable={data.loggedIn}
4243
onSave={text => api().group.withId(data.groupId).item.withId(data.itemId).readme.set(text)}
4344
/>
44-
<!-- TODO: Display linked items as chips -->
45+
<!-- Display linked items as chips -->
46+
<div id="chip-links">
47+
{#each itemData.info.links.filter(([l]) => l.style === 'chip') as [linkOptions, linkedItems]}
48+
<div class="chip-link-row">
49+
<h2>{linkOptions.title}</h2>
50+
<ItemChipList
51+
globals={data.globals}
52+
items={[linkedItems.map(i => ({ groupId: linkOptions.groupId, itemId: i, selected: false }))]}
53+
link={true}
54+
/>
55+
</div>
56+
{/each}
57+
</div>
4558
</div>
4659
</Paper>
4760

4861
<!-- Display URLs if needed -->
49-
<div id="links-list">
62+
<div id="urls-list">
5063
<CardList>
5164
{#if itemData.info.urls.site}
5265
<IconCard
@@ -108,18 +121,18 @@
108121
border-radius: 10px 10px 0 0;
109122
}
110123
111-
/* .association-chip-row {
124+
.chip-link-row {
112125
display: flex;
113126
align-items: baseline;
114127
gap: 5px;
115128
margin: 10px 0;
116129
}
117-
.association-chip-row > h3 {
130+
.chip-link-row > h2 {
118131
margin: 0;
119132
height: min-content;
120-
} */
133+
}
121134
122-
#links-list {
135+
#urls-list {
123136
width: 80%;
124137
}
125138

0 commit comments

Comments
 (0)