import theme from '../../styles/theme' import PropTypes from 'prop-types' import TrainingType from './trainingType' import TrainingBlock from './trainingBlock' function calculateRating (ratings) { const numberOfRatings = ratings.length const sumOfRatings = ratings.reduce( (accumulator, rating) => accumulator + rating.value, 0 ) return numberOfRatings ? sumOfRatings / numberOfRatings : '-' } const Training = props => (

{props.title}

Content

    {props.content .sort(block => block.sequence) .map(block => ( ))}
) Training.propTypes = { title: PropTypes.string.isRequired, type: PropTypes.shape(TrainingType.propTypes).isRequired, content: PropTypes.arrayOf(TrainingBlock.propTypes).isRequired, createdAt: PropTypes.number, trainingDate: PropTypes.number.isRequired, location: PropTypes.string.isRequired, registration: PropTypes } export default Training