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

Commit

Permalink
Merge pull request #107 from OpenDevUFCG/feat/add-mentors-list
Browse files Browse the repository at this point in the history
Render mentors
  • Loading branch information
fanny authored Oct 18, 2019
2 parents f41cd12 + 4a18bec commit 1b78c5c
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 36 deletions.
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;
88 changes: 78 additions & 10 deletions data/repositories.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,111 @@
"repositories": [
{
"name": "calluswhatyouwant/spotify-web-sdk",
"difficulty": "avancado"
"difficulty": "avancado",
"mentors": [
{
"name": "JRobsonJr",
"imgUrl": "https://github.com/jrobsonjr.png"
},
{
"name": "JoseRenan",
"imgUrl": "https://github.com/joserenan.png"
}
]
},
{
"name": "calluswhatyouwant/musicritic",
"difficulty": "avancado"
"difficulty": "avancado",
"mentors": [
{
"name": "JRobsonJr",
"imgUrl": "https://github.com/jrobsonjr.png"
},
{
"name": "JoseRenan",
"imgUrl": "https://github.com/joserenan.png"
}
]
},
{
"name": "paulojbleitao/pokedex",
"difficulty": "intermediario"
"difficulty": "intermediario",
"mentors": [
{
"name": "PauloJBLeitao",
"imgUrl": "https://github.com/paulojbleitao.png"
}
]
},
{
"name": "SubmiBot/SubmiBot",
"difficulty": "intermediario"
"difficulty": "intermediario",
"mentors": [
{
"name": "HericlesMe",
"imgUrl": "https://github.com/hericlesme.png"
}
]
},
{
"name": "marianabianca/pomodoro",
"difficulty": "iniciante"
"difficulty": "iniciante",
"mentors": [
{
"name": "MarianaBianca",
"imgUrl": "https://github.com/marianabianca.png"
}
]
},
{
"name": "P-Sync/P-Sync",
"difficulty": "intermediario"
"difficulty": "intermediario",
"mentors": [
{
"name": "HericlesMe",
"imgUrl": "https://github.com/hericlesme.png"
}
]
},
{
"name": "FelipeMarinho97/iskra-webkit-greeter",
"difficulty": "intermediario"
"difficulty": "intermediario",
"mentors": [
{
"name": "FelipeMarinho97",
"imgUrl": "https://github.com/FelipeMarinho97.png"
}
]
},
{
"name": "Rickecr/PyGraph",
"difficulty": "intermediario"
"difficulty": "intermediario",
"mentors": [
{
"name": "Rickecr",
"imgUrl": "https://github.com/Rickecr.png"
}
]
},
{
"name": "Rickecr/CamaraDosDeputados",
"difficulty": "iniciante"
"difficulty": "iniciante",
"mentors": [
{
"name": "Rickecr",
"imgUrl": "https://github.com/Rickecr.png"
}
]
},
{
"name": "matheusps/clssx",
"difficulty": "iniciante"
"difficulty": "iniciante",
"mentors": [
{
"name": "Matheusps",
"imgUrl": "https://github.com/matheusps.png"
}
]
}
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,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
1 change: 1 addition & 0 deletions src/components/commons/header/Header.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2);
display: flex;
justify-content: center;
z-index: 1;
}

/* Class used to keep the header at the top of the page even when it is rolled */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,46 @@
.mentor-grid {
display: grid;
width: 100%;
}

/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {
.mentor-grid {
grid-template-columns: 1fr;
}
}

/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {
.mentor-grid {
grid-template-columns: repeat(2, 1fr);
}
}

/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {
.mentor-grid {
grid-template-columns: repeat(2, 1fr);
}
}

/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {
.mentor-grid {
grid-template-columns: repeat(4, 1fr);
}
}

/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {
.mentor-grid {
grid-template-columns: repeat(4, 1fr);
}
}

.img-mentor {
border-radius: 100%;
width: 200px;
width: 100%;
filter: grayscale(100%);
transition: all 0.7s ease;
}
Expand Down
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 = () => (
<div className="mentor-grid">{renderMentors(getMentors())}</div>
);

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[],
};
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4650,7 +4650,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

0 comments on commit 1b78c5c

Please sign in to comment.