import { useState, useEffect } from "react"; import * as T from "../types"; import Pashto from "./Pashto"; import Phonetics from "./Phonetics"; const arrowDown = ; function TableCell({ item, textOptions, center, noBorder }: { item: T.ArrayOneOrMore, textOptions: T.TextOptions, center?: boolean, noBorder?: boolean, }) { const [version, setVersion] = useState(0); useEffect(() => setVersion(0), [item]); function advanceVersion() { setVersion((version + 1) % item.length); } const w = item[version] || item[0]; return ( {w} {w} {w.e && (Array.isArray(w.e) ? w.e.map(e => {e}) : {w.e})} {item.length > 1 && ver. {version + 1}/{item.length} {arrowDown} } ); } export default TableCell;