Skip to content

Commit

Permalink
feat(contribution-item): add badge group for better alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
ahonestla committed Jan 8, 2025
1 parent ae023af commit 2ba3281
Showing 1 changed file with 37 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from "react";
import { Badge, Col, Row, Text, Notice, Title } from "@dataesr/dsfr-plus";
import { Badge, Col, Row, Text, Notice, Title, BadgeGroup } from "@dataesr/dsfr-plus"
import ContributorInfo from "./contributor-info";
import StaffActions from "./staff-action";
import {
Expand Down Expand Up @@ -37,40 +37,38 @@ const ContributionItem: React.FC<ContributionItemProps> = ({
return (
<>
<Row className="fr-mt-3w">
{data?.tags?.length > 0 && (
<Badge size="sm" color="green-menthe" className="fr-mr-1w fr-mb-1w">
{data.tags.join(", ")}
</Badge>
)}
{data?.status && (
<Badge
size="sm"
color={BadgeStatus({ status: data?.status })}
className="fr-mr-1w fr-mb-1w"
>
{StatusLabel({ status: data?.status })}
</Badge>
)}
{firstResponse?.team && (
<Badge size="sm" color="blue-ecume" className="fr-mr-1w fr-mb-1w">
{`Réponse envoyée par ${firstResponse.team}`}
</Badge>
)}
{data?.comment && data?.team?.length > 0 && (
<Badge size="sm" color="green-emeraude" className="fr-mr-1w fr-mb-1w">
{`Commenté par ${data.team[0]}`}
</Badge>
)}
{data?.type && (
<Badge
size="sm"
color={BadgeColor({ type: data.type })}
className="fr-mr-1w fr-mb-1w"
icon={typeIcon({ icon: data.type })}
>
{TypeLabel({ type: data.type })}
</Badge>
)}
<BadgeGroup>
{data?.tags?.length > 0 && (
<Badge size="sm" color="green-menthe" className="fr-mr-1w fr-mb-1w">
{data.tags.join(", ")}
</Badge>
)}
{data?.status && (
<Badge size="sm" color={BadgeStatus({ status: data?.status })} className="fr-mr-1w fr-mb-1w">
{StatusLabel({ status: data?.status })}
</Badge>
)}
{firstResponse?.team && (
<Badge size="sm" color="blue-ecume" className="fr-mr-1w fr-mb-1w">
{`Réponse envoyée par ${firstResponse.team}`}
</Badge>
)}
{data?.comment && data?.team?.length > 0 && (
<Badge size="sm" color="green-emeraude" className="fr-mr-1w fr-mb-1w">
{`Commenté par ${data.team[0]}`}
</Badge>
)}
{data?.type && (
<Badge
size="sm"
color={BadgeColor({ type: data.type })}
className="fr-mr-1w fr-mb-1w"
icon={typeIcon({ icon: data.type })}
>
{TypeLabel({ type: data.type })}
</Badge>
)}
</BadgeGroup>
</Row>
<Row>
<Col>
Expand All @@ -80,9 +78,7 @@ const ContributionItem: React.FC<ContributionItemProps> = ({
className={`copy-button ${copiedId === data?.id ? "copied" : ""}`}
onClick={() => copyToClipboard(data?.id)}
>
{copiedId === data?.id && (
<span className="copied-text">Copié</span>
)}
{copiedId === data?.id && <span className="copied-text">Copié</span>}
<FaCopy size={14} color="#2196f3" className="copy-icon" />
</button>
</Title>
Expand All @@ -93,22 +89,15 @@ const ContributionItem: React.FC<ContributionItemProps> = ({
)}
</Col>
<Text size="sm">
<i className="date">
Reçu le {new Date(data?.created_at)?.toLocaleDateString()}
</i>
<i className="date">Reçu le {new Date(data?.created_at)?.toLocaleDateString()}</i>
</Text>
</Row>
<Col>
<ContributorInfo
data={data}
highlightedQuery={highlightedQuery}
refetch={refetch}
allTags={allTags}
/>
<ContributorInfo data={data} highlightedQuery={highlightedQuery} refetch={refetch} allTags={allTags} />
<StaffActions url={url} refetch={refetch} data={data} />
</Col>
</>
);
)
};

export default ContributionItem;

0 comments on commit 2ba3281

Please sign in to comment.