-
Notifications
You must be signed in to change notification settings - Fork 0
Teampage #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kwokwilliam
wants to merge
6
commits into
master
Choose a base branch
from
teampage
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Teampage #8
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
78148f0
create TeamPage.js and testing file
alliL 9ac635b
create TeamPage.css and TeamMember.js
alliL 1d692a9
TeamPage read from local json file
alliL d25f473
refactor to use React Hooks
alliL 940ef54
add team names at the top of the UI
alliL 4055b8c
imitate the blur effect with text on click
alliL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import React, {useState} from 'react'; | ||
| import Constants from '../../global_constants/Constants'; | ||
|
|
||
| /** | ||
| * @returns {React.Component} | ||
| */ | ||
| const TeamMember = props => { | ||
|
|
||
| let select = false; | ||
| for (let i = 0; i < props.person.teams.length; i++) { | ||
| if (props.filter == props.person.teams[i]) { | ||
| select = true; | ||
| } | ||
| } | ||
|
|
||
| let blur = <section>blur!</section> | ||
| if (select) { | ||
| blur = <section></section> | ||
| } | ||
|
|
||
| return <> | ||
| <div className="person"> | ||
| <section className="image"></section> | ||
| {blur} | ||
| <section className="person-name">{props.person.name}</section> | ||
| </div> | ||
| </>; | ||
| } | ||
|
|
||
| export default TeamMember; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| .header { | ||
| font-family: Arial, Helvetica, sans-serif; | ||
| margin-left: 2rem; | ||
| margin-top: 3rem; | ||
| } | ||
|
|
||
| body { | ||
| margin-left: auto; | ||
| margin-right: auto; | ||
| } | ||
|
|
||
| .team-members { | ||
| display: flex; | ||
| flex-direction: column; | ||
| } | ||
|
|
||
| .person { | ||
| background-color: blueviolet; | ||
| box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75); | ||
| max-width: 20rem; | ||
| max-height: 20rem; | ||
| padding: 2rem; | ||
| margin: 2rem; | ||
| } | ||
|
|
||
| .image { | ||
| padding-top: 15rem; | ||
| } | ||
|
|
||
| .person-name { | ||
| font-family: Arial, Helvetica, sans-serif; | ||
| text-align: center; | ||
| } | ||
|
|
||
| .team-members { | ||
| display: flex; | ||
| flex-direction: row; | ||
| flex-wrap: wrap; | ||
| } | ||
|
|
||
| .teams { | ||
| display: flex; | ||
| justify-content: space-evenly; | ||
| flex-wrap: wrap; | ||
| } | ||
|
|
||
| .col-xs { | ||
| flex: 1; | ||
| text-align: center; | ||
| padding: 0px 8px; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| import './TeamPage.css'; | ||
| import TeamMember from './TeamMember'; | ||
| import React, {useState, useEffect} from 'react'; | ||
| import Constants from '../../global_constants/Constants'; | ||
|
|
||
| /** | ||
| * @returns {React.Component} | ||
| */ | ||
| const TeamPage = () => { | ||
| const [teamMembers, setTeamMembers] = useState([]); | ||
| const [filter, setFilter] = useState('All'); | ||
| let data = require('./team_members.json'); | ||
|
|
||
|
|
||
| // const fetchData = () => { | ||
| // fetch('https://jsonplaceholder.typicode.com/posts') | ||
| // .then(response => { | ||
| // return response.json(); | ||
| // }) | ||
| // .then(people => { | ||
| // setLoadedPeople(people); | ||
| // }) | ||
| // .catch(err => { | ||
| // console.log(err); | ||
| // }); | ||
| // }; | ||
|
|
||
| useEffect(() => { | ||
| //fetchData(); | ||
| setTeamMembers(data); | ||
| }, []); | ||
|
|
||
| return <> | ||
| <h1 className="header">Meet the Team</h1> | ||
| <body> | ||
| <div className="teams"> | ||
| <seciton className="col-xs"> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
also we can probably use an array mapping here and abstract this to another class |
||
| <button onClick={() => setFilter('Adviser')}> | ||
| Adviser | ||
| </button> | ||
| </seciton> | ||
| <seciton className="col-xs"> | ||
| All | ||
| </seciton> | ||
| <seciton className="col-xs"> | ||
| <button onClick={() => setFilter('Business')}> | ||
| Business | ||
| </button> | ||
| </seciton> | ||
| <seciton className="col-xs"> | ||
| Collaborations | ||
| </seciton> | ||
| <seciton className="col-xs"> | ||
| Design | ||
| </seciton> | ||
| <seciton className="col-xs"> | ||
| Drylab | ||
| </seciton> | ||
| <seciton className="col-xs"> | ||
| Leadership | ||
| </seciton> | ||
| <seciton className="col-xs"> | ||
| Outreach | ||
| </seciton> | ||
| <seciton className="col-xs"> | ||
| PI | ||
| </seciton> | ||
| <seciton className="col-xs"> | ||
| Presenters | ||
| </seciton> | ||
| <seciton className="col-xs"> | ||
| Wetlab | ||
| </seciton> | ||
| <seciton className="col-xs"> | ||
| <button onClick={() => setFilter('Web Developer')}> | ||
| Web Development | ||
| </button> | ||
| </seciton> | ||
| </div> | ||
| <div className="team-members"> | ||
| {teamMembers.map(person => { | ||
| return <TeamMember key={person.id} person={person} filter={filter}/>; | ||
| })} | ||
| </div> | ||
| </body> | ||
| </>; | ||
| } | ||
|
|
||
| export default TeamPage; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| [ | ||
| { | ||
| "id": 1, | ||
| "name": "William Kwok", | ||
| "teams": [ | ||
| "All", | ||
| "DryLab Lead Engineer", | ||
| "Web Developer" | ||
| ], | ||
| "bio": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", | ||
| "linkedin": "https://www.linkedin.com", | ||
| "github": "https://github.com/" | ||
| }, | ||
| { | ||
| "id": 2, | ||
| "name": "Allison Lee", | ||
| "teams": [ | ||
| "All", | ||
| "Web Developer", | ||
| "Business" | ||
| ], | ||
| "bio": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", | ||
| "linkedin": "https://www.linkedin.com", | ||
| "github": "https://github.com/" | ||
| }, | ||
| { | ||
| "id": 3, | ||
| "name": "Elisa Truong", | ||
| "teams": [ | ||
| "All", | ||
| "Web Developer" | ||
| ], | ||
| "bio": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", | ||
| "linkedin": "https://www.linkedin.com", | ||
| "github": "https://github.com/" | ||
| }, | ||
| { | ||
| "id": 4, | ||
| "name": "Jennifer Tao", | ||
| "teams": [ | ||
| "All", | ||
| "Web Developer" | ||
| ], | ||
| "bio": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", | ||
| "linkedin": "https://www.linkedin.com", | ||
| "github": "https://github.com/" | ||
| }, | ||
| { | ||
| "id": 5, | ||
| "name": "Laura Lan", | ||
| "teams": [ | ||
| "All", | ||
| "Web Developer" | ||
| ], | ||
| "bio": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", | ||
| "linkedin": "https://www.linkedin.com", | ||
| "github": "https://github.com/" | ||
| }, | ||
| { | ||
| "id": 6, | ||
| "name": "Nitesh Chetry", | ||
| "teams": [ | ||
| "All", | ||
| "Web Developer" | ||
| ], | ||
| "bio": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", | ||
| "linkedin": "https://www.linkedin.com", | ||
| "github": "https://github.com/" | ||
| }, | ||
| { | ||
| "id": 7, | ||
| "name": "Max Zhou", | ||
| "teams": [ | ||
| "All", | ||
| "Web Developer" | ||
| ], | ||
| "bio": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", | ||
| "linkedin": "https://www.linkedin.com", | ||
| "github": "https://github.com/" | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| const withCSS = require('@zeit/next-css'); | ||
| module.exports = withCSS(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,27 @@ | ||
| <!DOCTYPE html><html><head><meta charSet="utf-8" class="next-head"/><link rel="preload" href="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/index.js" as="script"/><link rel="preload" href="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_app.js" as="script"/><link rel="preload" href="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_error.js" as="script"/><link rel="preload" href="/_next/static/runtime/webpack-2ef50c24cc8d478adafc.js" as="script"/><link rel="preload" href="/_next/static/chunks/commons.0bf2432a355909b63c2d.js" as="script"/><link rel="preload" href="/_next/static/runtime/main-1b9d4cd959544e57ca51.js" as="script"/></head><body><div id="__next"><div>Next js home page</div><a href="/about/">Go to about page</a></div><script>__NEXT_DATA__ = {"props":{"pageProps":{}},"page":"/","query":{},"buildId":"4x9RYfaf8w4ta7Qrpx8Cg","nextExport":true};__NEXT_LOADED_PAGES__=[];__NEXT_REGISTER_PAGE=function(r,f){__NEXT_LOADED_PAGES__.push([r, f])}</script><script async="" id="__NEXT_PAGE__/" src="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/index.js"></script><script async="" id="__NEXT_PAGE__/_app" src="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_app.js"></script><script async="" id="__NEXT_PAGE__/_error" src="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_error.js"></script><script src="/_next/static/runtime/webpack-2ef50c24cc8d478adafc.js" async=""></script><script src="/_next/static/chunks/commons.0bf2432a355909b63c2d.js" async=""></script><script src="/_next/static/runtime/main-1b9d4cd959544e57ca51.js" async=""></script></body></html> | ||
| <!DOCTYPE html> | ||
| <html> | ||
|
|
||
| <head> | ||
| <meta charSet="utf-8" class="next-head" /> | ||
| <link rel="preload" href="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/index.js" as="script" /> | ||
| <link rel="preload" href="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_app.js" as="script" /> | ||
| <link rel="preload" href="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_error.js" as="script" /> | ||
| <link rel="preload" href="/_next/static/runtime/webpack-2ef50c24cc8d478adafc.js" as="script" /> | ||
| <link rel="preload" href="/_next/static/chunks/commons.0bf2432a355909b63c2d.js" as="script" /> | ||
| <link rel="preload" href="/_next/static/runtime/main-1b9d4cd959544e57ca51.js" as="script" /> | ||
| </head> | ||
|
|
||
| <body> | ||
| <div id="__next"> | ||
| <div>Next js home page</div><a href="/about/">Go to about page</a> | ||
| </div> | ||
| <script>__NEXT_DATA__ = { "props": { "pageProps": {} }, "page": "/", "query": {}, "buildId": "4x9RYfaf8w4ta7Qrpx8Cg", "nextExport": true }; __NEXT_LOADED_PAGES__ = []; __NEXT_REGISTER_PAGE = function (r, f) { __NEXT_LOADED_PAGES__.push([r, f]) }</script> | ||
| <script async="" id="__NEXT_PAGE__/" src="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/index.js"></script> | ||
| <script async="" id="__NEXT_PAGE__/_app" src="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_app.js"></script> | ||
| <script async="" id="__NEXT_PAGE__/_error" src="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_error.js"></script> | ||
| <script src="/_next/static/runtime/webpack-2ef50c24cc8d478adafc.js" async=""></script> | ||
| <script src="/_next/static/chunks/commons.0bf2432a355909b63c2d.js" async=""></script> | ||
| <script src="/_next/static/runtime/main-1b9d4cd959544e57ca51.js" async=""></script> | ||
| </body> | ||
|
|
||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,27 @@ | ||
| <!DOCTYPE html><html><head><meta charSet="utf-8" class="next-head"/><link rel="preload" href="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/index.js" as="script"/><link rel="preload" href="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_app.js" as="script"/><link rel="preload" href="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_error.js" as="script"/><link rel="preload" href="/_next/static/runtime/webpack-2ef50c24cc8d478adafc.js" as="script"/><link rel="preload" href="/_next/static/chunks/commons.0bf2432a355909b63c2d.js" as="script"/><link rel="preload" href="/_next/static/runtime/main-1b9d4cd959544e57ca51.js" as="script"/></head><body><div id="__next"><div>Next js home page</div><a href="/about/">Go to about page</a></div><script>__NEXT_DATA__ = {"props":{"pageProps":{}},"page":"/index","query":{},"buildId":"4x9RYfaf8w4ta7Qrpx8Cg","nextExport":true};__NEXT_LOADED_PAGES__=[];__NEXT_REGISTER_PAGE=function(r,f){__NEXT_LOADED_PAGES__.push([r, f])}</script><script async="" id="__NEXT_PAGE__/index" src="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/index.js"></script><script async="" id="__NEXT_PAGE__/_app" src="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_app.js"></script><script async="" id="__NEXT_PAGE__/_error" src="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_error.js"></script><script src="/_next/static/runtime/webpack-2ef50c24cc8d478adafc.js" async=""></script><script src="/_next/static/chunks/commons.0bf2432a355909b63c2d.js" async=""></script><script src="/_next/static/runtime/main-1b9d4cd959544e57ca51.js" async=""></script></body></html> | ||
| <!DOCTYPE html> | ||
| <html> | ||
|
|
||
| <head> | ||
| <meta charSet="utf-8" class="next-head" /> | ||
| <link rel="preload" href="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/index.js" as="script" /> | ||
| <link rel="preload" href="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_app.js" as="script" /> | ||
| <link rel="preload" href="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_error.js" as="script" /> | ||
| <link rel="preload" href="/_next/static/runtime/webpack-2ef50c24cc8d478adafc.js" as="script" /> | ||
| <link rel="preload" href="/_next/static/chunks/commons.0bf2432a355909b63c2d.js" as="script" /> | ||
| <link rel="preload" href="/_next/static/runtime/main-1b9d4cd959544e57ca51.js" as="script" /> | ||
| </head> | ||
|
|
||
| <body> | ||
| <div id="__next"> | ||
| <div>Next js home page</div><a href="/about/">Go to about page</a> | ||
| </div> | ||
| <script>__NEXT_DATA__ = { "props": { "pageProps": {} }, "page": "/index", "query": {}, "buildId": "4x9RYfaf8w4ta7Qrpx8Cg", "nextExport": true }; __NEXT_LOADED_PAGES__ = []; __NEXT_REGISTER_PAGE = function (r, f) { __NEXT_LOADED_PAGES__.push([r, f]) }</script> | ||
| <script async="" id="__NEXT_PAGE__/index" src="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/index.js"></script> | ||
| <script async="" id="__NEXT_PAGE__/_app" src="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_app.js"></script> | ||
| <script async="" id="__NEXT_PAGE__/_error" src="/_next/static/4x9RYfaf8w4ta7Qrpx8Cg/pages/_error.js"></script> | ||
| <script src="/_next/static/runtime/webpack-2ef50c24cc8d478adafc.js" async=""></script> | ||
| <script src="/_next/static/chunks/commons.0bf2432a355909b63c2d.js" async=""></script> | ||
| <script src="/_next/static/runtime/main-1b9d4cd959544e57ca51.js" async=""></script> | ||
| </body> | ||
|
|
||
| </html> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should use
.forEachhere instead.I don't know if I mentioned this before, but I actually got asked on an interview once when starting to use a
for int i = 0 i < etcloop if I knew how to useforEachloops and I had to convince my interviewer that I knew how to use it effectively but was just choosing to use the other method during the interview.