]> git.localhorst.tv Git - alttp.git/blob - resources/js/components/techniques/List.js
add tech index
[alttp.git] / resources / js / components / techniques / List.js
1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { Link } from 'react-router-dom';
4
5 import { getTranslation } from '../../helpers/Technique';
6 import i18n from '../../i18n';
7
8 const List = ({ techniques }) => <ul className="tech-list">
9         {techniques.map(tech =>
10                 <li key={tech.id}>
11                         <h2>
12                                 <Link to={`/tech/${tech.name}`}>
13                                         {getTranslation(tech, 'title', i18n.language)}
14                                 </Link>
15                         </h2>
16                         <p>{getTranslation(tech, 'short', i18n.language)}</p>
17                 </li>
18         )}
19 </ul>;
20
21 List.propTypes = {
22         techniques: PropTypes.arrayOf(PropTypes.shape({
23                 id: PropTypes.number,
24                 name: PropTypes.string,
25         })),
26 };
27
28 export default List;