-
Notifications
You must be signed in to change notification settings - Fork 38
liron pr #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
liron pr #20
Changes from all commits
df9ae98
95a97b7
6018335
1803d67
5aa50f7
4739e66
8246d5e
936c000
d993189
e490ddd
820dba4
a0dbb18
da6cf88
e889adf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,10 @@ | |
| <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"> | ||
| <link type="text/css" href="./style.css" rel="stylesheet"> | ||
| <link rel="preconnect" href="https://fonts.googleapis.com"> | ||
pol2rd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
| <script src="./script.js" defer></script> | ||
|
|
||
| <title>Frontend Mentor | Newsletter sign-up form with success message</title> | ||
|
|
||
|
|
@@ -16,37 +20,54 @@ | |
| </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 --> | ||
| <article class="subscribe-form"> | ||
| <picture> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use div instead of picture
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but I have read the the best practice for having a picture's size dynamically change dependent of the screen's size is using |
||
| <source media="(max-width:375px)" srcset="assets\images\illustration-sign-up-mobile.svg"> | ||
| <source media="(max-width:528px)" srcset="assets\images\illustration-sign-up-tablet.svg"> | ||
| <img src="assets/images/illustration-sign-up-desktop.svg"> | ||
| </picture> | ||
| <main> | ||
| <div class="article-content"> | ||
| <h1>Stay updated!</h1> | ||
| <p>Join 60,000+ product managers recieving monthly updates on:</p> | ||
| <p> | ||
| <img src="./assets/images/icon-list.svg" class="icon-list"> | ||
| Product discovery and building what matters | ||
| </p> | ||
| <p> | ||
| <img src="./assets/images/icon-list.svg" class="icon-list"> | ||
| Measuring to ensure updates are a success | ||
| </p> | ||
| <p> | ||
| <img src="./assets/images/icon-list.svg" class="icon-list"> | ||
| And much more fun! | ||
| </p> | ||
| </div> | ||
| <form onsubmit="send(event)"> | ||
| <div class="labels"> | ||
| <label for="email-address">Email address</label> | ||
| <label class="invalid-email-label" for="email-address">valid email required</label> | ||
| </div> | ||
| <input type="email" id="email-address" name="email-address" placeholder="email@company.com" required oninvalid="invalidEmail()"> | ||
| <input type="submit" value="Subscribe to monthly newsletter"> | ||
| </form> | ||
| </main> | ||
| </article> | ||
|
|
||
| <!-- Success message start --> | ||
|
|
||
| Thanks for subscribing! | ||
|
|
||
| A confirmation email has been sent to ash@loremcompany.com. | ||
| Please open it and click the button inside to confirm your subscription. | ||
|
|
||
| Dismiss message | ||
|
|
||
| <article class="subscribe-success"> | ||
pol2rd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <header> | ||
pol2rd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <img src="./assets/images/icon-success.svg" class="success-icon"> | ||
| </header> | ||
| <h1>Thanks for subscribing!</h1> | ||
| <p>A confirmation email has been sent to <b></b>. | ||
| Please open it and click the button inside to confirm your subscription.</p> | ||
| <input type="button" value="Dismiss message"> | ||
| </article> | ||
| <!-- Success message end --> | ||
|
|
||
| <div class="attribution"> | ||
| <!-- <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> | ||
| Coded by <a href="#">Liron</a>. | ||
| </div> --> | ||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| function send(event) { | ||
| event.preventDefault(); | ||
| const form = event.target; | ||
| const data = new FormData(form); | ||
| const email = data.get("email-address"); | ||
| const subscribeForm = document.querySelector(".subscribe-form"); | ||
| const subscribeSuccessWindow = document.querySelector(".subscribe-success"); | ||
| subscribeForm.classList.add("active"); | ||
| document.querySelector(".subscribe-success p b").textContent = email; | ||
| subscribeSuccessWindow.classList.add("active"); | ||
| } | ||
|
|
||
| function invalidEmail() { | ||
| const emailInput = document.getElementById("email-address"); | ||
| const invalidEmailLabel = document.querySelector(".invalid-email-label"); | ||
| emailInput.classList.add("invalid"); | ||
| invalidEmailLabel.classList.add("invalid"); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,205 @@ | ||
| @font-face { | ||
| font-family:Roboto ; | ||
| src: url(./assets/fonts/Roboto-Regular.ttf); | ||
| } | ||
|
|
||
| :root { | ||
| --primary-bg-color: hsl(235, 18%, 26%); | ||
| --primary-color: hsl(234, 29%, 20%); | ||
| --hover-button-color: hsl(4, 100%, 67%); | ||
| --form-bg-color: hsl(0, 0%, 100%); | ||
| --form-input-color: hsl(0, 0%,58%); | ||
| } | ||
|
|
||
| html, body { | ||
| background-color: var(--primary-bg-color); | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| align-items: center; | ||
| font-family: "Roboto", sans-serif; | ||
| min-height: 100vh; | ||
| height: 100%; | ||
| } | ||
|
|
||
| @media(min-width: 529px) { | ||
| .subscribe-form { | ||
| max-height: 25rem; | ||
| max-width: 50rem; | ||
| flex-direction: row-reverse; | ||
| justify-content: space-between; | ||
| border-radius: 1.5rem; | ||
| padding: 1.25rem; | ||
| padding-left: 2rem; | ||
| gap: 2rem; | ||
| } | ||
| .subscribe-form picture { | ||
| max-width: 300px; | ||
| display: flex; | ||
| justify-content: end; | ||
| } | ||
| .subscribe-form main { | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| padding-left: 1rem; | ||
| padding-top: 1rem; | ||
| max-height: 370px; | ||
| } | ||
| .article-content { | ||
| max-width: 350px;; | ||
| } | ||
|
|
||
| .subscribe-form form { | ||
| margin-top: 1rem; | ||
| padding-bottom: 1rem; | ||
| max-width: 350px;; | ||
| } | ||
| .subscribe-success.active { | ||
| max-width: 340px; | ||
| height: 350px; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In stuff like border-radius, paddings , margings, try working with different measurments than percentages, rem is the most recommended and used one
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about width and height? and the breakpoints in the media queries? |
||
| border-radius: 1.5rem; | ||
| padding: 3rem; | ||
| } | ||
| } | ||
|
|
||
| @media(max-width: 528px) { | ||
| .subscribe-form { | ||
| height: 100%; | ||
| flex-direction: column; | ||
| padding-bottom: 1rem; | ||
| } | ||
| .subscribe-form main { | ||
| flex-direction: column; | ||
| } | ||
| .article-content { | ||
| padding: 2rem; | ||
| } | ||
| .subscribe-form form { | ||
| padding-left: 2rem; | ||
| padding-right: 2rem; | ||
| padding-bottom: 2rem; | ||
| } | ||
| .subscribe-form picture { | ||
| object-fit: cover; | ||
| border-bottom-left-radius: 1rem; | ||
| border-bottom-right-radius: 1rem; | ||
| } | ||
| article input[type=submit] { | ||
| margin-top: 1.5rem; | ||
| } | ||
| .subscribe-success.active { | ||
| height: 90%; | ||
| width: 90%; | ||
| padding: 10%; | ||
| } | ||
| } | ||
|
|
||
| .subscribe-form .icon-list { | ||
| float: left; | ||
| margin-right: 0.5rem; | ||
| } | ||
|
|
||
| .subscribe-form { | ||
| display: flex; | ||
| background-color: var(--form-bg-color); | ||
| color: var(--primary-color); | ||
| font-size: 1rem; | ||
| font-weight: 400; | ||
| margin: 0 auto; | ||
| } | ||
|
|
||
| .subscribe-form main { | ||
| display: flex; | ||
| } | ||
|
|
||
| .subscribe-form main h1 { | ||
| font-weight: 700; | ||
| font-size: 2.5rem; | ||
| line-height: 2rem; | ||
| position: relative; | ||
| } | ||
|
|
||
| .subscribe-form form { | ||
| display: flex; | ||
| flex-direction: column; | ||
| } | ||
|
|
||
| .subscribe-form label { | ||
| font-weight: 700; | ||
| font-size: 0.75rem; | ||
| } | ||
|
|
||
| input { | ||
| border-radius: 0.3rem; | ||
| border-width: 0.05rem; | ||
| border-color: var(--form-input-color); | ||
| color: var(--form-input-color); | ||
| margin-top: 0.5rem; | ||
| outline: 0; | ||
| height: 2rem | ||
| } | ||
|
|
||
| input[type=submit], input[type=button] { | ||
| background-color: var(--primary-color); | ||
| text-align: center; | ||
| color: var(--form-bg-color); | ||
| font-weight: 700; | ||
| border: none; | ||
| } | ||
|
|
||
| input[type=email] { | ||
| color: var(--primary-color); | ||
| } | ||
|
|
||
| #email-address.invalid { | ||
| border-color: var(--hover-button-color); | ||
| } | ||
|
|
||
| .invalid-email-label.invalid { | ||
| color: var(--hover-button-color); | ||
| } | ||
|
|
||
| .invalid-email-label { | ||
| color: var(--form-bg-color);; | ||
| } | ||
|
|
||
| .labels { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| } | ||
|
|
||
| input[type=submit]:hover, input[type=button]:hover { | ||
| background-color: var(--hover-button-color); | ||
| } | ||
|
|
||
| .subscribe-form.active{ | ||
| display: none; | ||
| } | ||
|
|
||
| .subscribe-success { | ||
| display: none; | ||
| } | ||
|
|
||
| .subscribe-success.active { | ||
| display: flex; | ||
| flex-direction: column; | ||
| background-color: var(--form-bg-color); | ||
| color: var(--primary-color); | ||
| font-size: 1rem; | ||
| font-weight: 400; | ||
| } | ||
|
|
||
| .subscribe-success.active h1 { | ||
| font-weight: 800; | ||
| font-size: 3em; | ||
| } | ||
|
|
||
| .subscribe-success.active p { | ||
| margin-top: -3%; | ||
| color: hsl(234, 29%, 20%); | ||
| } | ||
|
|
||
| .subscribe-success.active input[type=button] { | ||
| height: 50px; | ||
| margin-top: auto; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The structure and usage of elements here could be improved. Consider pasting your code into an AI to get suggestions for a cleaner, more semantic structure