Setup credExplorer app scaffold (#249)

Test plan: Run `yarn start`, and observe that the Cred Explorer is now
included in the nav bar, and can be selected, in which case a short
message is displayed.
This commit is contained in:
Dandelion Mané 2018-05-08 17:05:56 -07:00 committed by GitHub
parent 0c59435a2b
commit ac8d0ff66c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 0 deletions

View File

@ -4,10 +4,12 @@ import React from "react";
import {BrowserRouter as Router, Route, NavLink} from "react-router-dom";
import ArtifactEditor from "../plugins/artifact/editor/App";
import CredExplorer from "./credExplorer/App";
export default class App extends React.Component<{}> {
render() {
const ARTIFACT_EDITOR_ROUTE = "/plugins/artifact/editor";
const CRED_EXPLORER_ROUTE = "/explorer";
return (
<Router>
<div>
@ -16,6 +18,9 @@ export default class App extends React.Component<{}> {
<li>
<NavLink to="/">Home</NavLink>
</li>
<li>
<NavLink to={CRED_EXPLORER_ROUTE}>Cred Explorer</NavLink>
</li>
<li>
<NavLink to={ARTIFACT_EDITOR_ROUTE}>Artifact Editor</NavLink>
</li>
@ -24,6 +29,7 @@ export default class App extends React.Component<{}> {
<hr />
<Route exact path="/" component={Home} />
<Route path={CRED_EXPLORER_ROUTE} component={CredExplorer} />
<Route path={ARTIFACT_EDITOR_ROUTE} component={ArtifactEditor} />
</div>
</Router>

View File

@ -0,0 +1,26 @@
// @flow
import React from "react";
import {StyleSheet, css} from "aphrodite/no-important";
type Props = {};
type State = {};
export default class App extends React.Component<Props, State> {
render() {
return (
<div>
<header className={css(styles.header)}>
<h1>Cred Explorer</h1>
</header>
<p>Welcome to the SourceCred Explorer!</p>
</div>
);
}
}
const styles = StyleSheet.create({
header: {
color: "#f0f",
},
});

View File

@ -0,0 +1,13 @@
// @flow
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
require("../testUtil").configureAphrodite();
// Check that PropTypes check out.
it("renders without crashing", () => {
const div = document.createElement("div");
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});