Browse Source

Split up marketing content into Markdown files

main
Yangshun Tay 7 years ago
committed by Tay Yang Shun
parent
commit
1e6151e390
  1. 8
      content/marketing/component-based.md
  2. 8
      content/marketing/declarative.md
  3. 8
      content/marketing/learn-once-write-anywhere.md
  4. 38
      src/pages/index.js
  5. 1
      src/types.js

8
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.

8
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.

8
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/).

38
src/pages/index.js

@ -41,7 +41,12 @@ class Home extends Component {
} }
render() { render() {
const {data} = this.props;
const title = 'React - A JavaScript library for building user interfaces'; 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 ( return (
<div css={{width: '100%'}}> <div css={{width: '100%'}}>
@ -141,7 +146,7 @@ class Home extends Component {
<Container> <Container>
<div css={[sharedStyles.markdown, markdownStyles]}> <div css={[sharedStyles.markdown, markdownStyles]}>
<section className="light home-section"> <section className="home-section">
<div className="marketing-row"> <div className="marketing-row">
<div className="marketing-col"> <div className="marketing-col">
<h3>Declarative</h3> <h3>Declarative</h3>
@ -160,6 +165,16 @@ class Home extends Component {
</div> </div>
</div> </div>
</section> </section>
<section className="home-section">
<div className="marketing-row">
{marketingColumns.map((column, index) =>
<div className="marketing-col" key={index}>
<h3>{column.title}</h3>
<div dangerouslySetInnerHTML={{__html: column.content}} />
</div>
)}
</div>
</section>
<hr className="home-divider" /> <hr className="home-divider" />
<section className="home-section"> <section className="home-section">
<div id="examples"> <div id="examples">
@ -242,6 +257,7 @@ class Home extends Component {
} }
Home.propTypes = { Home.propTypes = {
data: PropTypes.object.isRequired,
location: PropTypes.object.isRequired, location: PropTypes.object.isRequired,
}; };
@ -283,6 +299,26 @@ const CtaItem = ({children, primary = false}) => (
</div> </div>
); );
// 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; export default Home;
// TODO This nasty CSS is required because 'docs/index.md' defines hard-coded class names. // TODO This nasty CSS is required because 'docs/index.md' defines hard-coded class names.

1
src/types.js

@ -23,6 +23,7 @@ export type Node = {
next?: string, next?: string,
prev?: string, prev?: string,
title: string, title: string,
order?: number,
}, },
html: string, html: string,
id: string, id: string,

Loading…
Cancel
Save