This repository has been archived by the owner on Mar 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
/
Main.js
73 lines (67 loc) · 1.65 KB
/
Main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import React from "react";
import InlineCss from "react-inline-css";
import Transmit from "lib/react-transmit";
import Newsfeed from "example/Newsfeed";
/**
* @class Main
*/
const Main = React.createClass({
statics: {
/**
* Style this example app like Facebook.
*/
css: () => `
* {
box-sizing: border-box;
}
body {
background: #E9EAED;
font-family: Helvetica, sans-serif;
}
a {
color: #3B5998;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
& .github {
position: fixed;
top: 0;
right: 0;
border: 0;
}`
},
onQueryComplete (error, queryResults) {
if (error) {
throw error;
}
console.log("Main.onQueryComplete: ", queryResults);
},
render () {
const repositoryUrl = "https://github.com/RickWong/react-transmit";
/**
* This is a Transmit prop.
*/
const {stories} = this.props;
/**
* This is an optional callback to capture the query results.
*/
const {onQueryComplete} = this;
return (
<InlineCss stylesheet={Main.css()} namespace="Main">
<a className="github" href={repositoryUrl}>
<img src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub"/>
</a>
<Newsfeed {...{repositoryUrl, stories, onQueryComplete}} />
</InlineCss>
);
}
});
export default Transmit.createContainer(Main, {
queries: {
stories (queryParams) {
return Newsfeed.getQuery("stories")
}
}
});