X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Ftechniques%2FDetail.js;h=d955397399668d86d2d030f01c9cb2de8fb6d3b0;hb=35d1ce20e64f3373d74816ed1bf9440b4213fa1a;hp=88ce5943b62c02447fc3c3c856fb0742377ed740;hpb=68aabaf6da8ed6e675bdea728702d5bd75066964;p=alttp.git diff --git a/resources/js/components/techniques/Detail.js b/resources/js/components/techniques/Detail.js index 88ce594..d955397 100644 --- a/resources/js/components/techniques/Detail.js +++ b/resources/js/components/techniques/Detail.js @@ -1,17 +1,41 @@ import PropTypes from 'prop-types'; import React from 'react'; import { Container } from 'react-bootstrap'; +import { withTranslation } from 'react-i18next'; -const Detail = ({ technique }) => -

{technique.title}

-
+import Outline from './Outline'; +import { getTranslation } from '../../helpers/Technique'; +import i18n from '../../i18n'; + +const Detail = ({ technique }) => +

{getTranslation(technique, 'title', i18n.language)}

+ +
+ {technique.chapters ? technique.chapters.map(chapter => +
+ {chapter.pivot.level ? + React.createElement( + `h${chapter.pivot.level}`, + {}, + getTranslation(chapter, 'title', i18n.language), + ) + : null} +
+
+ ) : null} ; Detail.propTypes = { technique: PropTypes.shape({ + chapters: PropTypes.arrayOf(PropTypes.shape({ + })), description: PropTypes.string, title: PropTypes.string, }), }; -export default Detail; +export default withTranslation()(Detail);