Skip to content

Commit 29e2ae1

Browse files
authored
feat: format notification metrics within "pills" (#1169)
1 parent d75fb82 commit 29e2ae1

File tree

3 files changed

+585
-404
lines changed

3 files changed

+585
-404
lines changed

src/components/NotificationRow.tsx

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { AppContext } from '../context/App';
1717
import { IconColor } from '../types';
1818
import type { Notification } from '../typesGitHub';
1919
import { openExternalLink } from '../utils/comms';
20+
import Constants from '../utils/constants';
2021
import {
2122
formatForDisplay,
2223
formatNotificationUpdatedAt,
@@ -86,7 +87,7 @@ export const NotificationRow: FC<IProps> = ({ notification, hostname }) => {
8687
notification.subject.type,
8788
]);
8889

89-
const commentsLabel = `${notification.subject.comments} ${
90+
const commentsPillDescription = `${notification.subject.comments} ${
9091
notification.subject.comments > 1 ? 'comments' : 'comment'
9192
}`;
9293

@@ -156,22 +157,31 @@ export const NotificationRow: FC<IProps> = ({ notification, hostname }) => {
156157
title={icon.description}
157158
className="ml-1"
158159
>
159-
<icon.type
160-
size={16}
161-
className={icon.color}
162-
aria-label={icon.description}
163-
/>
160+
<button
161+
type="button"
162+
className={Constants.PILL_CLASS_NAME}
163+
>
164+
<icon.type
165+
size={12}
166+
className={`mr-1 ${icon.color}`}
167+
aria-label={icon.description}
168+
/>
169+
{review.users.length}
170+
</button>
164171
</span>
165172
);
166173
})
167174
: null}
168175
{notification.subject?.comments > 0 && (
169-
<span className="ml-1" title={commentsLabel}>
170-
<CommentIcon
171-
size={16}
172-
className={IconColor.GRAY}
173-
aria-label={commentsLabel}
174-
/>
176+
<span className="ml-1" title={commentsPillDescription}>
177+
<button type="button" className={Constants.PILL_CLASS_NAME}>
178+
<CommentIcon
179+
size={12}
180+
className={`mr-1 ${IconColor.GRAY}`}
181+
aria-label={commentsPillDescription}
182+
/>
183+
{notification.subject.comments}
184+
</button>
175185
</span>
176186
)}
177187
</span>

0 commit comments

Comments
 (0)