Skip to content

Commit ba3cf79

Browse files
committed
made logo clickable and link it to the home
1 parent 668f921 commit ba3cf79

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

src/components/common/logo.jsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
import React from "react";
2+
import { Link } from "react-router-dom";
23

34
import INFO from "../../data/user";
45

56
import "./styles/logo.css";
67

78
const Logo = (props) => {
8-
const { width } = props;
9+
let { width, link } = props;
10+
11+
if (link === undefined) {
12+
link = true;
13+
}
14+
15+
const imageElement = (
16+
<img src={INFO.main.logo} alt="logo" className="logo" width={width} />
17+
);
918

1019
return (
1120
<React.Fragment>
12-
<img
13-
src={INFO.main.logo}
14-
alt="logo"
15-
className="logo"
16-
width={width}
17-
/>
21+
{link ? <Link to="/">{imageElement}</Link> : imageElement}
1822
</React.Fragment>
1923
);
2024
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
.logo {
22
border-radius: 50%;
3+
display: block;
4+
margin: 0;
5+
padding: 0;
36
}

src/pages/homepage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const Homepage = () => {
7272
<div className="content-wrapper">
7373
<div className="homepage-logo-container">
7474
<div style={logoStyle}>
75-
<Logo width={logoSize} />
75+
<Logo width={logoSize} link={false} />
7676
</div>
7777
</div>
7878

0 commit comments

Comments
 (0)