Skip to content

Commit

Permalink
adds profile page
Browse files Browse the repository at this point in the history
related #21 #23
  • Loading branch information
des-des committed Jan 17, 2019
1 parent 7514d4a commit 5aa00e1
Show file tree
Hide file tree
Showing 14 changed files with 373 additions and 134 deletions.
29 changes: 28 additions & 1 deletion client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import React, { Component } from "react";
import { BrowserRouter as Router, Route } from "react-router-dom";

import { Home, GithubCallback, DeveloperDashboard } from "./pages";
import {
Home,
GithubCallback,
DeveloperDashboard,
DeveloperProfile
} from "./pages";

import FetchData from "./components/FetchData";

Expand Down Expand Up @@ -31,6 +36,24 @@ class App extends Component {
);
};

renderDeveloperProfile = routerProps => {
const {
match: {
params: { profileId }
}
} = routerProps;
return (
<FetchData
method="get"
url={`/api/profile/${profileId}`}
renderPending={this.renderPending}
renderError={this.renderError}
>
{profile => <DeveloperProfile profile={profile} />}
</FetchData>
);
};

renderHome = () => {
return (
<FetchData
Expand Down Expand Up @@ -58,6 +81,10 @@ class App extends Component {
path="/developer-dashboard"
render={this.renderDeveloperDashboard}
/>
<Route
path="/profile/:profileId"
render={this.renderDeveloperProfile}
/>
<Route exact path="/" render={this.renderHome} />
</main>
</Router>
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/EditableInput.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import AutosizeInput from "react-input-autosize";

import { CLASS_NAME_INPUT_SPACING } from "../constants/typeographyClassNames";
export default class EditableInput extends React.Component {
constructor() {
super();
Expand Down Expand Up @@ -54,7 +54,7 @@ export default class EditableInput extends React.Component {
</React.Fragment>
) : (
<span
className={`db ba bw1 b--white ph2 pv0 ${className}`}
className={`${CLASS_NAME_INPUT_SPACING} ${className}`}
onClick={this.onFocus}
onFocus={this.onFocus}
tabIndex="0"
Expand Down
76 changes: 76 additions & 0 deletions client/src/components/PaperText.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import React from "react";
import AutosizeInput from "react-input-autosize";
import { CLASS_NAME_INPUT_SPACING } from "../constants/typeographyClassNames";
export default class PaperText extends React.Component {
constructor() {
super();

this.state = {
focused: false
};

this.onFocus = this.onFocus.bind(this);
this.onBlur = this.onBlur.bind(this);
}

onFocus(e) {
if (this.props.enabled) {
this.setState({
focused: true
});
e.preventDefault();
e.stopProgagation();
}
}

onBlur(e) {
if (this.props.enabled) {
this.setState({
focused: false
});
e.preventDefault();
e.stopProgagation();
}
}

render() {
const {
props: { className, value },
state: { focused }
} = this;

return (
<div className="mv0 dib">
{focused ? (
<React.Fragment>
<AutosizeInput
value={value}
autoComplete="off"
autoFocus
inputStyle={{
fontFamily: "inherit"
}}
type="text"
name={this.props.name}
onChange={this.props.onChange}
onBlur={this.onBlur}
inputClassName={`mw-100 db input-reset outline-0 ba bw1 b--black ph2 pv0 ${className}`}
onKeyDown={e => {
if (e.key === "Enter") this.onBlur();
}}
/>
</React.Fragment>
) : (
<span
className={`${CLASS_NAME_INPUT_SPACING} ${className}`}
onClick={this.onFocus}
onFocus={this.onFocus}
tabIndex="0"
>
{value}
</span>
)}
</div>
);
}
}
7 changes: 7 additions & 0 deletions client/src/components/profile/EmploymentHistoryWrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from "react";

export default ({ children, ...attrs }) => (
<div className="tl mb4" {...attrs}>
{children}
</div>
);
8 changes: 8 additions & 0 deletions client/src/components/profile/H2EmploymentHistory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from "react";
import { CLASS_NAME_H2 } from "../../constants/typeographyClassNames";

export default ({ children }) => (
<h2 className={`tl ma0 pa2 ba bw1 b--white ${CLASS_NAME_H2}`}>
Employment History
</h2>
);
9 changes: 9 additions & 0 deletions client/src/components/profile/ProfileWrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";

export default ({ children }) => (
<div className="tc">
<div className="bl bw05 min-vh-100 b--light-gray w-50 dib pa3">
{children}
</div>
</div>
);
3 changes: 3 additions & 0 deletions client/src/components/profile/ResponsibilitiesList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import React from "react";

export default ({ children }) => <ul className="mh0 mv2 pv0">{children}</ul>;
8 changes: 8 additions & 0 deletions client/src/components/profile/ResponsibilitiesListItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from "react";
import { CLASS_NAME_TEXT_SMALL } from "../../constants/typeographyClassNames";

export default ({ children, ...attrs }) => (
<li {...attrs} className={`mv1 pv0 ${CLASS_NAME_TEXT_SMALL}`}>
{children}
</li>
);
7 changes: 7 additions & 0 deletions client/src/constants/typeographyClassNames.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const CLASS_NAME_H1 = "f3 black";
export const CLASS_NAME_H1_SUB = "f6 mid-gray";
export const CLASS_NAME_H2 = "f5 bold black";
export const CLASS_NAME_H3 = "f5 black";
export const CLASS_NAME_H3_SUB = "f6 mid-gray";
export const CLASS_NAME_TEXT_SMALL = "f6 black";
export const CLASS_NAME_INPUT_SPACING = "db ba bw1 b--white ph2 pv0";
Loading

0 comments on commit 5aa00e1

Please sign in to comment.