From 73c6da0b8f30c7e129c6316a013c1e154f36ba81 Mon Sep 17 00:00:00 2001 From: Richard Zhang Date: Sun, 17 Dec 2017 16:07:11 -0800 Subject: [PATCH] Index page composition (#293) * without having having to worry about site design. Let me know if double having is intentional * index page composition --- examples/basics/pages/en/index.js | 310 +++++++++++++++++------------- 1 file changed, 175 insertions(+), 135 deletions(-) diff --git a/examples/basics/pages/en/index.js b/examples/basics/pages/en/index.js index b7a99208e2..7e0427ce8c 100755 --- a/examples/basics/pages/en/index.js +++ b/examples/basics/pages/en/index.js @@ -14,6 +14,18 @@ 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 + '/' + doc; +} + +function pageUrl(page, language) { + return siteConfig.baseUrl + language + '/' + page; +} + class Button extends React.Component { render() { return ( @@ -30,154 +42,182 @@ Button.defaultProps = { target: '_self', }; -class HomeSplash extends React.Component { - render() { - return ( -
-
-
-
- -
-
-

- {siteConfig.title} - {siteConfig.tagline} -

-
-
-
- - - -
-
-
-
-
-
+const SplashContainer = (props) => ( +
+
+
+ {props.children}
+
+
+) + +const Logo = (props) => ( +
+ +
+) + +const ProjectTitle = (props) => ( +

+ {siteConfig.title} + {siteConfig.tagline} +

+) + +const PromoSection = (props) => ( +
+
+
+ {props.children} +
+
+
+) + +class HomeSplash extends React.Component { + + render() { + let language = this.props.language || 'en'; + return ( + + +
+ + + + + + +
+
); } } +const Block = (props) => ( + + + +); + +const Features = (props) => ( + + {[ + { + 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', + }, + ]} + +); + +const FeatureCallout = (props) => ( +
+

Feature Callout

+ These are features of this project +
+) + +const LearnHow = (props) => ( + + {[ + { + content: 'Talk about learning how to use this', + image: imgUrl('docusaurus.svg'), + imageAlign: 'right', + title: 'Learn How', + }, + ]} + +) + +const TryOut = (props) => ( + + {[ + { + content: 'Talk about trying this out', + image: imgUrl('docusaurus.svg'), + imageAlign: 'left', + title: 'Try it Out', + }, + ]} + +) + +const Description = (props) => ( + + {[ + { + content: + 'This is another description of how this project is useful', + image: imgUrl('docusaurus.svg'), + imageAlign: 'right', + title: 'Description', + }, + ]} + +) + +const Showcase = (props) => { + const showcase = siteConfig.users + .filter(user => { + return user.pinned; + }) + .map((user, i) => { + return ( + + + + ); + }); + + return ( +
+

{"Who's Using This?"}

+

This project is used by all these people

+
{showcase}
+
+ + More {siteConfig.title} Users + +
+
+ ) +} + class Index extends React.Component { render() { let language = this.props.language || 'en'; - const showcase = siteConfig.users - .filter(user => { - return user.pinned; - }) - .map(user => { - return ( - - - - ); - }); return (
- - - - -
-

Feature Callout

- These are features of this project -
- - - - - - - - - - - - - -
-

{"Who's Using This?"}

-

This project is used by all these people

-
{showcase}
- -
+ + + + + +
);