Skip to content

Commit af84463

Browse files
phoouzeourai
authored andcommitted
feat: reusable StatusBadge component
1 parent 8b1b3ed commit af84463

File tree

1 file changed

+17
-27
lines changed

1 file changed

+17
-27
lines changed

src/app/bounties/Card.js

+17-27
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ import Avatar from '@/components/Avatar'
2222
import { useConfig } from '#/state/application/hooks'
2323
import { fromNow } from '@/utils/date'
2424

25+
const StatusBadge = ({ icon, color, text, borderColor, textColor }) => {
26+
return (
27+
<div className={`inline-flex items-center gap-2 ${color} bg-opacity-10 rounded-full`}>
28+
<span className={`w-[24px] h-[24px] rounded-full flex items-center justify-center border-2 ${borderColor}`}>
29+
{icon}
30+
</span>
31+
<span className={`text-xs font-semibold ${textColor} font-nunito leading-[12px] text-left pr-2`}>
32+
{text}
33+
</span>
34+
</div>
35+
);
36+
};
37+
2538
export function BountiesCard({ data }) {
2639
const config = useConfig()
2740
const filters = config?.find(f => f.config_id === 1)?.config_value['bounty']
@@ -30,9 +43,7 @@ export function BountiesCard({ data }) {
3043
href={`/bounties/${data.id}`}
3144
className={`
3245
group flex flex-col relative cursor-pointer overflow-hidden rounded-2xl
33-
bg-gradient-to-b ${
34-
data.status === 3 ? "from-[#E5E5FE] to-[#FFFFFF]" : "bg-white"
35-
}
46+
bg-gradient-to-b ${ data.status === 3 ? 'from-[#E5E5FE] to-[#FFFFFF]' : 'bg-white'}
3647
py-4 transition-all duration-300 ease-in-out hover:shadow-lg hover:-translate-y-2 [&>div]:px-4
3748
`}
3849
>
@@ -68,34 +79,13 @@ export function BountiesCard({ data }) {
6879
<div className="flex items-center gap-2">
6980
<div className="flex items-center">
7081
{data.status === 3 && (
71-
<div className="flex items-center gap-2 bg-[#807DFB] bg-opacity-10 rounded-full">
72-
<span className="w-[24px] h-[24px] rounded-full flex items-center justify-center border-2 border-[#807DFB]">
73-
🧱
74-
</span>
75-
<span className="w-[65px] text-xs font-semibold text-[#807DFB] font-nunito leading-[12px] text-left">
76-
Recruiting
77-
</span>
78-
</div>
82+
<StatusBadge icon="🧱" color="bg-[#807DFB]" borderColor="border-[#807DFB]" textColor="text-[#807DFB]" text="Recruiting"/>
7983
)}
8084
{data.status > 6 && data.status < 24 && (
81-
<div className="flex items-center gap-2 bg-[#01DB83] bg-opacity-10 rounded-full">
82-
<span className="w-[24px] h-[24px] rounded-full flex items-center justify-center border-2 border-[#01DB83]">
83-
🔫
84-
</span>
85-
<span className="w-[54px] text-xs font-semibold text-[#00C475] font-nunito leading-[12px]">
86-
Building
87-
</span>
88-
</div>
85+
<StatusBadge icon="🔫" color="bg-[#01DB83]" borderColor="border-[#01DB83]" textColor="text-[#00C475]" text="Building"/>
8986
)}
9087
{data.status === 30 && (
91-
<div className="flex items-center gap-2 bg-[#82ADD8] bg-opacity-10 rounded-full">
92-
<span className="w-[24px] h-[24px] rounded-full flex items-center justify-center border-2 border-[#82ADD8]">
93-
🔚
94-
</span>
95-
<span className="w-[70px] text-xs font-semibold text-[#82ADD8] font-nunito leading-[12px] text-left">
96-
Completed
97-
</span>
98-
</div>
88+
<StatusBadge icon="🔚" color="bg-[#82ADD8]" borderColor="border-[#82ADD8]" textColor="text-[#82ADD8]" text="Completed"/>
9989
)}
10090
</div>
10191
</div>

0 commit comments

Comments
 (0)