[Update] Add transliteration position navigator when hiragana and romaji is both enabled and mouse hovered.

This commit is contained in:
Sakamoto Shiina
2025-09-18 00:06:09 +09:00
parent 17e450310e
commit 56af62029a
2 changed files with 13 additions and 6 deletions

View File

@@ -94,17 +94,17 @@ const MessageWithTransliteration = ({ item }) => {
const hira = token.hira ?? ""; const hira = token.hira ?? "";
const hepburn = token.hepburn ?? ""; const hepburn = token.hepburn ?? "";
if ((hira && orig === hira)) { if (hira && hira === orig && hepburn) {
return ( return (
<span key={key} title={hepburn} className={styles.token}> <span key={key} title={hepburn} className={styles.with_hepburn}>
{orig} {orig}
</span> </span>
); );
} }
if (hira && hira !== orig) { if (hira && hira !== orig && hepburn) {
return ( return (
<ruby key={key} title={hepburn} className={styles.tokenRuby}> <ruby key={key} title={hepburn} className={styles.with_hepburn}>
{orig} {orig}
<rt>{hira}</rt> <rt>{hira}</rt>
</ruby> </ruby>
@@ -113,7 +113,7 @@ const MessageWithTransliteration = ({ item }) => {
if (hepburn && hepburn !== orig) { if (hepburn && hepburn !== orig) {
return ( return (
<ruby key={key} className={styles.tokenRuby}> <ruby key={key} className={styles.ruby}>
{orig} {orig}
<rt>{hepburn}</rt> <rt>{hepburn}</rt>
</ruby> </ruby>
@@ -121,7 +121,7 @@ const MessageWithTransliteration = ({ item }) => {
} }
return ( return (
<span key={key} className={styles.token}> <span key={key} className={styles.original_only}>
{orig} {orig}
</span> </span>
); );

View File

@@ -113,3 +113,10 @@
color: var(--dark_500_color); color: var(--dark_500_color);
} }
} }
// For ruby
.with_hepburn {
&:hover {
color: var(--dark_500_color);
}
}