Skip to content

Commit

Permalink
Changing header component to use router links
Browse files Browse the repository at this point in the history
  • Loading branch information
carlyrichmond committed Apr 19, 2024
1 parent 7551049 commit e4ce4b1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 38 deletions.
66 changes: 32 additions & 34 deletions cake-game/src/components/header/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,43 +1,41 @@
import'./Header.css';
import elasticLogo from '../../assets/elastic-logo.png'
import { Link } from "react-router-dom";

import "./Header.css";
import elasticLogo from "../../assets/elastic-logo.png";

function Header() {
return (
<>
<header className="header">
<div className="header-container">
<div className="logo">
<a href="/" title="Elastic">
<img src={elasticLogo} alt="Elastic logo" />
</a>
<div className="header-container">
<div className="logo">
<Link data-testid="home-link" to={`/`} title="Elastic">
<img src={elasticLogo} alt="Elastic logo" />
</Link>
</div>
<ul>
<li>
<Link data-testid="play-link" to={`/play`} title="Elastic">
Play
</Link>
</li>
<li>
<Link data-testid="rules-link" to={`/`}>
Rules
</Link>
</li>
<li>
<a data-testid="github-link"
href="https://github.com/carlyrichmond/is-it-fake"
target="_blank">
GitHub
</a>
</li>
</ul>
</div>
<ul>
<li>
<a
href="/play"
target="_blank">
Play
</a>
</li>
<li>
<a
href="/rules"
target="_blank">
Rules
</a>
</li>
<li>
<a
href="https://github.com/carlyrichmond/is-it-fake"
target="_blank">
GitHub
</a>
</li>
</ul>
</div>
</header>
</header>
</>
)
);
}

export default Header
export default Header;
6 changes: 2 additions & 4 deletions cake-game/src/components/header/Header.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import Header from './Header';

test.use({ viewport: { width: 500, height: 500 } });

test('should work', async ({ mount }) => {
test('should render', async ({ mount }) => {
const component = await mount(<Header />);
await expect(component).toContainText('Play');
await expect(component).toContainText('Rules');
await expect(component).toContainText('GitHub');
expect(component).toBeDefined();
});

0 comments on commit e4ce4b1

Please sign in to comment.