Skip to content

Commit 53da1b1

Browse files
authored
Merge pull request #28 from ilyboc/main
Fixed project filter method and event issues
2 parents 9084be7 + c82b6a6 commit 53da1b1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/components/projects/ProjectsFilter.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default {
2121

2222
<template>
2323
<select
24-
@change="$emit('change', $event.target.value)"
24+
@change="$emit('filter', $event.target.value)"
2525
:name="select"
2626
:id="select"
2727
class="font-general-medium

src/components/projects/ProjectsGrid.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ export default {
1010
return {
1111
projects,
1212
projectsHeading: 'Projects Portfolio',
13-
selectedProject: '',
13+
selectedCategory: '',
1414
searchProject: '',
1515
};
1616
},
1717
computed: {
1818
// Get the filtered projects
1919
filteredProjects() {
20-
if (this.selectedProject) {
20+
if (this.selectedCategory) {
2121
return this.filterProjectsByCategory();
2222
} else if (this.searchProject) {
2323
return this.filterProjectsBySearch();
@@ -28,12 +28,12 @@ export default {
2828
methods: {
2929
// Filter projects by category
3030
filterProjectsByCategory() {
31-
return this.projects.map((item) => {
31+
return this.projects.filter((item) => {
3232
let category =
3333
item.category.charAt(0).toUpperCase() +
3434
item.category.slice(1);
3535
console.log(category);
36-
return category.includes(this.selectedProject);
36+
return category.includes(this.selectedCategory);
3737
});
3838
},
3939
// Filter projects by title search
@@ -127,7 +127,7 @@ export default {
127127
aria-label="Name"
128128
/>
129129
</div>
130-
<ProjectsFilter @change="selectedProject = $event" />
130+
<ProjectsFilter @filter="selectedCategory = $event" />
131131
</div>
132132
</div>
133133

0 commit comments

Comments
 (0)