Skip to content

Commit

Permalink
Merge pull request #2 from Le-Cache/eileen-cuevas
Browse files Browse the repository at this point in the history
adds new components; adds data for users
  • Loading branch information
daisymesa authored Jan 2, 2020
2 parents 8244193 + 68b0288 commit d9f0901
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 6 deletions.
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"axios": "^0.19.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.3.0"
Expand Down
47 changes: 41 additions & 6 deletions client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,47 @@
import React from 'react';
import axios from 'axios';
import CardsContainer from './components/main/cardsContainer';
import './App.css';

function App() {
return (
<div className="App">
<p>Hello</p>
</div>
);
/*
App
-Sidebar
--Logo (not a component)
--Tract Selection Filter...thing
--Navigation (About, Airtable, Slack)
-Main Card Thing
--Cards Component (house all the cards/introduce pagination)
---Individual card component
*/

class App extends React.Component {
constructor() {
super();
this.state = {
users: ''
};
}

componentDidMount() {
axios
.get(
'https://api.airtable.com/v0/appaTBcrHMzJR6ZnS/lecache?api_key=keyXAJzv0BQkXWbI8'
)
.then(res => {
console.log(res.data.records);
this.setState({ users: res.data.records });
// console.log(res.data.records[0].fields['First Name']);
})
.catch(error => console.log(error));
}

render() {
return (
<div className="App">
<CardsContainer users={this.state.users} />
</div>
);
}
}

export default App;
18 changes: 18 additions & 0 deletions client/src/components/main/cardsContainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import UserCard from './userCard';

const CardsContainer = props => {
if (props.users.length) {
return (
<div>
{props.users.map((user, index) => (
<UserCard key={index} data={user.fields} />
))}
</div>
);
} else {
return <div>Loading...</div>;
}
};

export default CardsContainer;
37 changes: 37 additions & 0 deletions client/src/components/main/userCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';

const UserCard = props => {
/*Field Names*/
const firstName = 'First Name';
const lastName = 'Last Name';
const program = 'Which program are you in?';
const bio = 'Bio';
const linkedIn = 'LinkedIn URL';
const twitter = 'Twitter URL';
const github = 'GitHub URL';
const portfolio = 'Portfolio URL';
const location = 'Where are you located?';
const profilePic = 'Profile Picture';

return (
<div>
{props.data[profilePic] ? (
<img src={props.data[profilePic][0].url} />
) : (
<></>
)}
<p>
{props.data[firstName]} {props.data[lastName]}
</p>
<p>{props.data[program]}</p>
<p>{props.data[location]}</p>
<p>{props.data[bio]}</p>
<p>{props.data[linkedIn]}</p>
{props.data[twitter] ? <p>{props.data[twitter]}</p> : <></>}
{props.data[github] ? <p>{props.data[github]}</p> : <></>}
{props.data[portfolio] ? <p>{props.data[portfolio]}</p> : <></>}
</div>
);
};

export default UserCard;
Empty file.
Empty file.
27 changes: 27 additions & 0 deletions client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,14 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.0.tgz#24390e6ad61386b0a747265754d2a17219de862c"
integrity sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A==

axios@^0.19.0:
version "0.19.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.0.tgz#8e09bff3d9122e133f7b8101c8fbdd00ed3d2ab8"
integrity sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==
dependencies:
follow-redirects "1.5.10"
is-buffer "^2.0.2"

axobject-query@^2.0.2:
version "2.1.1"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.1.1.tgz#2a3b1271ec722d48a4cd4b3fcc20c853326a49a7"
Expand Down Expand Up @@ -3234,6 +3242,13 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.8, debug@^2.6.
dependencies:
ms "2.0.0"

debug@=3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
dependencies:
ms "2.0.0"

debug@^3.0.0, debug@^3.1.1, debug@^3.2.5, debug@^3.2.6:
version "3.2.6"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
Expand Down Expand Up @@ -4276,6 +4291,13 @@ flush-write-stream@^1.0.0:
inherits "^2.0.3"
readable-stream "^2.3.6"

follow-redirects@1.5.10:
version "1.5.10"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a"
integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==
dependencies:
debug "=3.1.0"

follow-redirects@^1.0.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.9.0.tgz#8d5bcdc65b7108fe1508649c79c12d732dcedb4f"
Expand Down Expand Up @@ -5133,6 +5155,11 @@ is-buffer@^1.0.2, is-buffer@^1.1.5:
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==

is-buffer@^2.0.2:
version "2.0.4"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.4.tgz#3e572f23c8411a5cfd9557c849e3665e0b290623"
integrity sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==

is-callable@^1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75"
Expand Down

0 comments on commit d9f0901

Please sign in to comment.