Advice generator app. Vite+React, Typescript, framer-motion, Axios
Design comparison
Solution retrospective
HALLO👋
I'm getting used to typescript, but I still need more experience.
Anyway, any advice/critiques are welcomed💪
Community feedback
- @0xabdulkhaliqPosted over 1 year ago
Hello there 👋. Congratulations on successfully completing the challenge! 🎉
- I have other recommendations 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
orpadding
.
- We don't need to use
margin
andpadding
to center the component both horizontally & vertically. Because usingmargin
orpadding
will not dynamical centers our component at all states
- You already using
Flexbox
for layout, but you didn't utilized it's full potential. You properly centered the components, But why did you add margin's actually its serves no purpose.
- This may cause inconsistency on your design so remove the
margin
from the following elements, after removing you can able to see the changes
.main-advice-card { margin-top: auto; margin-bottom: 1rem; } ._footer_1ijzc_1 { margin-top: auto;
- Now your component has been properly centered, now we move on to next improvement.
- The
<footer">
element has been placed bottom usingmargin
. So let me explain, How you can place the component at bottom with usingfixed
positioning forfooter
- Luckily you already used
Flex
layout ofcss
to center the component, So you just want to addfixed
position for<footer>
element to place it in bottom of the page
footer { position: fixed; bottom: 1em; }
- Now remove these styles, after removing you can able to see the changes
.attribution { padding-top: 3em; }
- Now your component has been properly at bottom
.
I hope you find this helpful 😄 Above all, the solution you submitted is great !
Happy coding!
Marked as helpful1@BernardusPHPosted over 1 year ago@0xAbdulKhalid Thank you very much.
Man I am so used to just using
top,left,right and bottom
on fixed and absolute items that I forgot that they can be affected by flex too.But with fixed it might overlap with the main container but I believe that that is not an issue I should worry about.
Also I dont see the:
.attribution { padding-top: 3em; }
you are talking about can you tell me where you are seeing it?
0 - @bilalturkmenPosted over 1 year ago1@BernardusPHPosted over 1 year ago
@bilalturkmen Thx I played around with it and ended up removing the
position
on the footer.While also adding
margin-top:auto
to the main and footer that should fix the issue and make it look nice.1@bilalturkmenPosted over 1 year ago@BernardusPH yea it looks more effective.
maybe you can also add
margin-bottom: 1rem
for some space ;)1
Please log in to post a comment
Log in with GitHubJoin 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