Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ljc1991 committed Oct 28, 2023
1 parent 5a9c0ac commit 5b91179
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
5 changes: 4 additions & 1 deletion homepage/src/components/cards/card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ const Card = ({ card }) => {
} else {
return (
<div className="col-md-4 mb-3" id={card.data.id}>
<div className="section-main">
<div
className="section-main"
style={{ backgroundColor: `${card.data.color.background}` }}
>
<h3>{card.data.title}</h3>
<div>
<div className="image-container">
Expand Down
32 changes: 32 additions & 0 deletions homepage/src/lib/processCardData.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,38 @@ export function processCardData(data) {
};
}
// project card
const jobCards = data.type === 'job';

if (data.type === 'project') {
const color = {};
const mainTag = data.tags.find((tag) =>
['open gov', 'open data', 'open source'].includes(tag),
);
switch (mainTag) {
case 'open gov':
color.background = '#efac49';
break;
case 'open data':
color.background = '#73a09b';
break;
case 'open source':
color.background = '#9b2123';
break;
default:
color.background = '#ffffff';
}

const tags = data.tags || [];
const avatarList = tags.map((tag) => {
const jobCard = jobCards.find((jobCard) => jobCard.data.tags[0] === tag);
return jobCard ? jobCard.data : null;
});

data = {
...data,
color,
};
}

return {
...data,
Expand Down

0 comments on commit 5b91179

Please sign in to comment.