ant-design/site/theme/template/Home/index.jsx

86 lines
2.0 KiB
React
Raw Normal View History

2016-02-29 14:08:40 +08:00
import React from 'react';
import { injectIntl } from 'react-intl';
2019-09-08 00:13:43 +08:00
import { Helmet } from 'react-helmet';
2018-01-04 20:00:38 +08:00
import PropTypes from 'prop-types';
2016-03-03 17:23:08 +08:00
import Banner from './Banner';
import Page1 from './Page1';
import Page2 from './Page2';
import Page3 from './Page3';
import Footer from '../Layout/Footer';
// To store style which is only for Home and has conflicts with others.
function getStyle() {
return `
.main-wrapper {
padding: 0;
}
2017-12-01 20:27:44 +08:00
#header {
box-shadow: none;
max-width: 1200px;
2017-12-01 20:27:44 +08:00
width: 100%;
margin: 20px auto 0;
padding: 0 24px;
2017-12-01 20:27:44 +08:00
}
#header,
#header .ant-select-selection,
#header .ant-menu {
background: transparent;
}
#header #logo {
padding: 0;
}
2018-12-27 14:06:35 +08:00
#header #nav .ant-menu-item {
border-color: transparent;
}
2019-03-11 11:19:43 +08:00
#header #nav .ant-menu-submenu {
border-color: transparent;
}
2018-12-27 14:06:35 +08:00
#header #nav .ant-menu-item.hide-in-home-page {
display: none;
}
2018-01-08 12:16:59 +08:00
#header .ant-row > div:last-child .header-lang-button {
margin-right: 0;
}
2019-09-19 15:11:50 +08:00
.rc-footer-container {
max-width: 1200px;
2019-09-19 15:11:50 +08:00
padding: 80px 0;
}
2019-09-19 15:11:50 +08:00
.rc-footer-bottom-container {
max-width: 1200px;
}
.rc-footer-columns {
justify-content: space-around;
}
`;
}
2016-03-23 14:15:00 +08:00
2019-08-06 15:09:07 +08:00
// eslint-disable-next-line react/prefer-stateless-function
2017-12-18 17:58:45 +08:00
class Home extends React.Component {
2018-01-04 20:00:38 +08:00
static contextTypes = {
2018-01-05 17:23:59 +08:00
isMobile: PropTypes.bool.isRequired,
2018-12-07 16:17:45 +08:00
};
2017-12-18 17:58:45 +08:00
render() {
2019-08-08 12:35:48 +08:00
const { intl } = this.props;
const { isMobile } = this.context;
2018-01-05 17:23:59 +08:00
const childProps = { ...this.props, isMobile, locale: intl.locale };
2017-12-18 17:58:45 +08:00
return (
2019-09-08 00:13:43 +08:00
<>
<style dangerouslySetInnerHTML={{ __html: getStyle() }} /> {/* eslint-disable-line */}
2019-09-20 17:05:13 +08:00
<Helmet encodeSpecialCharacters={false}>
2019-09-08 00:13:43 +08:00
<title>{`Ant Design - ${intl.formatMessage({ id: 'app.home.slogan' })}`}</title>
</Helmet>
<Banner {...childProps} />
<Page1 {...childProps} />
<Page2 {...childProps} />
<Page3 {...childProps} />
<Footer />
</>
2017-12-18 17:58:45 +08:00
);
}
2016-02-29 14:08:40 +08:00
}
export default injectIntl(Home);