add author info

This commit is contained in:
2026-07-07 10:04:03 +09:00
parent 00d7f7148e
commit c21aee6d13
2 changed files with 14 additions and 0 deletions
+6
View File
@@ -12,6 +12,7 @@ class TypingPractice extends HTMLElement {
async render() { async render() {
const raw = await fetch('https://korean-advice-open-api.vercel.app/api/advice') const raw = await fetch('https://korean-advice-open-api.vercel.app/api/advice')
const res = await raw.json() const res = await raw.json()
const author = `- ${res['author']} (${res['authorProfile']})`
const sentence = res["message"] const sentence = res["message"]
const sentence_jamo = decompose(sentence) const sentence_jamo = decompose(sentence)
let progress = 0 let progress = 0
@@ -41,6 +42,10 @@ class TypingPractice extends HTMLElement {
sentence_display.append(span) sentence_display.append(span)
}) })
const author_info = document.createElement('p')
author_info.className = 'author'
author_info.textContent = author
const updateColors = (has_error) => { const updateColors = (has_error) => {
;[...sentence].forEach((_, idx) => { ;[...sentence].forEach((_, idx) => {
const span = sentence_display.children[idx] const span = sentence_display.children[idx]
@@ -104,6 +109,7 @@ class TypingPractice extends HTMLElement {
}) })
this.append(sentence_display) this.append(sentence_display)
this.append(author_info)
this.append(input_box) this.append(input_box)
} }
} }
+8
View File
@@ -88,3 +88,11 @@ input:focus {
.dict-count { .dict-count {
color: #888888; color: #888888;
} }
.author {
display: flex;
justify-content: end;
color: #888888;
font-size: 20px;
letter-spacing: 0.02em;
}