Skip to content

Commit 8bc758b

Browse files
committed
Fixed breadcrumb styling and added tests
1 parent 58057ca commit 8bc758b

File tree

7 files changed

+33
-7
lines changed

7 files changed

+33
-7
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,30 @@ describe('BreadCrumb', () => {
3939
expect(lastSegment).toBeInTheDocument()
4040
expect(lastSegment).not.toHaveAttribute('href')
4141
})
42+
43+
test('links have correct href attributes', () => {
44+
;(usePathname as jest.Mock).mockReturnValue('/dashboard/users/profile')
45+
46+
render(<BreadCrumbs />)
47+
48+
const homeLink = screen.getByText('Home').closest('a')
49+
const dashboardLink = screen.getByText('Dashboard').closest('a')
50+
const usersLink = screen.getByText('Users').closest('a')
51+
52+
expect(homeLink).toHaveAttribute('href', '/')
53+
expect(dashboardLink).toHaveAttribute('href', '/dashboard')
54+
expect(usersLink).toHaveAttribute('href', '/dashboard/users')
55+
})
56+
57+
test('links have hover styles', () => {
58+
;(usePathname as jest.Mock).mockReturnValue('/dashboard/users')
59+
60+
render(<BreadCrumbs />)
61+
62+
const homeLink = screen.getByText('Home').closest('a')
63+
const dashboardLink = screen.getByText('Dashboard').closest('a')
64+
65+
expect(homeLink).toHaveClass('hover:text-blue-700', 'hover:underline')
66+
expect(dashboardLink).toHaveClass('hover:text-blue-700', 'hover:underline')
67+
})
4268
})

frontend/src/app/about/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const About = () => {
7272
}
7373

7474
return (
75-
<div className="mt-16 min-h-screen p-8 text-gray-600 dark:bg-[#212529] dark:text-gray-300">
75+
<div className="min-h-screen p-8 text-gray-600 dark:bg-[#212529] dark:text-gray-300">
7676
<div className="mx-auto max-w-6xl">
7777
<h1 className="mb-6 mt-4 text-4xl font-bold">About</h1>
7878
<SecondaryCard icon={faScroll} title="History">

frontend/src/app/snapshots/[id]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const SnapshotDetailsPage: React.FC = () => {
110110
}
111111

112112
return (
113-
<div className="mx-auto mt-16 min-h-screen max-w-6xl p-4">
113+
<div className="mx-auto min-h-screen max-w-6xl p-4">
114114
<div className="mb-8 mt-8 rounded-lg border border-gray-200 bg-white p-6 shadow-sm dark:border-gray-700 dark:bg-gray-800">
115115
<div className="flex flex-wrap items-start justify-between gap-4">
116116
<div>

frontend/src/app/snapshots/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ const SnapshotsPage: React.FC = () => {
6262
}
6363

6464
return (
65-
<div className="mt-16 min-h-screen p-8 text-gray-600 dark:bg-[#212529] dark:text-gray-300">
66-
<div className="mt-16 flex min-h-screen w-full flex-col items-center justify-normal p-5 text-text">
65+
<div className="min-h-screen p-8 text-gray-600 dark:bg-[#212529] dark:text-gray-300">
66+
<div className="flex min-h-screen w-full flex-col items-center justify-normal p-5 text-text">
6767
<div className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
6868
{!snapshots?.length ? (
6969
<div className="col-span-full py-8 text-center">No Snapshots found</div>

frontend/src/components/BreadCrumbs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function BreadCrumbs() {
1515
if (pathname === homeRoute) return null
1616

1717
return (
18-
<div className="absolute bottom-2 left-0 top-1 mt-16 w-full py-2">
18+
<div className="mt-16 w-full pt-4">
1919
<div className="w-full px-8 sm:px-8 md:px-8 lg:px-8">
2020
<Breadcrumbs
2121
aria-label="breadcrumb"

frontend/src/components/CardDetailsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const DetailsCard = ({
4646
repositories = [],
4747
}: DetailsCardProps) => {
4848
return (
49-
<div className="mt-16 min-h-screen bg-white p-8 text-gray-600 dark:bg-[#212529] dark:text-gray-300">
49+
<div className="min-h-screen bg-white p-8 text-gray-600 dark:bg-[#212529] dark:text-gray-300">
5050
<div className="mx-auto max-w-6xl">
5151
<h1 className="mb-6 mt-4 text-4xl font-bold">{title}</h1>
5252
<p className="mb-6 text-xl">{description}</p>

frontend/src/components/SearchPageLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const SearchPageLayout = ({
4040
}
4141
}, [isLoaded, isFirstLoad])
4242
return (
43-
<div className="mt-16 flex min-h-screen w-full flex-col items-center justify-normal p-5 text-text">
43+
<div className="flex min-h-screen w-full flex-col items-center justify-normal p-5 text-text">
4444
<div className="flex w-full items-center justify-center">
4545
<SearchBar
4646
isLoaded={isFirstLoad}

0 commit comments

Comments
 (0)