i find difficulty to center the components always confuse about it . can please check it out ?
Gaurav Singh
@Gaurav4604All comments
- @Nayabi26Submitted about 1 year ago@Gaurav4604Posted about 1 year ago
Hi! Congratulations on completing the challenge, it looks great π₯³
I took a look at your index.css and styles.css files, I see you've used
margin: auto
to try and center your content, this is good, but css provides you with better tools such as flexbox and grid for more layout customizations.here are some reference links on how to use them:
Also, if you take a look at the design preview, you will see that the challenge expects you to have you
text-align: center
, on your text content, applying the same, will let your webpage be a more accurate representation of the design provided.Hope this was helpful π
Marked as helpful3 - @dothenghiaSubmitted almost 2 years ago
This is my first project that uses ReactJS. So there were a few confusions during the implementation of the project:
-
I haven't used Vite to create a ReactJS project and I had some trouble deploying the project to github => I followed this website and this video . But I find it quite annoying to have to create a branch, Is this a good way to push Vite project to github?
-
Is it a good idea for me to use 'useState' and pass them through props for the child component to change the parent component's state?
@Gaurav4604Posted almost 2 years agoHi! Congratulations on completing the challenge, it looks great π₯³
Iβll be answering your second question, Itβs normal to pass useState to the child component, to let it modify the data as a beginner, But the idea of React, is to build reusable components, which are meant to handle any environment.
(One example is the
<input>
component, which itself takes a value, and an onChange function callback, thus the input component is no longer responsible for handling the data, but rather, only displays any changes)So if you wanted to build a more robust version of RatingCard and ThankCard, You should structure it as follows.
<Rating rating={rating} OnRatingChange={(rating) => setRating(rating)} OnSubmit={(submit)=> setSubmit(submit)} />
And in the Rating.jsx file,
const activeHandle = (e) => { let activeOption = document.getElementsByClassName('active'); for (let option of activeOption) { option.classList.remove('active'); } e.target.classList.add('active'); props.onOptionChange(e.target.innerHTML); }
You can follow similar logic for submit as well.
Now you do not need to pass setState callback into the child component and let the child do the modifications
Hope this was helpful π
Marked as helpful1 -
- @izhuk5Submitted almost 2 years ago
Guys, maybe you can give me some tips to code html/css better. Thanks <3
@Gaurav4604Posted almost 2 years agoHi! Congratulations on completing the challenge π₯³
I have a few suggestions regarding CSS used
- Try to use relative units rather than absolute units wherever possible this might help you
position:absolute
should be used as a last resort, since it abstracts out the content from the website flow more about the same here- You seem to have specified the font family properly, but also make sure to include link to the right font family in html, or import in the css file hope this helps
Overall, Good work! The page looks pretty cool! π
Marked as helpful0 - @SvprnceSubmitted almost 2 years ago
How to Improve My Css ?
@Gaurav4604Posted almost 2 years agoHi! Congratulations on completing the challenge! π₯³
It looks great!
I found a few places where you could improve upon the CSS side of things:
- You could improve upon the use of responsive units for element sizing this might help you
- It seems you've used the Fraunces font family in all typography elements, I would encourage you to refactor the CSS file and also include Montserrat font family in the required element styles.
- You should also try to include all the specified font weights to ensure that the website looks similar to the design file
Other than these issues, the Challenge site looks great! keep up the good workπ
Marked as helpful0 - @GoranK89Submitted almost 2 years ago
Hello,
here I focused on practicing custom hooks, portal, conditional component rendering, and useReducer.
The Terms & Services link has a basic popup and there is a "fake" rudimentary loading and successful form submission message (the collected data is just displayed in the console).
The submit button is disabled until every input is filled out properly.
If I missed anything, please let me know! β
@Gaurav4604Posted almost 2 years agoHi! Congratulations on completing the challenge! It looks amazing π₯³.
I had a few ideas for the project (some of them are definitely over-engineered).
- Adding a placeholder div under the input, so that your input container, doesn't resize when the user fails the form-field validation
- Success/error based url routing react router helps for the same
- Transitions for the error states in the form you can try out this or this (more advanced)
- Simple redux store to record the form input and perform validation on the same redux toolkit helps focus on state independent from the component level state
Marked as helpful0 - @CryptoFallenSubmitted almost 2 years ago
I have an issue with the button the whole div expands vertically when hovering over the button, what is the best way to counteract that?
Other than the issue listed above, I had a great time building this static project. I have a lot of work still to do with learning the responsive layout.
@Gaurav4604Posted almost 2 years agoHi! Congratulations on completing the challenge π₯³. It looks pretty cool!
To answer your question, The reason why your div expands in size when you hover over the button, is: because of:
border: 1px solid var(--light-gray);
. This property adds an additional layout size to your button on hover. A quick fix for the same would be,.learn-more{ border: 1px solid transparent; } .learn-more:hover{ border: 1px solid var(--light-gray); }
This will allow you to have a placeholder border, with no visibility, that will already have adjusted the parent div's size from the start itself. Thus it will lead you to not, having a resize on hover.
Marked as helpful2 - @AbdellahbounabSubmitted almost 2 years ago
updated but still need improvement
@Gaurav4604Posted almost 2 years agoHi! Congratulations on completing the challenge! π₯³
It seems you might need to edit your code a lot, the mobile site seems broken with its layout. Some ways you can start with refactor is:
- abstract out the css into its own file
- use flexbox for structuring and alignment of your html elements
- make sure to make wise decisions as to when you should be using block/inline elements this would be helpful
- make sure that the image src for the nft used is accessible by your html (currently it is not)
- use relative units and media queries to adjust the css style properties according to the screen size this might be helpful
Marked as helpful0 - @katongole-isaacSubmitted almost 2 years ago
How can i improve my skills in web development
@Gaurav4604Posted almost 2 years agoHi! Congratulations on completing the challenge!π₯³
I have a few pointers as to where you can make changes
- use
<main id="root"><main>
as your react entry endpoint instead of<div id="root">
this helps with the accessibility of your webpage - include alt prop with a valid string, describing the image, again, this helps with the accessibility
- Try to include a
<h1>
tag describing the content of website, if you want, you can style it to have adisplay: "none"
, this is important, since this serves as a heading describing your site
Good Job on the challenge! If you have any doubts regarding react side of things, feel free to reach out.
Marked as helpful0 - use
- @Leeyah-123Submitted almost 2 years ago@Gaurav4604Posted almost 2 years ago
Hi! Congratulations on completing the challenge π₯³, It looks amazing
I would suggest a few HTML edits and one CSS edit:
- Try adding a
h1
tag in your page, to identify and describe the main content of the page. - Ensure that you use tags such as
main
, to describe the main section of your html body, this helps increase the accessibility of your page - You should definitely edit your breakpoint for a responsive design to be triggered at a lower width, at the moment, even laptops with 1024px screen width, will be rendering a mobile oriented design
Marked as helpful0 - Try adding a
- @NoraTailorSubmitted almost 2 years ago@Gaurav4604Posted almost 2 years ago
Hi! Your responsive solution looks amazing! I tried using the website on phone, and it looks great! π₯³
I do think the positioning, the sizing and the alignment of your elements for desktop can be implemented a bit better.
Also, the form error states can have a bit of a transition on them.
Since youβre using React, you can also allow for realtime form validation.
0 - @zuzanapiarovaSubmitted almost 2 years ago
Sign up form with validation done with Javascript
I had one problem I could not solve - I want the ( ! ) icons to move every time the user clicks on Submit when there is still any error field left. The animation works but only for the first time user clicks on Submit, not any other time. I tried many solutions in JS but it always moves only this first time. Any suggestions?
@Gaurav4604Posted almost 2 years agoHi! Your solution looks amazing! π₯³
I figured out how to solve your issue for repeated animation, on button click.
I have made a few edits to your code
function setError(element, message) { const parentEl = element.parentElement; //target inputs parent const errorMessage = parentEl.querySelector(".error-message"); //target first element in a parent with class 'error', this is the element that will display the error message errorMessage.innerHTML = message; //add error message into the element designated to display error parentEl.classList.add("error"); //add error class that changes style and visibility of elements const errorIcon = parentEl.querySelector(".error-icon"); errorMessage.style.visibility = "visible"; errorIcon.style.visibility = "visible"; if (parentEl.classList.contains("error")) { //should move error icon if submit is clicked but the field is still empty but does not work errorIcon.classList.add("animate"); } }
I changed the function to allow dynamic addition of classes, rather than explicitly specifying the same on the element itself (this is just good practice)
Now, for the main show!
form.addEventListener("submit", (e) => { //this function makes the submit button not reload right after if something is wrong - so if anything is wrong the page will not reload when hitting submit as it normally would e.preventDefault(); const errorIcons = document.querySelectorAll(".error-icon"); errorIcons.forEach((errorIcon) => errorIcon.classList.remove("animate")); setTimeout(() => { checkInputs(); }); });
Here I initially remove the class animate from error icon (if it exists on the errorIcon classList),
lastly, I invoke your checkInputs function, inside a setTimeout, this ensures that all the DOM related events are done executing before, the setTimeout codeBlock executes.
you can understand how the same works, in depth, here
If you want me to send you the complete solution, just say so! π
0 - @Noah2509Submitted almost 2 years ago
Any correction or amendment is highly welcome
@Gaurav4604Posted almost 2 years agoHi! Your solution looks amazing!π₯³
I would suggest a few changes to the CSS though.
- Try to use CSS variables to hold values such as colors
Also, it seems the font sizing and colors used for text elements (h3, p), seem a bit off. I suggest you take a look and refactor the same.
Otherwise, It looks awesome π€© !
Marked as helpful1