Skip to content

Commit d5cfa6e

Browse files
committed
[repo] Display multiple issue links in a UL
1 parent 86aa159 commit d5cfa6e

2 files changed

Lines changed: 36 additions & 12 deletions

File tree

src/components/Project/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ export declare interface Link {
2323
link: string,
2424
}
2525

26+
declare interface IssueLinks extends Array<Link> {}
27+
2628
export declare interface ProjectSummaryData {
2729
projectName: string,
2830
title: string,
2931
owners: Array<PersonProps>,
3032
status: string,
31-
issueLinks?: Array<Link>,
33+
issueLinks?: IssueLinks,
3234
discussionLinks?: Array<Link>,
3335
}
3436

src/components/ProjectSummary/index.tsx

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,38 @@ export default function ProjectSummary(props: ProjectSummaryProps): ReactNode {
4848
);
4949
}
5050

51+
function getIssueLinks({ issueLinks }: ProjectSummaryData): ReactNode {
52+
if (issueLinks.length === 1) {
53+
return (
54+
<>
55+
{issueLinks.map(({ link, title }) => (
56+
<div key={title}>
57+
<Link
58+
to={link}
59+
>
60+
{title}
61+
</Link>
62+
</div>
63+
))}
64+
</>
65+
);
66+
}
67+
68+
return (
69+
<ul>
70+
{issueLinks.map(({ link, title }) => (
71+
<li key={title}>
72+
<Link
73+
to={link}
74+
>
75+
{title}
76+
</Link>
77+
</li>
78+
))}
79+
</ul>
80+
);
81+
}
82+
5183
function GetProjectSummary(projectData: ProjectSummaryData): ReactNode {
5284
return (
5385
<div className={styles.projectsummary}>
@@ -82,17 +114,7 @@ export default function ProjectSummary(props: ProjectSummaryProps): ReactNode {
82114
&& (
83115
<tr>
84116
<th>Issues</th>
85-
<td>
86-
{projectData.issueLinks.map(({ link, title }) => (
87-
<div key={title}>
88-
<Link
89-
to={link}
90-
>
91-
{title}
92-
</Link>
93-
</div>
94-
))}
95-
</td>
117+
<td>{getIssueLinks(projectData)}</td>
96118
</tr>
97119
)}
98120
</tbody>

0 commit comments

Comments
 (0)