@@ -11,7 +11,6 @@ import {
1111import { type FC , type MouseEvent , useCallback , useContext } from 'react' ;
1212
1313import { AppContext } from '../context/App' ;
14- import { PILL_CLASS_NAME } from '../styles/gitify' ;
1514import { type Account , IconColor } from '../types' ;
1615import type { Notification } from '../typesGitHub' ;
1716import {
@@ -25,6 +24,7 @@ import {
2524} from '../utils/icons' ;
2625import { openNotification , openUserProfile } from '../utils/links' ;
2726import { formatReason } from '../utils/reason' ;
27+ import { PillButton } from './buttons/PillButton' ;
2828
2929interface IProps {
3030 account : Account ;
@@ -143,77 +143,56 @@ export const NotificationRow: FC<IProps> = ({ notification, account }) => {
143143 { settings . showPills && (
144144 < div >
145145 { notification . subject ?. linkedIssues ?. length > 0 && (
146- < span title = { linkedIssuesPillDescription } >
147- < button type = "button" className = { PILL_CLASS_NAME } >
148- < IssueClosedIcon
149- size = { 12 }
150- className = { `mr-1 ${ IconColor . GREEN } ` }
151- aria-label = { linkedIssuesPillDescription }
152- />
153- { notification . subject . linkedIssues . length }
154- </ button >
155- </ span >
146+ < PillButton
147+ title = { linkedIssuesPillDescription }
148+ metric = { notification . subject . linkedIssues . length }
149+ icon = { IssueClosedIcon }
150+ color = { IconColor . GREEN }
151+ />
156152 ) }
153+
157154 { notification . subject . reviews ?. map ( ( review ) => {
158155 const icon = getPullRequestReviewIcon ( review ) ;
159156 if ( ! icon ) {
160157 return null ;
161158 }
162159
163160 return (
164- < span key = { review . state } title = { icon . description } >
165- < button type = "button" className = { PILL_CLASS_NAME } >
166- < icon . type
167- size = { 12 }
168- className = { `mr-1 ${ icon . color } ` }
169- aria-label = { icon . description }
170- />
171- { review . users . length }
172- </ button >
173- </ span >
161+ < PillButton
162+ key = { review . state }
163+ title = { icon . description }
164+ metric = { review . users . length }
165+ icon = { icon . type }
166+ color = { icon . color }
167+ />
174168 ) ;
175169 } ) }
176170 { notification . subject ?. comments > 0 && (
177- < span title = { commentsPillDescription } >
178- < button type = "button" className = { PILL_CLASS_NAME } >
179- < CommentIcon
180- size = { 12 }
181- className = { `mr-1 ${ IconColor . GRAY } ` }
182- aria-label = { commentsPillDescription }
183- />
184- { notification . subject . comments }
185- </ button >
186- </ span >
171+ < PillButton
172+ title = { commentsPillDescription }
173+ metric = { notification . subject . comments }
174+ icon = { CommentIcon }
175+ color = { IconColor . GRAY }
176+ />
187177 ) }
188178 { notification . subject ?. labels ?. length > 0 && (
189- < span title = { labelsPillDescription } >
190- < button type = "button" className = { PILL_CLASS_NAME } >
191- < TagIcon
192- size = { 12 }
193- className = { `mr-1 ${ IconColor . GRAY } ` }
194- aria-label = { labelsPillDescription }
195- />
196- { notification . subject . labels . length }
197- </ button >
198- </ span >
179+ < PillButton
180+ title = { labelsPillDescription }
181+ metric = { notification . subject . labels . length }
182+ icon = { TagIcon }
183+ color = { IconColor . GRAY }
184+ />
199185 ) }
200186 { notification . subject . milestone && (
201- < span
202- className = "ml-1"
187+ < PillButton
203188 title = { notification . subject . milestone . title }
204- >
205- < button type = "button" className = { PILL_CLASS_NAME } >
206- < MilestoneIcon
207- size = { 12 }
208- className = {
209- notification . subject . milestone . state === 'open'
210- ? IconColor . GREEN
211- : IconColor . RED
212- }
213- aria-label = { notification . subject . milestone . title }
214- />
215- </ button >
216- </ span >
189+ icon = { MilestoneIcon }
190+ color = {
191+ notification . subject . milestone . state === 'open'
192+ ? IconColor . GREEN
193+ : IconColor . RED
194+ }
195+ />
217196 ) }
218197 </ div >
219198 ) }
0 commit comments