MCPcopy Index your code
hub / github.com/gitpoint/git-point / StateBadge

Function StateBadge

src/components/state-badge.component.js:28–64  ·  view source on GitHub ↗
({
  issue,
  isMerged,
  text,
  type,
  style,
  locale,
}: Props)

Source from the content-addressed store, hash-verified

26`;
27
28export const StateBadge = ({
29 issue,
30 isMerged,
31 text,
32 type,
33 style,
34 locale,
35}: Props) => {
36 let issueState = type;
37 let issueText = text;
38
39 if (isMerged) {
40 issueState = 'merged';
41 issueText = t('Merged', locale);
42 } else if (issue && issue.state === 'open') {
43 issueState = 'open';
44 issueText = t('Open', locale);
45 } else if (issue && issue.state === 'closed') {
46 issueState = 'closed';
47 issueText = t('Closed', locale);
48 }
49
50 const stateColor = {
51 merged: colors.purple,
52 open: colors.green,
53 closed: colors.red,
54 };
55 const issueStateColor = stateColor[issueState]
56 ? stateColor[issueState]
57 : colors.gray;
58
59 return (
60 <Badge color={issueStateColor} style={style}>
61 <BadgeText>{issueText}</BadgeText>
62 </Badge>
63 );
64};

Callers

nothing calls this directly

Calls 1

tFunction · 0.90

Tested by

no test coverage detected