Skip to content

Commit b1e32a3

Browse files
committed
feat: ellipsis design for long repository names and add archived badge
1 parent 74f9429 commit b1e32a3

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

frontend/__tests__/unit/components/RepositoriesCard.test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,25 @@ describe('RepositoriesCard', () => {
225225
})
226226

227227
it('archived badge has small size on cards', () => {
228+
const archivedRepo: RepositoryCardProps = {
229+
...createMockRepository(0),
230+
isArchived: true,
231+
}
232+
233+
render(<RepositoriesCard repositories={[archivedRepo]} />)
234+
228235
const badge = screen.getByText('Archived')
229236
expect(badge).toHaveClass('px-2', 'py-1', 'text-xs')
230237
})
231238

232239
it('archived badge does not show icon on cards', () => {
240+
const archivedRepo: RepositoryCardProps = {
241+
...createMockRepository(0),
242+
isArchived: true,
243+
}
244+
245+
render(<RepositoriesCard repositories={[archivedRepo]} />)
246+
233247
const badge = screen.getByText('Archived')
234248
const icon = badge.querySelector('[data-testid="archive-icon"]')
235249
expect(icon).not.toBeInTheDocument()

frontend/src/components/RepositoriesCard.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@ const RepositoryItem = ({ details }: { details: RepositoryCardProps }) => {
4242
<div className="flex items-start justify-between gap-2">
4343
<button
4444
onClick={handleClick}
45-
className="text-start font-semibold text-blue-400 hover:underline"
45+
className="min-w-0 flex-1 text-start font-semibold text-blue-400 hover:underline"
4646
>
4747
<TruncatedText text={details?.name} />
4848
</button>
49-
{details.isArchived && <ArchivedBadge size="sm" showIcon={false} />}
49+
{details.isArchived && (
50+
<div className="flex-shrink-0">
51+
<ArchivedBadge size="sm" showIcon={false} />
52+
</div>
53+
)}
5054
</div>
5155

5256
<div className="flex flex-col gap-2 text-sm">

0 commit comments

Comments
 (0)