/*
*
* HomePage
*
*/
import React from 'react';
import { connect } from 'react-redux';
import Helmet from 'react-helmet';
import { FormattedMessage } from 'react-intl';
// import PropTypes from 'prop-types';
import { isEmpty } from 'lodash';
import cn from 'classnames';
import Block from 'components/HomePageBlock/Loadable';
import Button from 'components/Button';
import Sub from 'components/Sub/Loadable';
import Input from 'components/InputText';
import validateInput from 'utils/inputsValidations';
import BlockLink from './BlockLink';
import CommunityContent from './CommunityContent';
import CreateContent from './CreateContent';
import SocialLink from './SocialLink';
import WelcomeContent from './WelcomeContent';
import styles from './styles.scss';
const FIRST_BLOCK = [
{
title: {
id: 'app.components.HomePage.welcome',
},
content: () => ,
},
{
title: {
id: 'app.components.HomePage.create',
},
content: () => ,
},
];
const FIRST_BLOCK_LINKS = [
{
link: 'https://strapi.io/documentation/',
content: {
id: 'app.components.BlockLink.documentation.content',
},
isDocumentation: true,
title: {
id: 'app.components.BlockLink.documentation',
},
},
{
link: 'https://github.com/strapi/strapi-examples',
content: {
id: 'app.components.BlockLink.code.content',
},
isDocumentation: false,
title: {
id: 'app.components.BlockLink.code',
},
},
];
const SECOND_BLOCK = {
title: {
id: 'app.components.HomePage.community',
},
content: () => ,
};
const SOCIAL_LINKS = [
{
name: 'Github',
link: 'https://github.com/strapi/strapi/',
},
{
name: 'Slack',
link: 'https://slack.strapi.io/',
},
{
name: 'Medium',
link: 'https://medium.com/@strapi',
},
{
name: 'Twitter',
link: 'https://twitter.com/strapijs',
},
{
name: 'Reddit',
link: 'https://www.reddit.com/r/node/search?q=strapi',
},
{
name: 'Stack Overflow',
link: 'https://stackoverflow.com/questions/tagged/strapi',
},
];
export class HomePage extends React.Component {
// eslint-disable-line react/prefer-stateless-function
state = { value: '', errors: [] };
handleChange = ({ target }) => this.setState({ value: target.value });
handleSubmit = e => {
e.preventDefault();
const errors = validateInput(this.state.value, { required: true }, 'email');
this.setState({ errors });
};
render() {
return (
{FIRST_BLOCK.map((value, key) => (
))}
{FIRST_BLOCK_LINKS.map((value, key) => )}
{SOCIAL_LINKS.map((value, key) => )}
{message => {message}
}
{message => (
{message}
)}
);
}
}
HomePage.propTypes = {
// history: PropTypes.object.isRequired,
};
function mapDispatchToProps(dispatch) {
return {
dispatch,
};
}
export default connect(mapDispatchToProps)(HomePage);