Skip to content

Conversation

@DinaHK2806
Copy link

הוספתי בדף הHTML את התכונות והפקודות הרצויות והוספתי דף עיצוב CSS שבו מעוצב כל דף הHTML. בנוסף הוספתי תגית script שמפעילה את כפתור ההתחברות, בודקת האם המייל שהוכנס תקין, אם כן, היא מעבירה את המשתמש לדף הבא שבו הודעת ההתחברות עברה בהצלחה. אם לא, מעלה תגית שיש צורך במייל תקין.

Copy link

@GilHeller GilHeller left a comment

Choose a reason for hiding this comment

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

Great work. I left you some comments.

}

.title{
font-family: "Roboto", sans-serif;

Choose a reason for hiding this comment

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

Avoid repeating font-family.

You're defining font-family: Roboto many times across the stylesheet. Instead, consider setting a global default using:

:root {
  font-family: "Roboto", sans-serif;
  ....
}

padding-top: 60px;
}

.p1{

Choose a reason for hiding this comment

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

Consider renaming the class name to something more meaningful.

padding-top: 60px;
}

.p1{

Choose a reason for hiding this comment

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

You used the class only once. Consider convert it into id instead.

Comment on lines +70 to +71
border-color: hsl(0, 0%, 70%);
color: hsl(0, 0%,70%);

Choose a reason for hiding this comment

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

Use CSS variables instead of repeating colors.

:root {
  --neutral-gray: hsl(0, 0%, 70%);
}

....

border-color: var(--neutral-gray);
color: var(--neutral-gray);

Comment on lines +78 to +94
<script>
function login(){
const email=document.getElementById('email').value;
const emailInput = document.getElementById('email');
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if(emailRegex.test(email)){
document.querySelector('.box').style.display = 'none';
document.getElementById('success-box').style.display = 'block';
}
else{
document.getElementById('email-error').style.display = 'block';
emailInput.style.borderColor = 'hsl(4, 100%, 67%)';
emailInput.style.backgroundColor='hsl(4, 100%, 95%)';
}

}
</script>

Choose a reason for hiding this comment

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

Move inline JavaScript to a separate file.

Attach it in your HTML using:

<script src="index.js"></script>

Comment on lines +80 to +82
const email=document.getElementById('email').value;
const emailInput = document.getElementById('email');
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

Choose a reason for hiding this comment

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

Declare constants and cache DOM elements outside the function

Comment on lines +83 to +91
if(emailRegex.test(email)){
document.querySelector('.box').style.display = 'none';
document.getElementById('success-box').style.display = 'block';
}
else{
document.getElementById('email-error').style.display = 'block';
emailInput.style.borderColor = 'hsl(4, 100%, 67%)';
emailInput.style.backgroundColor='hsl(4, 100%, 95%)';
}

Choose a reason for hiding this comment

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

Apply Single Responsibility to your functions

Right now login() handles multiple concerns:
(1) email validation, and (2) resetting input styles/UI state.

Consider extracting those concerns into separate helper functions: isValidEmail() and resetInputState(). Then call them inside login()

function login() {
  resetInputState();

  const email = emailInput.value.trim();

  if (isValidEmail(email)) {
    formBox.style.display = "none";
    successBox.style.display = "block";
  } else {
    emailInput.classList.add("input-error");
    errorText.style.display = "block";
  }
}

Comment on lines +89 to +90
emailInput.style.borderColor = 'hsl(4, 100%, 67%)';
emailInput.style.backgroundColor='hsl(4, 100%, 95%)';

Choose a reason for hiding this comment

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

Avoid setting styles directly in JavaScript.
you can add a class and add/remove it when needed:

emailInput.classList.add("input-error");
emailInput.classList.remove("input-error");

justify-content: center;
}

.error-email{

Choose a reason for hiding this comment

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

Consider to use id instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants