From 1e6151e3909c3a5196fb3d3949ea42c6bfa790e3 Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Fri, 13 Oct 2017 01:04:18 +0800 Subject: [PATCH] Split up marketing content into Markdown files --- content/marketing/component-based.md | 8 ++++ content/marketing/declarative.md | 8 ++++ .../marketing/learn-once-write-anywhere.md | 8 ++++ src/pages/index.js | 38 ++++++++++++++++++- src/types.js | 1 + 5 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 content/marketing/component-based.md create mode 100644 content/marketing/declarative.md create mode 100644 content/marketing/learn-once-write-anywhere.md diff --git a/content/marketing/component-based.md b/content/marketing/component-based.md new file mode 100644 index 00000000..aeb3c4de --- /dev/null +++ b/content/marketing/component-based.md @@ -0,0 +1,8 @@ +--- +title: Component-Based +order: 1 +--- + +Build encapsulated components that manage their own state, then compose them to make complex UIs. + +Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM. diff --git a/content/marketing/declarative.md b/content/marketing/declarative.md new file mode 100644 index 00000000..c3b65190 --- /dev/null +++ b/content/marketing/declarative.md @@ -0,0 +1,8 @@ +--- +title: Declarative +order: 0 +--- + +React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes. + +Declarative views make your code more predictable and easier to debug. diff --git a/content/marketing/learn-once-write-anywhere.md b/content/marketing/learn-once-write-anywhere.md new file mode 100644 index 00000000..009edf5b --- /dev/null +++ b/content/marketing/learn-once-write-anywhere.md @@ -0,0 +1,8 @@ +--- +title: Learn Once, Write Anywhere +order: 2 +--- + +We don't make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code. + +React can also render on the server using Node and power mobile apps using [React Native](https://facebook.github.io/react-native/). diff --git a/src/pages/index.js b/src/pages/index.js index 637c0ec0..7475a24f 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -41,7 +41,12 @@ class Home extends Component { } render() { + const {data} = this.props; const title = 'React - A JavaScript library for building user interfaces'; + const marketingColumns = data.allMarkdownRemark.edges.map(edge => ({ + title: edge.node.frontmatter.title, + content: edge.node.html, + })); return (
@@ -141,7 +146,7 @@ class Home extends Component {
-
+

Declarative

@@ -160,6 +165,16 @@ class Home extends Component {
+
+
+ {marketingColumns.map((column, index) => +
+

{column.title}

+
+
+ )} +
+

@@ -242,6 +257,7 @@ class Home extends Component { } Home.propTypes = { + data: PropTypes.object.isRequired, location: PropTypes.object.isRequired, }; @@ -283,6 +299,26 @@ const CtaItem = ({children, primary = false}) => (
); +// eslint-disable-next-line no-undef +export const pageQuery = graphql` +query MarketingMarkdown { + allMarkdownRemark( + filter: {id: {regex: "/marketing/"}}, + sort: {fields: [frontmatter___order], + order: ASC} + ) { + edges { + node { + frontmatter { + title + } + html + } + } + } +} +`; + export default Home; // TODO This nasty CSS is required because 'docs/index.md' defines hard-coded class names. diff --git a/src/types.js b/src/types.js index 782a5b6f..91603786 100644 --- a/src/types.js +++ b/src/types.js @@ -23,6 +23,7 @@ export type Node = { next?: string, prev?: string, title: string, + order?: number, }, html: string, id: string,