diff -r 000000000000 -r 5f4fcbc80b37 clientjs/packages/dashboard-components/src/ui/IndexList.jsx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientjs/packages/dashboard-components/src/ui/IndexList.jsx Fri Sep 14 17:57:34 2018 +0200 @@ -0,0 +1,57 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import md5 from 'md5'; + +import IndexEntryItem from './IndexEntryItem'; + +const IndexEntry = ({ letter, items }) => ( +
  • + { letter } + +
  • +); + +IndexEntry.propTypes = { + letter: PropTypes.string.isRequired, + items: PropTypes.arrayOf(PropTypes.string).isRequired, +}; + +const Index = ({ terms }) => { + const termsIndex = terms.reduce((res, term) => { + const firstLetter = term[0]; + res[firstLetter] = (res[firstLetter] || []); + res[firstLetter].push(term); + return res; + }, {}); + + return ( + + ); +}; + +Index.propTypes = { + terms: PropTypes.arrayOf(PropTypes.string).isRequired, +}; + +const IndexList = ({ terms, className }) => ( +
    + +
    +); + +IndexList.propTypes = { + terms: PropTypes.arrayOf(PropTypes.string).isRequired, + className: PropTypes.string.isRequired, +}; + +export default IndexList;