Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ yarn-debug.log*
yarn-error.log*

# Editors
.chrome
.vscode/*
!.vscode/launch.json
.tm_properties
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceRoot}/src",
"userDataDir": "${workspaceRoot}/.chrome",
"sourceMapPathOverrides": {
"webpack:///./src/*": "${webRoot}/*"
}
}
]
}
2 changes: 0 additions & 2 deletions README.old.md

This file was deleted.

21 changes: 15 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
{
"name": "frontend-prototype",
"name": "frontend-prototype-ts",
"version": "0.1.0",
"private": true,
"dependencies": {
"@types/jest": "^19.2.3",
"@types/node": "^7.0.18",
"@types/react": "^15.0.24",
"@types/react-dom": "^15.5.0",
"@types/react-redux": "^4.4.40",
"@types/react-router-dom": "^4.0.4",
"@types/react-router-redux": "^5.0.1",
"@types/redux": "^3.6.0",
"glamor": "^2.20.24",
"glamorous": "^3.13.0",
"react": "^15.5.4",
Expand All @@ -13,12 +21,13 @@
"redux": "^3.6.0"
},
"devDependencies": {
"react-scripts": "0.9.5"
"react-scripts-ts": "1.3.0",
"typescript": "next"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
"start": "react-scripts-ts start",
"build": "react-scripts-ts build",
"test": "react-scripts-ts test --env=jsdom",
"eject": "react-scripts-ts eject"
}
}
3 changes: 2 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Democratizr</title>
<script>document.title='Loading…';</script>
</head>
<body>
<div id="root"></div>
Expand Down
86 changes: 0 additions & 86 deletions src/components/App.js

This file was deleted.

88 changes: 88 additions & 0 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import glamorous, { ThemeProvider } from 'glamorous';
import * as React from 'react';
import { Switch } from 'react-router-dom';
import { Provider } from 'react-redux';
import { applyMiddleware, createStore } from 'redux';

import AppMenu from './AppMenu';
import AppRouter, { middleware as historyMiddleware } from './AppRouter';
import Footer from './Footer';
import Header from './Header';
import Route from './Route';
import { Config, Route as RouteConfig } from '../config';
import reducer from '../reducers';
import { percent, rem } from '../styles/sizes';


const store = createStore(reducer, applyMiddleware(historyMiddleware));

const AppOuter = glamorous.div({
height: percent(100)
});

const StyledAppInner = glamorous.div({
display: 'flex',
flexDirection: 'column',
minHeight: percent(100)
});

const AppHeader = glamorous(Header)({
flexShrink: 0
});

const AppBody = glamorous.div({
display: 'flex',
flexDirection: 'column',
flex: 1
});

const AppFooter = glamorous(Footer)({
marginTop: rem(1)
});

type AppInnerProps = {
routes: RouteConfig[]
};

const AppInner = ({ routes }: AppInnerProps) => {
return (
<AppRouter>
<StyledAppInner>
<AppHeader />
<AppMenu />
<AppBody>
<Switch>
{routes.map(route => (
// `route.path` is undefined for the NotFound route, but that's not a valid React key.
<Route key={route.path || ''} {...route} />
))}
</Switch>
</AppBody>
<AppFooter />
</StyledAppInner>
</AppRouter>
);
};

type Props = {
config: Config
};

const App = ({ config }: Props) => {
const {
routes,
theme
} = config;

return (
<Provider store={store}>
<ThemeProvider theme={theme}>
<AppOuter>
<AppInner routes={routes} />
</AppOuter>
</ThemeProvider>
</Provider>
);
};

export default App;
71 changes: 0 additions & 71 deletions src/components/AppMenu.js

This file was deleted.

Loading