Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Flexbox & Grid & JS Mobile First - Tip Calculator App

@tufcoder

Desktop design screenshot for the Tip calculator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


What are you most proud of, and what would you do differently next time?

Just seeing it work makes me happy. I used different "eventListeners" such as input, focus, blur and submit.

What challenges did you encounter, and how did you overcome them?

In the layout I have difficulty adjusting the size of the items within the display grid, it always takes me a while to get the result right.

In JavaScript it was difficult to get the Regex right but as soon as I got it the rest started flowing with the help of event listeners.

What specific areas of your project would you like help with?

If possible, I would like to know if I am using listeners optimally, without exaggeration.

Community feedback

@0xabdulkhaliq

Posted

Hello there 👋. Congratulations on successfully completing the challenge! 🎉

  • I have a suggestion regarding your code that I believe will be of great interest to you.

CSS 🎨:

  • Looks like the component has not been centered properly. So let me explain, How you can easily center the component without using margin.
  • We don't need to use margin to center the component both horizontally & vertically. Because it will not dynamical centers our component for all screen sizes.
  • To properly center the component in the page, you should use Flexbox or Grid layout. You can read more about centering in CSS here 📚.
  • For this demonstration we use css Grid to center the component.
body {
    min-height: 100vh;
    display: grid;
    place-items: center;
}
  • Now remove these styles, after removing you can able to see the changes
.container {
  margin-block: 3rem;
  margin-inline: auto;
}

@media (min-width: 90rem) {
  .container {
    margin-block: 10rem;
  }
}
  • Now your component has been properly centered

.

I hope you find this helpful 😄 Above all, the solution you submitted is great !

Happy coding!

Marked as helpful

1

@R3ygoski

Posted

Olá Oswaldo parabéns pela conclusão do seu projeto, ele está funcionando da maneira correta, e além disso ainda está muito semelhante ao design proposto. Meus parabéns.

Sobre sua duvida com os Listerners, eu diria que não está um pouco exagerado, vou pegar um caso para mostrar o porque, no seus listerners em bill, ele cham a função handleInputBill ao entrar em foco e ao ser digitado. Sobre ser digitado faz sentido, até porque você tem que verificar o Input, mas no focus ele também faz essa verificação toda vez o que acaba não sendo necessário.

Bom é isso, não sei se expliquei bem, caso não tenha ficado claro, já peço desculpa

Marked as helpful

0

@tufcoder

Posted

@R3ygoski Obrigado pelo feedback!

Só pra avisar, estou repetindo o evento de input no focus, só por causa da minha borda vermelha de erro. Se você digitar algo inválido pelo regex a borda fica vermelha. Se vc digitar algo inválido e clicar fora do input e clicar novamente no input (aí entra o focus) ativa a borda vermelha novamente :)

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord