Skip to content

Commit

Permalink
init commit!
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinusey committed Apr 15, 2024
1 parent bf396af commit d5c12b7
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
134 changes: 134 additions & 0 deletions app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
--primary-color: rgb(67, 140, 208);
font-family: sans-serif;
min-height: 100vh;
background-color: #eee;
}

button {
padding: .5rem 1rem;
border-radius: .25rem;
background-color: var(--primary-color);
border: none;
color: white;
cursor: pointer;
}

.overlay {
position: absolute;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
height: 100vh;
width: 100%;
padding: 1rem;
place-items: center;
display: none;
z-index: 10;
}

.modal {
width: 100%;
max-width: 500px;
background-color: white;
padding: 1rem;
border-radius: .5rem;
box-shadow: 0 0 12px 0 rgba(0, 0, 0, 0.15);
animation: fadeIn .5s ease forwards;
}

form {
display: flex;
flex-direction: column;
gap: .25rem;
}

form input {
width: 100%;
padding: .5rem;
border: 1px solid #ccc;
border-radius: .25rem;
outline: none;
}

form .group {
display: flex;
justify-content: space-between;
align-items: center;
}

form .group:first-of-type {
margin-top: .5rem;
margin-bottom: 1rem;
}

form .group:last-of-type {
margin-top: 2rem;
}

form .group p:last-of-type {
background-color: #eee;
height: 2rem;
width: 2rem;
border-radius: 50%;
display: grid;
place-items:center;
color: #333;
cursor: pointer;
transition: all .2s ease;
}
form .group p:last-of-type:hover {
background-color: #ccc;
color: white;
}

form .group a {
color: var(--primary-color);
text-decoration: none;
}



/* nav */
nav {
background-color: white;
padding: 1rem;
position: fixed;
top: 0;
width: 100%;
}

nav .wrapper {
margin: 0 auto;
width: 100%;
max-width: 800px;
display: flex;
justify-content: space-between;
align-items: center;
}

nav h1 {
color: var(--primary-color);
}

nav h1 span {
font-weight: 100;
opacity: 0.6;
}

@keyframes fadeIn {
0% {
opacity: 0;
margin-top: -3rem;
}
100% {
opacity: 1;
margin-top: 0;
}
}
6 changes: 6 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const overlay = document.getElementById("overlay");
const login = document.getElementById("login");

login.addEventListener("click", () => {
overlay.style.display = "grid";
});
37 changes: 37 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./app.css" />
<title>JS-MODAL</title>
</head>
<body>
<!-- overlay -->
<div class="overlay" id="overlay">
<div class="modal">
<form>
<div class="group">
<p>Login to your account</p>
<p>x</p>
</div>
<input type="text" placeholder="Username" />
<input type="password" placeholder="Password" />
<div class="group">
<a href="#">New here? Sign up!</a>
<button>Login</button>
</div>
</form>
</div>
</div>

<!-- nav -->
<nav>
<div class="wrapper">
<h1>JS<span>MODAL</span></h1>
<button id="login">Login</button>
</div>
</nav>
<script src="./app.js"></script>
</body>
</html>

0 comments on commit d5c12b7

Please sign in to comment.