feat(profile): Add Profile and components

This commit is contained in:
Bouncey
2018-11-07 18:15:27 +00:00
committed by mrugesh mohapatra
parent 491912448b
commit 987da19254
24 changed files with 1358 additions and 83 deletions

View File

@@ -0,0 +1,40 @@
import React from 'react';
import PropTypes from 'prop-types';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { apiLocation } from '../../../config/env.json';
import { hardGoTo } from '../../redux';
const currentChallengeApi = '/challenges/current-challenge';
const propTypes = {
children: PropTypes.any,
hardGoTo: PropTypes.func.isRequired
};
const mapStateToProps = () => ({});
const mapDispatchToProps = dispatch =>
bindActionCreators({ hardGoTo }, dispatch);
const createClickHandler = hardGoTo => e => {
e.preventDefault();
return hardGoTo(`${apiLocation}${currentChallengeApi}`);
};
function CurrentChallengeLink({ children, hardGoTo }) {
return (
<a href={currentChallengeApi} onClick={createClickHandler(hardGoTo)}>
{children}
</a>
);
}
CurrentChallengeLink.displayName = 'CurrentChallengeLink';
CurrentChallengeLink.propTypes = propTypes;
export default connect(
mapStateToProps,
mapDispatchToProps
)(CurrentChallengeLink);