Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
28 changes: 28 additions & 0 deletions newsletter-sign-up-with-success-message-main/email.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const emailPattern = document.getElementById("email");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the patterns but the element

const CCC = "#ccc"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should not be colors in here, they should sit inside css variable object, also ccc is not a good name, the name should indicate the color and not the hexa value

const WHITE = "white"

emailPattern.addEventListener("input", function () {
const email = emailPattern.value;
const pattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (email === "") {
emailPattern.style.borderColor = "CCC";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never style via js, only from css and dynamic classes

emailPattern.style.backgroundColor = "WHITE";
return;
}

if (pattern.test(email)) {
emailPattern.style.borderColor = "green";
emailPattern.style.backgroundColor = "#e6ffe6";
} else {
emailPattern.style.borderColor = "red";
emailPattern.style.backgroundColor = "#ffe6e6";
}
});

emailPattern.addEventListener("blur", function () {
if (emailPattern.value.trim() === "") {
emailPattern.style.borderColor = "CCC";
emailPattern.style.backgroundColor = "WHITE";
}
});
118 changes: 118 additions & 0 deletions newsletter-sign-up-with-success-message-main/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
@font-face {
font-family:Roboto ;
src: url(./assets/fonts/Roboto-Regular.ttf);
}




body {
background-color: hsl(234, 29%, 20%);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bring the colors from css variables

height: 100vh;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Roboto';
}


.container {
display: flex;
background: white;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here and for all of the similar places

width: 45%;
height: 55%;
border-radius: 25px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try not to mix different units, go with 1

overflow: hidden;
box-shadow: 0 10px 35px rgba(0,0,0,0.25);
}

#left-side {
display: flex;
flex-direction: column;
justify-content: center;
padding: 50px;
width: 43%;
height: auto;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need this? will it have any effect?

margin-left:15px;


}

#left-side h1 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you think of a better name than left side? what if this will not be on the left side in the future?

font-size: 50px;
margin-bottom: 20px;
}

#left-side p {
font-size: 14px;
margin-bottom: 20px;
line-height:1.45;
}
#left-side ul {
padding: 0;
margin: 0 0 30px 0;
}

#left-side li {
list-style: none;
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 12px;
font-size: 15px;
}

#left-side img {
width: 20px;
}

label {
font-size: 12px;
font-weight: bold;
margin-bottom: 8px;
}

input {
padding: 12px;
border-radius: 8px;
border: 1px solid #ccc;
width: 95%;
font-size: 14px;
margin-bottom: 15px;
transition: 0.3s ease;
}

button {
background-color: hsl(234, 29%, 20%);
color: white;
padding: 14px;
border-radius: 8px;
border: none;
font-size: 14px;
cursor: pointer;
width: 103%;
}

button:hover {
background-color: hsl(4, 100%, 67%);
}


#right-side {
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #ff4664, #ff8f40);
width: 390px;
margin: 20px 20px 20px 0;
border-radius: 15px;
}

#right-side img {
width: 100%;
height: auto;

}


73 changes: 35 additions & 38 deletions newsletter-sign-up-with-success-message-main/index.html
Original file line number Diff line number Diff line change
@@ -1,52 +1,49 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- displays site properly based on user's device -->

<link rel="icon" type="image/png" sizes="32x32" href="./assets/images/favicon-32x32.png">

<title>Frontend Mentor | Newsletter sign-up form with success message</title>

<!-- Feel free to remove these styles or customise in your own stylesheet 👍 -->
<style>
.attribution { font-size: 11px; text-align: center; }
.attribution a { color: hsl(228, 45%, 44%); }
</style>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Asher Pe'er</title>
<link rel="stylesheet" href="index.css">
<link rel="font" href="https://fonts.google.com/specimen/Roboto">
</head>
<body>

<!-- Sign-up form start -->

Stay updated!

Join 60,000+ product managers receiving monthly updates on:

Product discovery and building what matters
Measuring to ensure updates are a success
And much more!

Email address
email@company.com

Subscribe to monthly newsletter

<!-- Sign-up form end -->

<!-- Success message start -->

Thanks for subscribing!
<body>

A confirmation email has been sent to ash@loremcompany.com.
Please open it and click the button inside to confirm your subscription.
<div class="container">
<div id="left-side">
<h1>Stay update!</h1>
<p>
Join 60,000+ product managers receiving monthly updates on:
</p>

<ul>
<li><img src="assets/images/icon-list.svg" alt="">Product discovery and building what matters</li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty alt means nothing in terms of accessibility

<li><img src="assets/images/icon-list.svg" alt="">Measuring to ensure updates are a success</li>
<li> <img src="assets/images/icon-list.svg" alt="">And much more!</li>
</ul>

<label for="email">Email address</label>
<input type="email" id="email" placeholder="email@company.com">

<form>
<button type="submit">Subscribe to monthly newsletter</button>
</form>


</div>

<div id="right-side">
<img src="assets/images/illustration-sign-up-desktop.svg" alt="">
</div>
</div>

Dismiss message

<!-- Success message end -->

<div class="attribution">
Challenge by <a href="https://www.frontendmentor.io?ref=challenge" target="_blank">Frontend Mentor</a>.
Coded by <a href="#">Your Name Here</a>.
</div>
<script src="email.js"></script>
</body>

</html>