Skip to content

Commit

Permalink
added a popup
Browse files Browse the repository at this point in the history
  • Loading branch information
nonoza committed May 6, 2024
1 parent 9a9f15a commit cf2de4b
Show file tree
Hide file tree
Showing 9 changed files with 330 additions and 3 deletions.
17 changes: 17 additions & 0 deletions assets/css/sections/popup.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* Error: Undefined variable.
* ,
* 13 | background: $almost-white;
* | ^^^^^^^^^^^^^
* '
* scss/sections/popup.scss 13:21 root stylesheet */

body::before {
font-family: "Source Code Pro", "SF Mono", Monaco, Inconsolata, "Fira Mono",
"Droid Sans Mono", monospace, monospace;
white-space: pre;
display: block;
padding: 1em;
margin-bottom: 1em;
border-bottom: 2px solid black;
content: "Error: Undefined variable.\a \2577 \a 13 \2502 background: $almost-white;\a \2502 ^^^^^^^^^^^^^\a \2575 \a scss/sections/popup.scss 13:21 root stylesheet";
}
1 change: 1 addition & 0 deletions assets/css/sections/popup.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

106 changes: 105 additions & 1 deletion assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -35900,6 +35900,111 @@ textarea.form-control-lg {
}
}

.popup-wrapper {
background: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100%;
position: fixed;
top: -21px;
display: none;
min-height: 100vh;
}
.popup-wrapper .popup {
text-align: center;
background: hsl(0, 0%, 98%);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
max-width: 400px;
margin: auto;
padding: 15px 10px;
position: relative;
color: #fff;
font-family: "Poppins", sans-serif;
font-size: 12px;
border-radius: 15px;
}
.popup-wrapper .popup h2, .popup-wrapper .popup .h2 {
font-size: 20px;
color: hsl(0, 0%, 8%);
margin: 20px 0 20px;
}
.popup-wrapper .popup .error-mgs {
color: red;
}
.popup-wrapper .popup input[type=email], .popup-wrapper .popup input[type=password], .popup-wrapper .popup input[type=text] {
width: 92%;
padding: 12px;
margin-bottom: 20px;
border-radius: 30px;
border: 2px solid hsl(0, 0%, 41%);
font-family: "Epilogue", sans-serif;
outline: none;
}
.popup-wrapper .popup button {
border: 2px solid hsl(0, 0%, 8%);
background: hsl(0, 0%, 8%);
color: hsl(0, 0%, 98%);
padding: 0.9rem 1.9rem;
border-radius: 18px;
font-weight: 500;
margin-bottom: 48px;
}
.popup-wrapper .popup button:hover {
border: 2px solid hsl(0, 0%, 41%);
background: transparent;
color: hsl(0, 0%, 41%);
border-radius: 18px;
padding: 0.9rem 1.9rem;
font-weight: 500;
transition: all 350ms ease-in-out;
}
.popup-wrapper .popup button:active {
border: 2px solid hsl(0, 0%, 41%);
background: transparent;
color: hsl(0, 0%, 41%);
border-radius: 18px;
padding: 0.9rem 1.9rem;
font-weight: 500;
}
.popup-wrapper .popup form {
position: relative;
top: 45px;
}
.popup-wrapper .popup form .snap-btn p {
color: hsl(0, 0%, 41%);
position: relative;
bottom: 31px;
}
.popup-wrapper .popup a.login-link, .popup-wrapper .popup a.register-link {
color: hsl(0, 0%, 8%);
text-decoration: none;
cursor: pointer;
}
.popup-wrapper .popup a.login-link:hover, .popup-wrapper .popup a.register-link:hover {
color: hsl(0, 0%, 41%);
}
.popup-wrapper .popup .popup-close {
position: absolute;
top: 8px;
right: 20px;
font-size: 30px;
cursor: pointer;
color: hsl(0, 0%, 8%);
}
.popup-wrapper .popup .popup-register {
display: block;
}
.popup-wrapper .popup .popup-login {
display: none;
}
.popup-wrapper .popup .popup-logo {
width: 30%;
margin: auto;
}

