From 31ac15a9b9f33afce0e0fa40b463278916e45562 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Mon, 27 Nov 2023 21:10:20 -0800
Subject: feat(list): furigana

---
 src/lib/List/MediaTitle.svelte | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 src/lib/List/MediaTitle.svelte

(limited to 'src/lib/List/MediaTitle.svelte')

diff --git a/src/lib/List/MediaTitle.svelte b/src/lib/List/MediaTitle.svelte
new file mode 100644
index 00000000..b98f4125
--- /dev/null
+++ b/src/lib/List/MediaTitle.svelte
@@ -0,0 +1,28 @@
+<script lang="ts">
+	import type { Media } from '$lib/AniList/media';
+	import settings from '../../stores/settings';
+	import * as wanakana from 'wanakana';
+
+	export let media: Media;
+</script>
+
+{#if $settings.displayNativeTitles}
+	{#if $settings.displayFurigana}
+		<span title={media.title.english || media.title.romaji || media.title.native}>
+			<ruby>
+				{media.title.native}
+				<rt>
+					{wanakana.toKana(media.title.romaji)}
+				</rt>
+			</ruby>
+		</span>
+	{:else}
+		<span title={media.title.english || media.title.romaji || media.title.native}>
+			{media.title.native}
+		</span>
+	{/if}
+{:else}
+	<span title={media.title.native}>
+		{media.title.english || media.title.romaji || media.title.native}
+	</span>
+{/if}
-- 
cgit v1.2.3

