-
Notifications
You must be signed in to change notification settings - Fork 3
Reut PR #3
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?
Reut PR #3
Changes from all commits
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 |
|---|---|---|
| @@ -1,52 +1,84 @@ | ||
| <!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 --> | ||
| <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"> | ||
|
|
||
| <title>Frontend Mentor | Newsletter sign-up form with success message</title> | ||
| <link rel="stylesheet" href="styles.css"> | ||
| <script src="script.js" defer></script> | ||
|
|
||
| <!-- 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> | ||
| </head> | ||
| <body> | ||
| <!-- Font --> | ||
|
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. Remove the comments, they are not very helpfull |
||
| <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:wght@400;700&display=swap" rel="stylesheet"> | ||
|
|
||
| <!-- Sign-up form start --> | ||
| <title>Frontend Mentor | Newsletter sign-up form with success message</title> | ||
| </head> | ||
|
|
||
| Stay updated! | ||
| <body> | ||
|
|
||
| Join 60,000+ product managers receiving monthly updates on: | ||
| <!-- מסך הטופס הראשי --> | ||
|
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. Ok so no comments and even more no Hebrew comments ok? |
||
| <div class="main_container"> | ||
| <div class="left_container"> | ||
|
|
||
| Product discovery and building what matters | ||
| Measuring to ensure updates are a success | ||
| And much more! | ||
| <header class="header">Stay updated!</header> | ||
| <div>Join 60,000+ product managers receiving monthly updates on:</div> | ||
|
|
||
| Email address | ||
| email@company.com | ||
| <div class="check_list"> | ||
| <div> | ||
| <img class="icon-list" src="assets/images/icon-list.svg" alt=""> | ||
|
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. Empty alt does not do anything |
||
| Product discovery and building what matters | ||
| </div> | ||
| <div> | ||
| <img class="icon-list" src="assets/images/icon-list.svg" alt=""> | ||
|
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 here you wrote |
||
| Measuring to ensure updates are a success | ||
| </div> | ||
| <div> | ||
| <img class="icon-list" src="assets/images/icon-list.svg" alt=""> | ||
| And much more! | ||
| </div> | ||
| </div> | ||
|
|
||
| Subscribe to monthly newsletter | ||
| <div class="email_container"> | ||
| <div class="email_row"> | ||
| <label class="email_label">Email address</label> | ||
| <span class="email_error">Valid email required</span> | ||
| </div> | ||
| <input class="email_box" type="email" id="email" placeholder="email@company.com"> | ||
|
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. Why do you need both class and id? |
||
| </div> | ||
|
|
||
| <!-- Sign-up form end --> | ||
| <button class="button subscribe-btn">Subscribe to monthly newsletter</button> | ||
| </div> | ||
|
|
||
| <!-- Success message start --> | ||
| <div class="right_container"> | ||
| <!-- for desktop --> | ||
| <img class="image image-desktop" src="./assets/images/illustration-sign-up-desktop.svg" alt=""> | ||
| <!-- for mobile --> | ||
| <img class="image image-mobile" src="./assets/images/illustration-sign-up-mobile.svg" alt=""> | ||
| </div> | ||
| </div> | ||
|
|
||
| Thanks for subscribing! | ||
| <!-- מסך הצלחה --> | ||
| <div class="success_container"> | ||
| <div class="success_content"> | ||
| <div class="success_icon"> | ||
| <img src="./assets/images/icon-success.svg" alt="Success"> | ||
| </div> | ||
|
|
||
| A confirmation email has been sent to ash@loremcompany.com. | ||
| Please open it and click the button inside to confirm your subscription. | ||
| <h1 class="success_title">Thanks for subscribing!</h1> | ||
|
|
||
| Dismiss message | ||
| <p class="success_text"> | ||
| A confirmation email has been sent to | ||
| <span class="success-email">ash@loremcompany.com</span>. | ||
| Please open it and click the button inside to confirm your subscription. | ||
| </p> | ||
|
|
||
| <!-- 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>. | ||
| <button class="button dismiss-btn">Dismiss message</button> | ||
|
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. Can you give this button a more specific name? |
||
| </div> | ||
| </div> | ||
|
|
||
| </body> | ||
| </html> | ||
|
|
||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| const emailInput = document.getElementById("email"); | ||
| const errorText = document.querySelector(".email_error"); | ||
| const subscribeBtn = document.querySelector(".subscribe-btn"); | ||
|
|
||
| const mainContainer = document.querySelector(".main_container"); | ||
| const successContainer = document.querySelector(".success_container"); | ||
| const successEmailSpan = document.querySelector(".success-email"); | ||
| const dismissBtn = document.querySelector(".dismiss-btn"); | ||
|
|
||
| function isValidEmail(email) { | ||
| return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email); | ||
|
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. The regex should be saved inside a constant variable for example |
||
| } | ||
|
|
||
| emailInput.addEventListener("input", function () { | ||
| const email = emailInput.value.trim(); | ||
|
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. I would add |
||
|
|
||
| if (email === "") { | ||
| emailInput.classList.remove("error"); | ||
| errorText.style.visibility = "hidden"; | ||
|
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. We dont want to style directly from here, use css and class named like above |
||
| return; | ||
| } | ||
|
|
||
| if (!isValidEmail(email)) { | ||
| emailInput.classList.add("error"); | ||
| errorText.style.visibility = "visible"; | ||
| } else { | ||
|
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. You could add a return statement in here for early return like you did before |
||
| emailInput.classList.remove("error"); | ||
| errorText.style.visibility = "hidden"; | ||
| } | ||
| }); | ||
|
|
||
| // לחיצה על Subscribe | ||
| subscribeBtn.addEventListener("click", function () { | ||
| const email = emailInput.value.trim(); | ||
|
|
||
| if (!isValidEmail(email)) { | ||
| emailInput.classList.add("error"); | ||
| errorText.style.visibility = "visible"; | ||
| return; | ||
| } | ||
|
|
||
| successEmailSpan.textContent = email; | ||
| mainContainer.style.display = "none"; | ||
| successContainer.style.display = "flex"; | ||
| }); | ||
|
|
||
| // לחיצה על Dismiss חוזרים למסך הראשי | ||
| dismissBtn.addEventListener("click", function () { | ||
| successContainer.style.display = "none"; | ||
|
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. Take all of my comments and apply them into this file as well |
||
| mainContainer.style.display = "flex"; | ||
|
|
||
| emailInput.value = ""; | ||
| emailInput.classList.remove("error"); | ||
| errorText.style.visibility = "hidden"; | ||
| }); | ||
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.
Why do you need the defer? whats the meaning of it?
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.
defer tells the browser to load the script in parallel but execute it only after the HTML has fully loaded. I understand it's not strictly required in this case, but in general I find it useful.
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.
Ye juat wanted to know that you know what you are doing and not blindly accepy ai changes