mapcomplete/src/Utils/placeholder.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
399 B
TypeScript
Raw Normal View History

import { Translation } from "../UI/i18n/Translation"
2023-12-25 19:59:58 +01:00
export function placeholder(htmlElement: HTMLInputElement | HTMLTextAreaElement, t: Translation) {
let destroy: () => void = undefined
t.current.map(
(label) => {
htmlElement.setAttribute("placeholder", label)
},
[],
(f) => {
destroy = f
}
)
return { destroy }
}