Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Create Contributors page #18

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 0 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ body {
color: var(--smoky_dark);
display: flex;
flex-direction: column;
width: 100vw;
height: 100vh;
}

.app-container {
Expand Down
36 changes: 0 additions & 36 deletions src/components/Leaves.vue

This file was deleted.

39 changes: 39 additions & 0 deletions src/components/Leaves/Leave.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<div class="leaf" v-bind:class="team"></div>
</template>

<script>
export default {
props: ['team'],
};
</script>

<style scoped>
.leaf {
float: left;
width: 15px;
height: 28px;
margin-right: 8px;
border-radius: 15px 0 15px 0;
background-color: #bbb;
}

.frontend {
background-color: rgb(26, 103, 92);
}
.backend {
background-color: rgb(40, 107, 179);
}
.devops {
background-color: rgb(145, 15, 25);
}
.design {
background-color: rgb(229, 0, 25);
}
.planning {
background-color: rgb(248, 129, 10);
}
.functional_testing {
background-color: rgb(247, 171, 0);
}
</style>
29 changes: 29 additions & 0 deletions src/components/Leaves/Leaves.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<template>
<div class="leaves">
<Leave v-for="team in teamNames" v-bind:key="teamNames.indexOf(team)" :team="team"></Leave>
</div>
</template>

<script>
import Leave from './Leave.vue';

export default {
name: 'Leaves',
components: {
Leave,
},
computed: {
teamNames() {
return this.teams.map(team => {
spiray marked this conversation as resolved.
Show resolved Hide resolved
if (team === 0) return 'planning';
if (team === 1) return 'design';
if (team === 2) return 'frontend';
if (team === 3) return 'backend';
if (team === 4) return 'devops';
return 'functional_testing';
});
},
},
props: ['teams'],
};
</script>
2 changes: 1 addition & 1 deletion src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Router from 'vue-router';
import History from './views/History.vue';
import FAQPage from './views/FAQPage/index.vue';
import Videos from './views/Videos.vue';
import Contributors from './views/Contributors.vue';
import Contributors from './views/ContributorsPage/Contributors.vue';

Vue.use(Router);

Expand Down
12 changes: 0 additions & 12 deletions src/views/Contributors.vue

This file was deleted.

43 changes: 43 additions & 0 deletions src/views/ContributorsPage/Contributor.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<template>
<div class="contributor">
<img v-bind:src="data.attributes.image" class="profile" />
<span>{{ data.attributes.name }}</span>
<Leaves :teams="data.attributes.teamIds" />
<br />
<p>
<a v-bind:href="`https://github.com/${data.attributes.username}`">
<i class="fa fa-github-square"></i>
<span>{{ data.attributes.username }}</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be left padding on this.

</a>
</p>
<hr />
</div>
</template>

<script>
import Leaves from '../../components/Leaves/Leaves.vue';

export default {
name: 'Contributor',
components: {
Leaves,
},
props: ['data'],
};
</script>

<style scoped>
@import url('https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
@import url('../../assets/main.css');

.profile {
width: var(--width_height);
height: var(--width_height);
border-radius: 50%;
}

a {
color: black;
text-decoration: none;
}
</style>
33 changes: 33 additions & 0 deletions src/views/ContributorsPage/ContributorList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<template>
<div class="contributors">
<div class="contributor" v-for="contributor in contributors" :key="contributor.id">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is giving a linting error.

<Contributor :data="contributor" />
</div>
</div>
</template>

<script>
import Contributor from './Contributor.vue';

export default {
name: 'ContributorList',
data() {
return {
contributors: [],
};
},
created() {
return (
fetch('https://api-dev.codinggarden.community/contributors')
.then(res => res.json())
// eslint-disable-next-line
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's fix the issues and follow the linter.

.then(json => (this.contributors = json))
);
},
components: {
Contributor,
},
};
</script>

<style scoped></style>
17 changes: 17 additions & 0 deletions src/views/ContributorsPage/Contributors.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<div>
Contributors page
<ContributorsList />
</div>
</template>

<script>
import ContributorsList from './ContributorList.vue';

export default {
name: 'contributors',
components: {
ContributorsList,
},
};
</script>