Skip to content

Commit ea1265e

Browse files
committed
modal:built the modal popup
1 parent bf7e42c commit ea1265e

File tree

5 files changed

+47
-11
lines changed

5 files changed

+47
-11
lines changed

src/App.js

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { useState } from "react";
22
import "../src/styles/styles.css";
33
import Nav from "./Nav";
44
import Homepage from "./components/Homepage";
@@ -7,12 +7,46 @@ import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
77
import Place from "./components/Place";
88

99
function App() {
10+
const overlay = {
11+
background: "rgba(64, 64, 64, 0.3)",
12+
position: "fixed",
13+
top: 0,
14+
bottom: 0,
15+
left: 0,
16+
right: 0,
17+
zIndex: 6,
18+
};
19+
const modal = {
20+
position: "fixed",
21+
background: "white",
22+
top: "50%",
23+
left: "50%",
24+
transform: "translate(-50%,-50%)",
25+
zIndex: 6,
26+
27+
width: "50%",
28+
height: "50%",
29+
display: 'flex',
30+
flexDirection: 'column',
31+
padding:'1rem'
32+
};
33+
const [showModal, setshowModal] = useState(false);
1034
return (
1135
<Router>
1236
<>
13-
<Nav />
37+
{showModal ? (
38+
<div style={overlay}>
39+
<div style={modal}>
40+
<button onClick={() => setshowModal(false)}>CLOSE MODAL</button>
41+
</div>
42+
</div>
43+
) : (
44+
""
45+
)}
46+
<Nav setshowModalTrue={() => setshowModal(true)} />
1447
<Routes>
1548
<Route path="/" element={<Homepage />} />
49+
1650
<Route path="/place" element={<Place />} />
1751
</Routes>
1852
<Footer />

src/Nav.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ import logo from "../src/images/meta.png";
66
import Button from "./components/Button";
77
import { faBars } from "@fortawesome/free-solid-svg-icons";
88
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
9-
import { Link } from 'react-router-dom'
9+
import { Link } from 'react-router-dom';
10+
11+
12+
function Nav({setshowModalTrue}) {
1013

11-
function Nav() {
1214
return (
1315
<section className="nav--container grid">
1416
<div className="nav-section_content">
@@ -26,8 +28,8 @@ function Nav() {
2628
</nav>
2729
<div>
2830
{" "}
29-
<Button name="Connect wallet" styleclass="nav-btn" />
30-
</div>
31+
<Button name="Connect wallet" styleclass="nav-btn" clicked={setshowModalTrue} />
32+
</div>
3133
<div className="hamburger-menu">
3234
<FontAwesomeIcon icon={faBars} className="hamburger-menu" />
3335
</div>

src/components/Button.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React from "react";
2-
import "../styles/button.css"
2+
import "../styles/button.css";
33

4-
function Button({name,styleclass,children}) {
5-
return <button className={`btn ${styleclass}`}>{name}
6-
{children}</button>;
4+
function Button({ name, styleclass,clicked }) {
5+
return <button onClick={clicked} className={`btn ${styleclass}`}>{name}</button>;
76
}
87

98
export default Button;

src/styles/nav.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
display: flex;
88
justify-content: space-between;
99
align-items: center;
10+
flex-wrap:wrap ;
1011
}
1112
.logo--container {
1213
display: flex;

src/styles/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
}
88
body {
99
font-family: "Red Rose";
10+
1011
}
1112
:root {
1213
--purple: linear-gradient(90deg, #a02279 11.45%, #a02279 11.46%);
@@ -37,4 +38,3 @@ html {
3738
.purp {
3839
color: var(--purple);
3940
}
40-

0 commit comments

Comments
 (0)