Skip to content

Commit 816401e

Browse files
committed
button links styled
1 parent 2c3a799 commit 816401e

File tree

11 files changed

+47
-10
lines changed

11 files changed

+47
-10
lines changed

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"@types/node": "^16.18.126",
99
"@types/react": "^19.1.4",
1010
"@types/react-dom": "^19.1.5",
11+
"history": "^5.3.0",
1112
"react": "^19.1.0",
1213
"react-dom": "^19.1.0",
1314
"react-router": "^7.6.0",
-18.5 KB
Binary file not shown.
-10.1 KB
Binary file not shown.
273 KB
Loading
1.41 MB
Loading

src/Components/AddNavBar/NavBar.scss

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,25 @@
1515
.homeButton {
1616
display: flex;
1717
flex-direction: column;
18-
justify-items: center;
18+
align-items: center;
1919
}
2020

2121
.profilePageButton {
2222
display: flex;
2323
flex-direction: column;
24-
justify-items: center;
24+
align-items: center;
25+
26+
}
27+
28+
#astroButton {
29+
width: 5vw;
30+
min-width: 40px;
31+
32+
}
33+
34+
#earthButton {
35+
width: 5vw;
36+
min-width: 40px;
2537
}
2638

2739
a {
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
import "@testing-library/jest-dom";
2-
import { fireEvent, render, waitFor } from '@testing-library/react';
2+
import { fireEvent, render, screen } from "@testing-library/react";
3+
import userEvent from "@testing-library/user-event";
34
import React from "react";
45
import NavBar from "./NavBar";
5-
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
6-
import { createMemoryHistory } from "history";
6+
import {BrowserRouter} from "react-router-dom";
7+
import { createBrowserHistory } from "history";
78

89
describe(NavBar, () => {
910
it("Should change current location to profile when link is clicked", () => {
10-
const history = createMemoryHistory({ initialEntries: ["/"] });
11+
const history = createBrowserHistory({ window });
12+
render(
13+
<BrowserRouter>
14+
<NavBar />
15+
</BrowserRouter>,
16+
);
17+
const linkProfile = screen.getByText("Profile");
18+
userEvent.click(linkProfile);
1119
});
1220
});

src/Components/AddNavBar/NavBar.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from "react";
22
import "./NavBar.scss";
33
import { Link } from "react-router";
4-
4+
import imageAstro from "./Images/astronautcartoon.png";
5+
import imageEarth from "./Images/cartoon earth.png";
56

67
export default function NavBar() {
78
return (
@@ -10,15 +11,16 @@ export default function NavBar() {
1011
<nav className="navBarContainer">
1112
<div>
1213
<Link to="/" className="homeButton" id="homeLink">
13-
<img src="./Images/Earth.avif" alt="cartoon earth illustration" />
14+
<img src={imageEarth} alt="imageEarth" id="earthButton" />
1415
Home
1516
</Link>
1617
</div>
1718
<div>
1819
<Link to="profile" className="profilePageButton" id="profileLink">
1920
<img
20-
src="./Images/Astro.avif"
21+
src={imageAstro}
2122
alt="cartoon astronaut illustration"
23+
id="astroButton"
2224
/>
2325
Profile
2426
</Link>

src/custom.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module "*.png" {
2+
const value: string;
3+
export default value;
4+
}

0 commit comments

Comments
 (0)