116 lines
3.1 KiB
JavaScript
Raw Normal View History

2016-08-18 11:41:13 +02:00
/*
*
2017-08-21 15:12:53 +02:00
* HomePage
2016-08-18 11:47:26 +02:00
*
2016-08-18 11:41:13 +02:00
*/
import React from 'react';
2016-08-19 13:57:50 +02:00
import { connect } from 'react-redux';
2017-08-21 15:12:53 +02:00
import Helmet from 'react-helmet';
2018-04-04 12:36:02 +02:00
import { FormattedMessage } from 'react-intl';
2018-04-03 17:56:19 +02:00
// import PropTypes from 'prop-types';
import cn from 'classnames';
2017-10-18 16:51:50 +02:00
2018-04-03 17:56:19 +02:00
import Block from 'components/HomePageBlock/Loadable';
2018-04-04 10:21:06 +02:00
import Button from 'components/Button';
2018-04-04 08:54:15 +02:00
import Sub from 'components/Sub/Loadable';
2017-10-18 16:51:50 +02:00
2018-04-04 12:36:02 +02:00
import BlockLink from './BlockLink';
2018-04-04 10:21:06 +02:00
import CreateContent from './CreateContent';
2018-04-04 12:36:02 +02:00
import WelcomeContent from './WelcomeContent';
2018-04-04 10:21:06 +02:00
2017-08-21 15:12:53 +02:00
import styles from './styles.scss';
2016-08-18 11:41:13 +02:00
2018-04-04 10:21:06 +02:00
const FIRST_BLOCK = [
{
title: {
id: 'app.components.HomePage.welcome',
},
content: () => <WelcomeContent />,
},
{
title: {
id: 'app.components.HomePage.create',
},
content: () => <CreateContent />,
},
];
2018-04-04 12:36:02 +02:00
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',
},
},
];
export class HomePage extends React.Component {
// eslint-disable-line react/prefer-stateless-function
2016-08-18 11:41:13 +02:00
render() {
return (
2018-04-03 17:56:19 +02:00
<div className={cn('container-fluid', styles.containerFluid)}>
<Helmet title="Home Page" />
<div className="row">
2018-04-04 12:36:02 +02:00
<div className="col-md-8 col-lg-8">
2018-04-03 17:56:19 +02:00
<Block>
2018-04-04 10:21:06 +02:00
{FIRST_BLOCK.map((value, key) => <Sub key={key} {...value} underline={key === 0} />)}
2018-04-04 12:36:02 +02:00
<a href="https://strapi.io/getting-started" target="_blank">
<Button className={styles.homePageTutorialButton} primary>
<FormattedMessage id="app.components.HomePage.button.quickStart" />
</Button>
</a>
<div className={styles.homePageLinkWrapper}>
{FIRST_BLOCK_LINKS.map((value, key) => <BlockLink {...value} key={key} />)}
</div>
2018-04-03 17:56:19 +02:00
</Block>
</div>
2018-04-04 12:36:02 +02:00
<div className="col-lg-4 col-md-4">
2018-04-04 13:55:27 +02:00
<Block className={styles.blockShirt}>
<div>
<FormattedMessage id="app.components.HomePage.support" />
<FormattedMessage id="app.components.HomePage.support.content">
{message => <p>{message}</p>}
</FormattedMessage>
<FormattedMessage id="app.components.HomePage.support.link">
{message => (
<a href="https://strapi.io/shop" target="_blank">
{message}
</a>
)}
</FormattedMessage>
</div>
</Block>
2018-04-03 17:56:19 +02:00
</div>
2017-10-18 16:51:50 +02:00
</div>
2016-08-19 13:57:50 +02:00
</div>
2016-08-18 11:41:13 +02:00
);
}
}
2016-08-19 13:57:50 +02:00
2017-10-18 16:51:50 +02:00
HomePage.propTypes = {
2018-04-03 17:56:19 +02:00
// history: PropTypes.object.isRequired,
2017-10-18 16:51:50 +02:00
};
2016-08-19 13:57:50 +02:00
function mapDispatchToProps(dispatch) {
return {
dispatch,
};
}
2017-08-21 15:12:53 +02:00
export default connect(mapDispatchToProps)(HomePage);