@font-face {
font-family: "epilogue-regular", sans-serif;
src: url("./fonts/Epilogue/static/Epilogue-Regular.ttf") format("truetype");
Expand All @@ -35924,7 +36029,6 @@ body {
}
@media (min-width: 992px) {
body {
max-width: 1400px;
margin: 0 auto;
}
}
Expand Down
2 changes: 1 addition & 1 deletion assets/css/style.css.map

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,41 @@ <h1 class="heading">Make remote work</h1>
</picture>
</div>
</section>

</main>
<!--popup-->
<div class=" popup-wrapper">
<div class="popup popup-register">
<div class ="popup-close">x</div>
<form>
<img src="images/logo.svg" alt="logo" class="popup-logo"/>
<h2>New Here? Register with us</h2>
<input type="text" placeholder="Enter Your Name" id="firstNname"/>
<input type="email" placeholder="Email Adress" id="email-address"/>
<input type="password" placeholder="Enter your password" id="password"/>
<p class="error-mgs"></p>
<div class="snap-btn" id="submit-btn" >
<button type="submit">Submit</button>
<p>Have an account? <a href="#" class="login-link">Login</a></p>
</div>
</form>
</div>
<!--login-->
<div class="popup popup-login">
<div class ="popup-close">x</div>
<form>
<img src="images/logo.svg" alt="logo" class="popup-logo"/>
<h2>Welcome Back! Please Log In</h2>
<input type="email" placeholder="Email Adress" id="email-address"/>
<input type="password" placeholder="Enter your password" id="password"/>
<p class="error-mgs"></p>
<div class="snap-btn" id="submit-btn" >
<button type="submit" >Submit</button>
<p>Don't have an account? <a href="#" class="register-link">Register</a></p>
</div>
</form>
</div>
</div>
<!-- Importing the js libaries as well as my js file-->
<script src="https://unpkg.com/[email protected]/dist/aos.js"></script>
<script src="./assets/js/bootstrap.bundle.js"></script>
Expand Down
66 changes: 66 additions & 0 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ window.addEventListener("load", () => {
let mobileIcon = document.querySelector(".navbar-toggler");
let mainMenu = document.querySelector(".main-menu");
let login = document.querySelector(".login");
let register = document.querySelector('.btn-outline');
const form = document.querySelectorAll('form');
const closeX = document.querySelectorAll('.popup-close');
const loginPopUp = document.querySelector('.popup-login');
const registerPopup = document.querySelector('.popup-register ');
const popup = document.querySelector('.popup-wrapper');
const loginLink = document.querySelector('.login-link');
const regsterLink = document.querySelector('.register-link');
const lastName = document.querySelector('#firstNname');
const email = document.querySelector('#email-address');
const password = document.querySelector('#password');
const errorMsg = document.querySelectorAll('.error-mgs');


//Dropdown icon switch
dropDownMenu.forEach((menu, index) => {
Expand Down Expand Up @@ -46,4 +59,57 @@ window.addEventListener("load", () => {

//Initialising AOS js library
AOS.init();

//script for popup
login.addEventListener('click',()=> {
popup.style.display = "flex";
registerPopup.style.display = "none";
loginPopUp.style.display = "block";
})

register.addEventListener('click',()=> {
popup.style.display = "flex";
registerPopup.style.display = "block";
loginPopUp.style.display = "none";
})

closeX.forEach( closebtn => {
closebtn.addEventListener('click',()=>{
popup.style.display = "none";
})
})


loginLink.addEventListener('click',()=>{
loginPopUp.style.display = "block";
registerPopup.style.display = "none";
});

regsterLink.addEventListener('click',()=>{
loginPopUp.style.display = "none";
registerPopup.style.display = "block";
})



form.forEach(form =>{
form.addEventListener('submit', e => {
e.preventDefault();
console.log('clicked');

// Validate the empty values
if (lastName.value.trim() === "" && email.value.trim() === "" && password.value.trim() === "" ) { // Trim any leading or trailing whitespace
errorMsg[0].textContent = "Enter your details";
errorMsg[1].textContent = "Enter your details";
} else {
// Clear any previous error messages
errorMsg[0].textContent = "";
}
});
})
});





1 change: 1 addition & 0 deletions scss/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$almost-white :hsl(0, 0%, 98%);
$medium-gray: hsl(0, 0%, 41%);
$almost-black:hsl(0, 0%, 8%);
$error-mg : red;

// Theme fonts
$brand-font: "Epilogue", sans-serif;
Expand Down
103 changes: 103 additions & 0 deletions scss/sections/popup.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
.popup-wrapper {
background:rgb(0,0,0,0.5);
width:100%;
height:100%;
position:fixed;
top: -21px;
display:none;
min-height: 100vh;


.popup {
text-align: center;
background: $almost-white;
display:flex;
flex-direction:column;
justify-content:center;
align-items:center;
width:100%;
max-width:400px;
margin:auto;
padding: 15px 10px;
position:relative;
color: #fff;
font-family: 'Poppins', sans-serif;
font-size: 12px;
border-radius: 15px;

h2 {
font-size: 20px;
color: $almost-black;
margin: 20px 0 20px;
}

.error-mgs {
color: $error-mg;
}
input[type="email"], input[type="password"] ,input[type="text"]{
width: 92%;
padding: 12px;
margin-bottom: 20px;
border-radius: 30px;
border: 2px solid $medium-gray;
font-family: $brand-font;
outline: none;
}

button {
@include btn-background;
margin-bottom: 48px;

&:hover {
@include btn-outline;
transition: all 350ms ease-in-out;
}

&:active {
@include btn-outline;
}
}
form {
position: relative;
top: 45px;

.snap-btn {
p {
color: $medium-gray;
position: relative;
bottom: 31px;
}


}
}
a.login-link,a.register-link{
color: $almost-black;
text-decoration: none;
cursor: pointer;
}
a.login-link:hover,a.register-link:hover {
color: $medium-gray
}
.popup-close {
position:absolute;
top:8px;
right:20px;
font-size:30px;
cursor:pointer;
color: $almost-black;
}
.popup-register {
display: block;
}
.popup-login {
display: none;
}
.popup-logo {
width: 30%;
margin: auto;
}
}


}
3 changes: 2 additions & 1 deletion scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//importing sections
@import "../scss/sections/navbar";
@import "../scss/sections/main.scss";
@import "../scss/sections/popup.scss";

//impoting typographu
@import "./typography";
Expand All @@ -16,7 +17,7 @@ body {
}

@include media-breakpoint-up(lg) { // Larger screens
max-width: 1400px;
// max-width: 1400px;
margin: 0 auto;
}
}

0 comments on commit cf2de4b

Please sign in to comment.