Skip to content
This repository has been archived by the owner on May 28, 2023. It is now read-only.

Render mentors #107

Merged
merged 8 commits into from
Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from 4 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
11 changes: 11 additions & 0 deletions data/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { pluck, flatten, uniqWith, eqProps } from 'ramda';
import projects from './repositories.json';

const getMentors = () => {
const mentors = flatten(pluck('mentors', projects.repositories));
const uniqueMentors = uniqWith(eqProps('name'))(mentors);

return uniqueMentors;
};

export default getMentors;
80 changes: 71 additions & 9 deletions data/repositories.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,101 @@
"repositories": [
{
"name": "calluswhatyouwant/spotify-web-sdk",
"difficulty": "avancado"
"difficulty": "avancado",
"mentors": [
{
"name": "Jose Robson",
"imgUrl": "https://avatars1.githubusercontent.com/u/20714148?s=460&v=4"
},
{
"name": "Jose Renan",
"imgUrl": "https://avatars3.githubusercontent.com/u/11728746?s=460&v=4"
fanny marked this conversation as resolved.
Show resolved Hide resolved
}
]
},
{
"name": "calluswhatyouwant/musicritic",
"difficulty": "avancado"
"difficulty": "avancado",
"mentors": [
{
"name": "Jose Robson",
"imgUrl": "https://avatars1.githubusercontent.com/u/20714148?s=460&v=4"
},
{
"name": "Jose Renan",
"imgUrl": "https://avatars3.githubusercontent.com/u/11728746?s=460&v=4"
}
]
},
{
"name": "paulojbleitao/pokedex",
"difficulty": "intermediario"
"difficulty": "intermediario",
"mentors": [
{
"name": "Paulo Leitao",
"imgUrl": "https://avatars3.githubusercontent.com/u/25506387?s=460&v=4"
}
]
},
{
"name": "SubmiBot/SubmiBot",
"difficulty": "intermediario"
"difficulty": "intermediario",
"mentors": [
{
"name": "Hericles Emanuel",
"imgUrl": "https://avatars1.githubusercontent.com/u/30700596?s=460&v=4"
}
]
},
{
"name": "marianabianca/pomodoro",
"difficulty": "iniciante"
"difficulty": "iniciante",
"mentors": [
{
"name": "Mariana Bianca",
"imgUrl": "https://avatars0.githubusercontent.com/u/23522997?s=460&v=4"
}
]
},
{
"name": "P-Sync/P-Sync",
"difficulty": "intermediario"
"difficulty": "intermediario",
"mentors": [
{
"name": "Hericles Emanuel",
"imgUrl": "https://avatars1.githubusercontent.com/u/30700596?s=460&v=4"
}
]
},
{
"name": "FelipeMarinho97/iskra-webkit-greeter",
"difficulty": "intermediario"
"difficulty": "intermediario",
"mentors": [
{
"name": "Felipe Marinho",
"imgUrl": "https://avatars2.githubusercontent.com/u/20695061?s=460&v=4"
}
]
},
{
"name": "Rickecr/PyGraph",
"difficulty": "intermediario"
"difficulty": "intermediario",
"mentors": [
{
"name": "Ricke",
"imgUrl": "https://avatars1.githubusercontent.com/u/25726888?s=400&v=4"
}
]
},
{
"name": "Rickecr/CamaraDosDeputados",
"difficulty": "iniciante"
"difficulty": "iniciante",
"mentors": [
{
"name": "Ricke",
"imgUrl": "https://avatars1.githubusercontent.com/u/25726888?s=400&v=4"
}
]
}
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"mini-css-extract-plugin": "^0.4.4",
"prettier": "^1.14.3",
"pretty-quick": "^1.8.0",
"ramda": "^0.26.1",
"react-dev-utils": "^6.1.1",
"style-loader": "^0.23.1",
"url-loader": "^2.2.0",
Expand Down
1 change: 1 addition & 0 deletions src/components/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const AppHeader = () => (
<HeaderWrapperNavLinks>
<HeaderNavLink to="/quem-somos">Quem Somos?</HeaderNavLink>
<HeaderNavLink to="/junte-se">Junte-se!</HeaderNavLink>
<HeaderNavLink to="/mentores">Mentores</HeaderNavLink>
</HeaderWrapperNavLinks>
</Header>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/app/Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { Switch, Route } from 'react-router-dom';
import ProjectsPage from '../projects/ProjectsPage';
import JoinUsPage from '../joinus/JoinUsPage';
import TeamPage from '../team/TeamPage';
import MentorGrid from '../mentors/MentorGrid';

const Routes = () => (
<Switch>
<Route exact path="/" component={ProjectsPage} />
<Route path="/quem-somos" render={TeamPage} />
<Route path="/junte-se" component={JoinUsPage} />
<Route path="/mentores" component={MentorGrid} />
</Switch>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@
visibility: visible;
opacity: 1;
}

.mentors {
display: flex;
flex-wrap: wrap;
}
15 changes: 2 additions & 13 deletions src/components/mentors/MentorCard.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
// @flow
import React from 'react';
import type { Repository } from '../commons/repository/repository';
import type { Mentor as MentorCardProps } from './mentor';

import './MentorCard.css';
import './Mentor.css';

const renderRepositories = (repositoriesList: Repository[]) =>
repositoriesList.map(repository => (
<li className="repository-mentor" key={repository.nameWithOwner}>
{repository.nameWithOwner}
</li>
));

const MentorCard = ({ name, imgUrl, repositoriesList }: MentorCardProps) => (
const MentorCard = ({ name, imgUrl }: MentorCardProps) => (
<div className="card-mentor">
<img className="img-mentor" src={imgUrl} alt={name} />
<figcaption className="name-mentor">{name}</figcaption>
<ul className="repository-list-mentor">
{renderRepositories(repositoriesList)}
</ul>
</div>
);

Expand Down
17 changes: 8 additions & 9 deletions src/components/mentors/MentorGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@ import React from 'react';
import type { Mentor } from './mentor';

import MentorCard from './MentorCard';
import getMentors from '../../../data';
import './Mentor.css';

type MentorGridProps = {
mentorsList: Mentor[],
};

const renderMentors = (mentorsList: Mentor[]) =>
mentorsList.map(mentor => (
const renderMentors = (mentorsList: Mentor[]) => {
return mentorsList.map((mentor, i) => (
<MentorCard
name={mentor.name}
imgUrl={mentor.imgUrl}
repositoriesList={mentor.repositoriesList}
key={`${mentor.name}--${i}`}
/>
));
};

const MentorGrid = ({ mentorsList }: MentorGridProps) => (
<ul>{renderMentors(mentorsList)}</ul>
const MentorGrid = () => (
<ul className="mentors">{renderMentors(getMentors())}</ul>
);

export default MentorGrid;
2 changes: 0 additions & 2 deletions src/components/mentors/mentor.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// @flow
import type { Repository } from '../commons/repository/repository';

export type Mentor = {
name: string,
imgUrl: string,
repositoriesList: Repository[],
};
9 changes: 2 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4629,7 +4629,7 @@ querystringify@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e"

ramda@^0.26:
ramda@^0.26, ramda@^0.26.1:
version "0.26.1"
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.26.1.tgz#8d41351eb8111c55353617fc3bbffad8e4d35d06"
integrity sha512-hLWjpy7EnsDBb0p+Z3B7rPi3GDeRG5ZtiI33kJhTt+ORCd38AbAIjB/9zRIUoeTbE/AVX5ZkU7m6bznsvrf8eQ==
Expand Down Expand Up @@ -4712,12 +4712,7 @@ react-error-overlay@^5.1.0:
version "5.1.6"
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-5.1.6.tgz#0cd73407c5d141f9638ae1e0c63e7b2bf7e9929d"

react-is@^16.8.1:
version "16.10.2"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.10.2.tgz#984120fd4d16800e9a738208ab1fba422d23b5ab"
integrity sha512-INBT1QEgtcCCgvccr5/86CfD71fw9EPmDxgiJX4I2Ddr6ZsV6iFXsuby+qWJPtmNuMY0zByTsG4468P7nHuNWA==

react-is@^16.8.6:
react-is@^16.8.1, react-is@^16.8.6:
version "16.10.2"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.10.2.tgz#984120fd4d16800e9a738208ab1fba422d23b5ab"
integrity sha512-INBT1QEgtcCCgvccr5/86CfD71fw9EPmDxgiJX4I2Ddr6ZsV6iFXsuby+qWJPtmNuMY0zByTsG4468P7nHuNWA==
Expand Down