index.js 4.26 KiB
/**
 * Copyright (c) 2017-present, Facebook, Inc.
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
const React = require('react');
const CompLibrary = require('../../core/CompLibrary.js');
const MarkdownBlock = CompLibrary.MarkdownBlock; /* Used to read markdown */
const Container = CompLibrary.Container;
const GridBlock = CompLibrary.GridBlock;
const siteConfig = require(`${process.cwd()}/siteConfig.js`);
function imgUrl(img) {
  return `${siteConfig.baseUrl}img/${img}`;
function docUrl(doc, language) {
  return `${siteConfig.baseUrl}docs/${language ? `${language}/` : ''}${doc}`;
function pageUrl(page, language) {
  return siteConfig.baseUrl + (language ? `${language}/` : '') + page;
class Button extends React.Component {
  render() {
    return (
      <div className="pluginWrapper buttonWrapper">
        <a className="button" href={this.props.href} target={this.props.target}>
          {this.props.children}
        </a>
      </div>
Button.defaultProps = {
  target: '_self',
const SplashContainer = props => (
  <div className="homeContainer">
    <div className="homeSplashFade">
      <div className="wrapper homeWrapper">{props.children}</div>
    </div>
  </div>
const Logo = props => (
  <div className="projectLogo">
    <img src={props.img_src} alt="Project Logo" />
  </div>
const ProjectTitle = () => (
  <h2 className="projectTitle">
    {siteConfig.title}
    <small>{siteConfig.tagline}</small>
  </h2>
const PromoSection = props => (
  <div className="section promoSection">
    <div className="promoRow">
      <div className="pluginRowBlock">{props.children}</div>
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
</div> </div> ); class HomeSplash extends React.Component { render() { const language = this.props.language || ''; return ( <SplashContainer> <Logo img_src={imgUrl('docusaurus.svg')} /> <div className="inner"> <ProjectTitle /> <PromoSection> <Button href={docUrl('getting-started', language)}> Get started </Button> <Button href={docUrl('documentation-intro', language)}>Documentation</Button> </PromoSection> </div> </SplashContainer> ); } } const Block = props => ( <Container padding={['bottom', 'top']} id={props.id} background={props.background} > <GridBlock align="center" contents={props.children} layout={props.layout} /> </Container> ); const Features = () => ( <Block layout="fourColumn"> {[ { content: 'This is the content of my feature', image: imgUrl('docusaurus.svg'), imageAlign: 'top', title: 'Feature One', }, { content: 'The content of my second feature', image: imgUrl('docusaurus.svg'), imageAlign: 'top', title: 'Feature Two', }, ]} </Block> ); const FeatureCallout = () => ( <div className="productShowcaseSection paddingBottom" style={{ textAlign: 'center' }} > <h2>Feature Callout</h2> <MarkdownBlock>These are features of this project</MarkdownBlock> </div> ); const LearnHow = () => ( <Block background="light"> {[ { content: 'Talk about learning how to use this', image: imgUrl('docusaurus.svg'), imageAlign: 'right',
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
title: 'Learn How', }, ]} </Block> ); const TryOut = () => ( <Block id="try"> {[ { content: 'Talk about trying this out', image: imgUrl('docusaurus.svg'), imageAlign: 'left', title: 'Try it Out', }, ]} </Block> ); const Description = () => ( <Block background="dark"> {[ { content: 'This is another description of how this project is useful', image: imgUrl('docusaurus.svg'), imageAlign: 'right', title: 'Description', }, ]} </Block> ); class Index extends React.Component { render() { const language = this.props.language || ''; return ( <div> <HomeSplash language={language} /> <div className="mainContainer"> <Features /> <FeatureCallout /> <LearnHow /> <TryOut /> <Description /> </div> </div> ); } } module.exports = Index;