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
10 changes: 10 additions & 0 deletions newsletter-sign-up-with-success-message-main/css/colors.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
:root {
--red: hsl(4, 100%, 67%);
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 good practice to use css variables

--blue-800: hsl(234, 29%, 20%);
--blue-700: hsl(235, 18%, 26%);
--grey: hsl(0, 0%, 58%);
--white: hsl(0, 0%, 100%);
--black: hsl(0, 0%, 0%);
--box-shadow-pink: rgba(255, 83, 123, 0.35);
--input-background-error: #ffe6e6;
}
16 changes: 16 additions & 0 deletions newsletter-sign-up-with-success-message-main/css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.max-width {
width: 100%;
}
.flex-column {
display: flex;
flex-direction: column;
}
.font-weight-bold {
font-weight: 600;
}
.hidden {
display: none;
}
.block {
display: block;
}
222 changes: 222 additions & 0 deletions newsletter-sign-up-with-success-message-main/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
* {
margin: 0;
padding: 0;
}
body {
background-color: var(--blue-800);
font-family: "Work Sans", sans-serif;
}

.container {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.action-button {
border: none;
padding: 15px;
background-color: var(--blue-800);
border-radius: 5px;
color: var(--white);
font-size: 11px;
cursor: pointer;
transition: 0.2s ease-in;
}
.action-button:hover {
background: linear-gradient(90deg, hsl(347, 100%, 66%), hsl(13, 100%, 61%));
Copy link
Member

Choose a reason for hiding this comment

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

This as well can be saved inside css variable

box-shadow: 0 12px 20px var(--box-shadow-pink);
}

.signup-container {
display: flex;
align-items: center;
justify-content: space-between;
width: 650px;
height: 415px;
border-radius: 20px;
background-color: var(--white);
overflow: hidden;
margin: 20px;
}
.signup-form {
gap: 10px;
width: 290px;
padding-left: 40px;
}
.signup-form h1 {
font-size: 40px;
padding-bottom: 7px;
white-space: nowrap;
color: var(--blue-800);
}
.signup-form p {
font-size: 11.5px;
}
.list-container {
gap: 5px;
padding: 10px 0;
}
.list-item {
display: flex;
gap: 10px;
img {
width: 15px;
height: 15px;
}
}
.email-container {
gap: 6px;
padding-bottom: 5px;
}
.email-label-row {
display: flex;
justify-content: space-between;
align-items: center;
}
.input-error {
outline: 1px solid var(--red);
background-color: var(--input-background-error);
}
.error-msg {
color: var(--red);
font-size: 10px;
display: none;
}
.email-container label {
font-size: 10px;
color: var(--blue-800);
}
.email-input {
padding: 10px;
border: 1px solid var(--black);
box-sizing: border-box;
border-radius: 5px;
width: 100%;
}

.container-success {
width: 350px;
height: 330px;
background-color: var(--white);
border-radius: 15px;
padding: 25px 20px;
display: flex;
justify-content: space-around;
align-items: center;
display: none;
}
.signup-image {
width: 260px;
padding-right: 15px;
}

.success-content {
width: 300px;
justify-content: space-between;
gap: 20px;
}
.success-img {
width: 50px;
height: 50px;
}
.confirmation-success {
font-size: 12px;
padding-bottom: 10px;
}
.title-success {
font-size: 40px;
color: var(--blue-800);
}

@media (max-width: 700px) {
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 good but there is a new csss syntax for media quert, you can also use :

@media (width <= 1250px) {

.container {
margin: 0;
}
.signup-image {
display: none;
}
.signup-container {
width: 360px;
justify-content: center;
}
.signup-form {
padding: 0;
}
}

@media (max-width: 375px) {
.container {
margin: 0;
}
.signup-container {
height: 100vh;
width: 100vw;
margin: 0;
border-radius: 0px;
flex-direction: column-reverse;
justify-content: flex-end;
gap: 20px;
}
.signup-form {
width: 90%;
height: 100%;
justify-content: space-around;
padding-bottom: 20px;
}
.signup-form h1 {
font-size: 40px;
padding: 0;
white-space: normal;
}
.signup-form p {
font-size: 16px;
}
.list-container {
gap: 10px;
}
.signup-image {
display: block;
width: 100%;
padding: 0;
border-radius: 0px;
content: url("../assets/images/illustration-sign-up-mobile.svg");
}
.email-container input {
padding: 20px;
}

.container-success {
width: 100vw;
height: 100vh;
margin: 0;
border-radius: 0;
padding: 40px 24px;
display: flex;
justify-content: center;
align-items: flex-end;
box-sizing: border-box;
}

.success-content {
display: flex;
flex-direction: column;
gap: 24px;
}

.success-img {
width: 56px;
height: 56px;
}

.confirmation-success {
font-size: 15px;
margin-bottom: 200px;
}

#dismissBtn {
margin-top: 40px;
padding: 18px;
font-size: 14px;
}
}
96 changes: 96 additions & 0 deletions newsletter-sign-up-with-success-message-main/html/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="../assets/images/favicon-32x32.png"
/>
<link rel="stylesheet" href="../css/main.css" />
<link rel="stylesheet" href="../css/index.css" />
<link rel="stylesheet" href="../css/colors.css">
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&family=Work+Sans:ital,wght@0,100..900;1,100..900&display=swap"
rel="stylesheet"
/>
<title>
Frontend Mentor | Newsletter sign-up form with success message
</title>
</head>

<body>
<div class="container">
<div class="signup-container" id="signup">
<div class="signup-form flex-column">
<h1>Stay updated!</h1>
<p>Join 60,000+ product managers receiving monthly updates on:</p>
<div class="list-container flex-column">
<div class="list-item">
<img src="../assets/images/icon-list.svg" alt="icon-list" />
<p>Product discovery and building what matters</p>
</div>

<div class="list-item">
<img src="../assets/images/icon-list.svg" alt="icon-list" />
<p>Measuring to ensure updates are a success</p>
</div>

<div class="list-item">
<img src="../assets/images/icon-list.svg" alt="icon-list" />
<p>And much more!</p>
</div>
</div>
<div class="flex-column email-container ">
<div class="email-label-row">
<label class="font-weight-bold">Email address</label>
<span class="error-msg font-weight-bold">Valid email required</span>
</div>
<form id="signupForm" novalidate>
<input
id="emailInput"
class="email-input max-width"
type="email"
placeholder="email@company.com"
/>
</div>
<button
id="submitBtn"
class="action-button font-weight-bold"
type="submit"
>
Subscribe to monthly newsletter
</button>
</form>

</div>

<img
class="signup-image"
src="../assets/images/illustration-sign-up-desktop.svg"
/>
</div>

<div class="container-success">
<div>

<div class="flex-column success-content">
<img class="success-img" src="../assets/images/icon-success.svg">
<h1 class="title-success">Thanks for subscribing!</h1>
<p class="confirmation-success">
A confirmation email has been sent to <span id="successEmail"></span>. Please
open it and click the button inside to confirm your subscription.
</p>
<button id="dismissBtn" class="action-button font-weight-bold max-width">Dismiss message</button>
</div>
</div>

</div>
</div>
<script src="../js/main.js"></script>
</body>
</html>
Loading