import * as React from "react"; import Typography from "@material-ui/core/Typography"; import { IVocab, VocabType, INomenData, IVerbData, IAdjektivData } from "../models/vocab"; interface IProps { vocab: IVocab; }; function vocabSpecificInformation(vocab: IVocab) { switch (vocab.type) { case VocabType.NOMEN: const nData = vocab.latin as INomenData; return
Genitiv: {nData.genitiv} Genus: {nData.genus}
; case VocabType.VERB: const vData = vocab.latin as IVerbData; return
1. Person Präsens: {vData.praesens} 1. Person Perfekt: {vData.perfekt}
; case VocabType.ADJEKTIV: const aData = vocab.latin as IAdjektivData; return
Endung feminin: {aData.endung_f} Endung neutrum: {aData.endung_n}
; case VocabType.ADVERB: return
; } } export default class VocabularyData extends React.Component { render() { const { vocab } = this.props; return
{vocab.german.join(", ")} {vocabSpecificInformation(vocab)} { vocab.hint ? (
Tipp: {vocab.hint}
) : undefined } { vocab.mnemonic ? (
Eselsbrücke: {vocab.mnemonic}
) : undefined }
; } };