Skip to content

Commit 1e6151e

Browse files
committed
Split up marketing content into Markdown files
1 parent 60dab36 commit 1e6151e

File tree

5 files changed

+62
-1
lines changed

5 files changed

+62
-1
lines changed

content/marketing/component-based.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Component-Based
3+
order: 1
4+
---
5+
6+
Build encapsulated components that manage their own state, then compose them to make complex UIs.
7+
8+
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.

content/marketing/declarative.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Declarative
3+
order: 0
4+
---
5+
6+
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.
7+
8+
Declarative views make your code more predictable and easier to debug.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Learn Once, Write Anywhere
3+
order: 2
4+
---
5+
6+
We don't make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code.
7+
8+
React can also render on the server using Node and power mobile apps using [React Native](https://facebook.github.io/react-native/).

src/pages/index.js

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ class Home extends Component {
4141
}
4242

4343
render() {
44+
const {data} = this.props;
4445
const title = 'React - A JavaScript library for building user interfaces';
46+
const marketingColumns = data.allMarkdownRemark.edges.map(edge => ({
47+
title: edge.node.frontmatter.title,
48+
content: edge.node.html,
49+
}));
4550

4651
return (
4752
<div css={{width: '100%'}}>
@@ -141,7 +146,7 @@ class Home extends Component {
141146

142147
<Container>
143148
<div css={[sharedStyles.markdown, markdownStyles]}>
144-
<section className="light home-section">
149+
<section className="home-section">
145150
<div className="marketing-row">
146151
<div className="marketing-col">
147152
<h3>Declarative</h3>
@@ -160,6 +165,16 @@ class Home extends Component {
160165
</div>
161166
</div>
162167
</section>
168+
<section className="home-section">
169+
<div className="marketing-row">
170+
{marketingColumns.map((column, index) =>
171+
<div className="marketing-col" key={index}>
172+
<h3>{column.title}</h3>
173+
<div dangerouslySetInnerHTML={{__html: column.content}} />
174+
</div>
175+
)}
176+
</div>
177+
</section>
163178
<hr className="home-divider" />
164179
<section className="home-section">
165180
<div id="examples">
@@ -242,6 +257,7 @@ class Home extends Component {
242257
}
243258

244259
Home.propTypes = {
260+
data: PropTypes.object.isRequired,
245261
location: PropTypes.object.isRequired,
246262
};
247263

@@ -283,6 +299,26 @@ const CtaItem = ({children, primary = false}) => (
283299
</div>
284300
);
285301

302+
// eslint-disable-next-line no-undef
303+
export const pageQuery = graphql`
304+
query MarketingMarkdown {
305+
allMarkdownRemark(
306+
filter: {id: {regex: "/marketing/"}},
307+
sort: {fields: [frontmatter___order],
308+
order: ASC}
309+
) {
310+
edges {
311+
node {
312+
frontmatter {
313+
title
314+
}
315+
html
316+
}
317+
}
318+
}
319+
}
320+
`;
321+
286322
export default Home;
287323

288324
// TODO This nasty CSS is required because 'docs/index.md' defines hard-coded class names.

src/types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export type Node = {
2323
next?: string,
2424
prev?: string,
2525
title: string,
26+
order?: number,
2627
},
2728
html: string,
2829
id: string,

0 commit comments

Comments
 (0)