Skip to content

Commit 5b0ee6b

Browse files
committed
wip router, reducer and services being built
1 parent 96f04ca commit 5b0ee6b

14 files changed

+249
-23
lines changed

.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
REACT_APP_FIREBASE_CONFIG_JSON = '{"apiKey": "AIzaSyDKVx23-RXumPuqP0fOd04VFJAwh8bzfok", "authDomain": "access2justice-222101.firebaseapp.com", "databaseURL": "https://access2justice-222101.firebaseio.com", "messagingSenderId": "494375994655", "projectId": "access2justice-222101","storageBucket": ""}'

package-lock.json

+117-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"firebase": "^5.7.2",
77
"react": "^16.7.0",
88
"react-dom": "^16.7.0",
9+
"react-router-dom": "^4.3.1",
910
"react-scripts-ts": "4.0.8",
1011
"redux": "^4.0.1",
1112
"rxjs": "^6.3.3"
@@ -21,9 +22,10 @@
2122
"@types/node": "^10.12.18",
2223
"@types/react": "^16.7.18",
2324
"@types/react-dom": "^16.0.11",
25+
"@types/react-router-dom": "^4.3.1",
2426
"@types/firebase": "^3.2.1",
2527
"node-sass": "^4.11.0",
26-
"tachyons": "^4.10.0",
28+
"tachyons": "^4.11.1",
2729
"typescript": "^3.2.2"
2830
},
2931
"browserslist": [

public/static/images/tclc_logo.png

62.2 KB
Loading
12.8 KB
Loading

src/App.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import App from './App';
44

55
it('renders without crashing', () => {
66
const div = document.createElement('div');
7-
ReactDOM.render(<App />, div);
7+
ReactDOM.render(<App tiles={['test', 'foo']}/>, div);
88
ReactDOM.unmountComponentAtNode(div);
99
});

src/App.tsx

+36-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,50 @@
1+
/* tslint:disable:no-console jsx-no-lambda */
12
import * as React from 'react';
2-
import { LoginComponent } from "./components/login/login.component";
33
import { NavComponent } from "./components/nav/nav.component";
4+
import { RoutesComponent } from "./router/routes.component";
45

56
import './App.scss';
67

7-
class App extends React.Component {
8+
export interface IAppProps {
9+
tiles: string[];
10+
}
11+
12+
export interface IAppState {
13+
activeTile: string;
14+
logedIn: boolean;
15+
}
16+
17+
class App extends React.Component<IAppProps, IAppState> {
18+
19+
public state: IAppState = {
20+
activeTile: 'dashboard',
21+
login: false
22+
};
23+
24+
25+
constructor(public props: IAppProps) {
26+
super(props);
27+
this.navigationHandler = this.navigationHandler.bind(this);
28+
}
29+
30+
public navigationHandler(name: string): void {
31+
switch(name) {
32+
case'login':
33+
34+
}
35+
}
36+
837
public render() {
938
return (
1039
<div className="App">
1140
<nav className="nav-container">
12-
<NavComponent/>
41+
<NavComponent tiles={this.props.tiles}
42+
active={this.state.activeTile}
43+
navigationHandler={this.navigationHandler} />
1344
</nav>
1445
<main className="content-container">
15-
<LoginComponent/>
46+
{process.env.REACT_APP_FIREBASE_CONFIG_JSON}
47+
<RoutesComponent/>
1648
</main>
1749
</div>
1850
);

src/commons/svg.list.tsx

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
import * as React from 'react';
22

33
export const SVGs = {
4-
google: () => (
4+
dashboard:
5+
<svg id="icon-meter2" viewBox="0 0 32 32">
6+
<title>meter2</title>
7+
<path d="M16 0c-8.837 0-16 7.163-16 16s7.163 16 16 16 16-7.163 16-16-7.163-16-16-16zM9.464 26.067c0.347-0.957 0.536-1.99 0.536-3.067 0-3.886-2.463-7.197-5.913-8.456 0.319-2.654 1.508-5.109 3.427-7.029 2.267-2.266 5.28-3.515 8.485-3.515s6.219 1.248 8.485 3.515c1.92 1.92 3.108 4.375 3.428 7.029-3.45 1.26-5.913 4.57-5.913 8.456 0 1.077 0.189 2.11 0.536 3.067-1.928 1.258-4.18 1.933-6.536 1.933s-4.608-0.675-6.536-1.933zM17.242 20.031c0.434 0.109 0.758 0.503 0.758 0.969v2c0 0.55-0.45 1-1 1h-2c-0.55 0-1-0.45-1-1v-2c0-0.466 0.324-0.86 0.758-0.969l0.742-14.031h1l0.742 14.031z"/>
8+
</svg>,
9+
documents:
10+
<svg id="icon-documents" viewBox="0 0 32 32">
11+
<title>documents</title>
12+
<path d="M8.997 3c0.007-1.106 0.904-2 2.011-2h9.991v6.002c0 1.111 0.898 1.998 2.006 1.998h4.994v17.003c0 1.107-0.894 1.997-1.997 1.997-0.007 1.106-0.899 2-2 2-0.007 1.106-0.899 2-2 2h-15.005c-1.107 0-1.997-0.899-1.997-2.007v-22.985c0-1.109 0.894-2.007 1.997-2.007 0.003-1.102 0.897-2 2-2v0zM7 27.993l-0-21.993c-0.552 0-1 0.455-1 0.995v23.009c0 0.55 0.455 0.995 1 0.995h15c0.552 0 1-0.455 1-0.995l-14.003-0.005c-1.107 0-1.997-0.899-1.997-2.007zM8 4.995v23.009c0 0.55 0.455 0.995 1 0.995h15c0.552 0 1-0.455 1-0.995l-14.003-0.005c-1.107 0-1.997-0.899-1.997-2.007v-21.993c-0.552 0-1 0.455-1 0.995v0zM22 1v5.997c0 0.554 0.451 1.003 0.991 1.003h5.009l-6-7z"/>
13+
</svg>,
14+
google:
515
<svg id="icon-google" viewBox="0 0 32 32">
616
<title>google</title>
717
<path fill="#4285f4" d="M16.32 13.713v5.487h9.075c-0.367 2.353-2.741 6.899-9.075 6.899-5.46 0-9.919-4.519-9.919-10.099s4.46-10.099 9.919-10.099c3.107 0 5.188 1.319 6.38 2.465l4.339-4.184c-2.787-2.601-6.4-4.183-10.719-4.183-8.847 0-16 7.153-16 16s7.153 16 16 16c9.235 0 15.36-6.492 15.36-15.635 0-1.051-0.113-1.853-0.252-2.652h-15.108z"/>
18+
</svg>,
19+
profiles:
20+
<svg id="icon-profiles" viewBox="0 0 36 32">
21+
<title>profiles</title>
22+
<path d="M24 24.082v-1.649c2.203-1.241 4-4.337 4-7.432 0-4.971 0-9-6-9s-6 4.029-6 9c0 3.096 1.797 6.191 4 7.432v1.649c-6.784 0.555-12 3.888-12 7.918h28c0-4.030-5.216-7.364-12-7.918z"/>
23+
<path d="M10.225 24.854c1.728-1.13 3.877-1.989 6.243-2.513-0.47-0.556-0.897-1.176-1.265-1.844-0.95-1.726-1.453-3.627-1.453-5.497 0-2.689 0-5.228 0.956-7.305 0.928-2.016 2.598-3.265 4.976-3.734-0.529-2.39-1.936-3.961-5.682-3.961-6 0-6 4.029-6 9 0 3.096 1.797 6.191 4 7.432v1.649c-6.784 0.555-12 3.888-12 7.918h8.719c0.454-0.403 0.956-0.787 1.506-1.146z"/>
824
</svg>
9-
)
1025
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import * as React from 'react';
2+
3+
export const Dashboard = () => <h1>Welcome!</h1>;

src/components/login/login.component.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { SVGs } from "../../commons/svg.list";
55

66
import './login.style.scss';
77

8-
98
export class LoginComponent extends React.Component {
109
private _FB: FirebaseService = new FirebaseService();
1110

@@ -15,7 +14,7 @@ export class LoginComponent extends React.Component {
1514
<h1>Please Login</h1>
1615
<button className="Button--GoogleSignIn no-underline near-white bg-animate bg-dark-blue hover-bg-gray inline-flex items-center ma2 tc br2 pa0" onClick={this._FB.signInWithGoogle}>
1716
<div className="dib h3 w3 pa1 bg-white">
18-
{SVGs.google()}
17+
{SVGs.google}
1918
</div>
2019
<span className="f6 ml3 pr2">
2120
Sign in with Google
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import * as React from 'react';
2+
3+
import {SVGs} from "../../commons/svg.list";
4+
5+
export const NavTileComponent = (props: {name: string, active: boolean, handler: (name: string) => void }) => {
6+
7+
const className = () => {
8+
const baseClass = 'nav-tile_' + props.name;
9+
return props.active ? baseClass.concat(' active') : baseClass;
10+
};
11+
12+
return (
13+
<div className={className()}>
14+
{SVGs[props.name]}
15+
<span className="nav-tile--label">{props.name}</span>
16+
</div>
17+
);
18+
};

src/components/nav/nav.component.tsx

+20-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
11
import * as React from 'react';
2+
import { NavTileComponent } from "./nav-tile.component";
23

34
import './nav.style.scss';
45

5-
export class NavComponent extends React.Component {
6-
public render() {
6+
export interface INavComponentProps {
7+
navigationHandler: (name: string) => void;
8+
active: string
9+
tiles: string[];
10+
}
11+
12+
export const NavComponent = (props: INavComponentProps) => {
13+
14+
// noinspection HtmlUnknownTarget
715
return(
816
<div className="navigation-wrapper">
9-
<div>Logo</div>
17+
<img src="./static/images/TCLC_Profiles.png" alt="The Commons Law Center Logo" />
1018
<div>Dashboard</div>
11-
<div>Documents</div>
12-
<div>Profiles</div>
19+
{props.tiles.map(name => {
20+
return (
21+
<NavTileComponent name={name}
22+
handler={props.navigationHandler}
23+
active={props.active === name}
24+
key={name+'Tile'}/>
25+
);
26+
})}
1327
</div>
1428
)
15-
}
16-
17-
}
29+
};

0 commit comments

Comments
 (0)