Skip to content

Commit

Permalink
refactor: ProjectList class to function component (#992)
Browse files Browse the repository at this point in the history
  • Loading branch information
julialbq authored Mar 5, 2025
1 parent 84abf19 commit 4ed5163
Showing 1 changed file with 18 additions and 31 deletions.
49 changes: 18 additions & 31 deletions app/assets/javascripts/components/projects/ProjectList.jsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,27 @@
import React, { Fragment } from 'react';
import React from 'react';
import ProjectCard from 'components/projects/ProjectCard';

export default class ProjectList extends React.Component {
cards() {
const { user, projects, joined } = this.props;

return projects.map(project => {
return (
const ProjectList = ({ user, projects, joined, title }) => {
return (
<>
<div className="col-md-12 project-list-title">
<h4>
<i className="mi md-20 heading-icon" data-testid="view-module-title">
view_module
</i>{' '}
{title} | {projects.length}
</h4>
</div>
{projects.map(project => (
<ProjectCard
key={project.get('slug')}
project={project}
user={user}
joined={joined}
/>
);
});
}

render() {
const { projects, title } = this.props;
))}
</>
);
};

return (
<Fragment>
<div className="col-md-12 project-list-title">
<h4>
<i
className="mi md-20 heading-icon"
data-testid="view-module-title"
>
view_module
</i>{' '}
{title} | {projects.length}
</h4>
</div>
{this.cards()}
</Fragment>
);
}
}
export default ProjectList;

0 comments on commit 4ed5163

Please sign in to comment.