Skip to content

Conversation

@jipark92
Copy link

@jipark92 jipark92 commented Jul 7, 2022

No description provided.

@jipark92 jipark92 changed the title upload WIP: feature/ratings2 Jul 7, 2022
Copy link

@linytas linytas left a comment

Choose a reason for hiding this comment

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

The way you handled the rating component was very intelligent, and I learned a lot from it. So if my comments confuse you, please let me know and I hope you do well.

const [disableCss, setDisableCss] = useState<string>("");
const [ratingLabel, setRatingLabel] = useState<string>("");

const starLabel: any = {
Copy link

Choose a reason for hiding this comment

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

I really like what you did with labels here, but it would be better if you could allow users to customize labels. Maybe we could use prop, maybe something else. Also, I would like to see these labels applied to fraction of stars.

Copy link
Author

Choose a reason for hiding this comment

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

ok! i am still having some trouble with the half-star logic so I will continue my research until I can find a solution.

Copy link
Author

Choose a reason for hiding this comment

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

I added the custom hover label feature without the half star logic for now otherwise it works for the whole stars.

Copy link

Choose a reason for hiding this comment

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

Great, your custom label work perfectly! look forward to merge the half star feature into your component!

// return starArray
// }

return (
Copy link

Choose a reason for hiding this comment

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

Wonderful, so far everything is perfect and full of logic. Only thing we may need is a function to handle precision of the rating (or simply, half star). I believe the use of the <style> element is a good way to implement this requirement. Also, you can use MouseEvent.clientX and Element.getBoundingClientRect() to get the current hovering index of star, which help me a lot and I believe it will help you too.

Copy link
Author

Choose a reason for hiding this comment

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

thank you I will try that out too.

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