Skip to content

Commit 3172a31

Browse files
committed
Update component.
1 parent fc22d38 commit 3172a31

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/components/island/CodeHeart.svelte

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
});
7676
</script>
7777

78-
{#if !mini || isFavorite }
78+
{#if !mini}
7979
<div class="code-heart">
8080
<button
8181
class="heart-button"
@@ -94,6 +94,14 @@
9494
{/if}
9595
</button>
9696
</div>
97+
{:else}
98+
<div class="code-heart">
99+
{#if isFavorite}
100+
<svg xmlns="http://www.w3.org/2000/svg" class="heart-icon filled" viewBox="0 0 24 24" width="24" height="24">
101+
<path fill="currentColor" d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
102+
</svg>
103+
{/if}
104+
</div>
97105
{/if}
98106

99107
<style>

src/components/sessions/list-sessions.astro

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
const { sessions } = Astro.props;
33
import Prose from "@ui/Prose.astro";
44
import Tag from "@ui/Tag.astro";
5+
import CodeHeart from "@components/island/CodeHeart.svelte";
56
import SessionSpeakers from "./session-speakers.astro";
67
78
type Session = {
89
data: {
910
title: string;
11+
code: string;
1012
speakers: Array<{
1113
id: string;
1214
collection: "speakers";
@@ -34,6 +36,13 @@ type Session = {
3436
<a href={`/session/${session.id}`} class="underline">
3537
{session.data.title}
3638
</a>
39+
40+
<CodeHeart
41+
client:load
42+
mini={true}
43+
codeId={session.data.code}
44+
title={session.data.title}
45+
/>
3746
</h4>
3847
<p>
3948
<span class="sr-only">Speakers:</span>

src/pages/speaker/[slug].astro

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Image } from "astro:assets";
66
import Markdown from "@ui/Markdown.astro";
77
import Headline from "@ui/Headline.astro";
88
import Section from "@ui/Section.astro"
9+
import CodeHeart from "@components/island/CodeHeart.svelte";
910
1011
1112
export async function getStaticPaths() {
@@ -249,6 +250,13 @@ function getGitHosting(url: string): string | undefined {
249250
>
250251
{session.data.title}
251252
</a>
253+
254+
<CodeHeart
255+
client:load
256+
mini={true}
257+
codeId={session.data.code}
258+
title={session.data.title}
259+
/>
252260
</li>
253261
))
254262
}

0 commit comments

Comments
 (0)