Skip to content

Commit 56cc3d1

Browse files
committed
Using map instead of filter shit
1 parent 315acfa commit 56cc3d1

File tree

3 files changed

+45
-39
lines changed

3 files changed

+45
-39
lines changed

src/components/projects/ProjectsFilter.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default {
4040
select: {
4141
type: String,
4242
default: 'projects',
43+
required: true,
4344
},
4445
selectOptions: {
4546
type: Array,

src/components/projects/ProjectsGrid.vue

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -98,52 +98,16 @@
9898
import feather from 'feather-icons';
9999
import ProjectsFilter from './ProjectsFilter.vue';
100100
import ProjectSingle from './ProjectSingle.vue';
101+
import projects from '../../data/projects';
101102
102103
export default {
103104
components: { ProjectSingle, ProjectsFilter },
104105
data: () => {
105106
return {
107+
projects,
106108
projectsHeading: 'Projects Portfolio',
107109
selectedProject: '',
108110
searchProject: '',
109-
projects: [
110-
{
111-
id: 1,
112-
title: 'Google Health Platform',
113-
category: 'Web Application',
114-
img: require('@/assets/images/web-project-2.jpg'),
115-
},
116-
{
117-
id: 2,
118-
title: 'Phoenix Digital Agency',
119-
category: 'Mobile Application',
120-
img: require('@/assets/images/mobile-project-2.jpg'),
121-
},
122-
{
123-
id: 3,
124-
title: 'Project Management UI',
125-
category: 'UI/UX Design',
126-
img: require('@/assets/images/ui-project-1.jpg'),
127-
},
128-
{
129-
id: 4,
130-
title: 'Cloud Storage Platform',
131-
category: 'UI/UX Design',
132-
img: require('@/assets/images/ui-project-2.jpg'),
133-
},
134-
{
135-
id: 5,
136-
title: 'React Social App',
137-
category: 'Mobile Application',
138-
img: require('@/assets/images/mobile-project-1.jpg'),
139-
},
140-
{
141-
id: 6,
142-
title: 'Apple Design System',
143-
category: 'Web Application',
144-
img: require('@/assets/images/web-project-1.jpg'),
145-
},
146-
],
147111
};
148112
},
149113
computed: {
@@ -160,10 +124,11 @@ export default {
160124
methods: {
161125
// Filter projects by category
162126
filterProjectsByCategory() {
163-
return this.projects.filter((item) => {
127+
return this.projects.map((item) => {
164128
let category =
165129
item.category.charAt(0).toUpperCase() +
166130
item.category.slice(1);
131+
console.log(category);
167132
return category.includes(this.selectedProject);
168133
});
169134
},

src/data/projects.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const projects = [
2+
{
3+
id: 1,
4+
title: 'Google Health Platform',
5+
category: 'Web Application',
6+
img: require('@/assets/images/web-project-2.jpg'),
7+
},
8+
{
9+
id: 2,
10+
title: 'Phoenix Digital Agency',
11+
category: 'Mobile Application',
12+
img: require('@/assets/images/mobile-project-2.jpg'),
13+
},
14+
{
15+
id: 3,
16+
title: 'Project Management UI',
17+
category: 'UI/UX Design',
18+
img: require('@/assets/images/ui-project-1.jpg'),
19+
},
20+
{
21+
id: 4,
22+
title: 'Cloud Storage Platform',
23+
category: 'UI/UX Design',
24+
img: require('@/assets/images/ui-project-2.jpg'),
25+
},
26+
{
27+
id: 5,
28+
title: 'React Social App',
29+
category: 'Mobile Application',
30+
img: require('@/assets/images/mobile-project-1.jpg'),
31+
},
32+
{
33+
id: 6,
34+
title: 'Apple Design System',
35+
category: 'Web Application',
36+
img: require('@/assets/images/web-project-1.jpg'),
37+
},
38+
];
39+
40+
export default projects;

0 commit comments

Comments
 (0)