Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat:Add search bar to projects #344

Closed
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: 1 addition & 1 deletion web/src/layouts/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Header = () => {
{
title: 'Projects',
path: '/projects',
},
}
];

return (
Expand Down
55 changes: 37 additions & 18 deletions web/src/pages/Issues/ProjectList.jsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,43 @@
// eslint-disable-next-line no-unused-vars
import React from "react";
import projectList from "./ListOfOrgs/listOfOrgs";
import ProjectCard from "./ListOfOrgs/ProjectCard";
import React from 'react';
import projectList from './ListOfOrgs/listOfOrgs';
import ProjectCard from './ListOfOrgs/ProjectCard';

const ProjectList = () => {
const [searchTerm, setSearchTerm] = React.useState('');

const handleChange = (event) => {
setSearchTerm(event.target.value);
};

return (
<div className="mx-auto min-h-screen max-w-screen-2xl p-4 md:p-8 2xl:p-10">
<div className="grid grid-cols-1 gap-6 md:grid-cols-2 md:gap-4 xl:grid-cols-3 2xl:gap-7.5 bg-gradient-to-r from-gray-700 via-gray-900 to-black bg-animate items-center">
{projectList.map((project, key) => {
return (
<ProjectCard
key={key}
name={project.name}
logoLink={project.imageSrc}
projectLink={project.projectLink}
description={project.description}
tags={project.tags}
/>
);
})}
<div className="min-h-screen bg-gradient-to-r from-gray-700 via-gray-900 to-black bg-animate flex flex-col items-center justify-center">
<input
type="text"
placeholder="Search"
className="w-50 h-10 px-5 pr-10 text-sm bg-white border-2 border-gray-300 rounded-full focus:outline-none"
onChange={handleChange}
/>
<div className="mt-4 mx-auto p-4 md:p-8 2xl:p-10">
<div className="grid grid-cols-1 gap-6 md:grid-cols-2 md:gap-4 xl:grid-cols-3 2xl:gap-7.5 bg-gradient-to-r from-gray-700 via-gray-900 to-black bg-animate items-center">
{projectList.map((project, key) => {
if (
project.tags.find((tag) =>
tag.toLowerCase().includes(searchTerm.toLowerCase())
)
) {
return (
<ProjectCard
key={key}
name={project.name}
logoLink={project.imageSrc}
projectLink={project.projectLink}
description={project.description}
tags={project.tags}
/>
);
}
})}
</div>
</div>
</div>
);
Expand Down