Latest solutions
Personal Finance App with Next and Typescript
#next#shadcn#tailwind-css#typescript#zustandSubmitted about 2 months agoLink sharing app using Next JS, Typescript, Tailwind and Radix UI
#next#shadcn#tailwind-css#typescriptSubmitted 8 months ago
Latest comments
- @SebastianJakubowski95Submitted almost 2 years ago
- @tortarugaSubmitted 10 months agoWhat are you most proud of, and what would you do differently next time?
I'm proud I didn't toss the laptop or myself out the window, next time i'd go on a pilgrimage to compostela before doing the challenge to ask for the miracle of understanding grids
What challenges did you encounter, and how did you overcome them?The layout just kept doing whatever it wanted without my consent. In the end it didn't turn out too bad, but I wouldn't exactly say I overcame anything, since the content is still not aligned properly in the grid. I just gave up because I wanted to preserve what little sanity I have left. Also I had one hell of a hard time making that menu thing work in the mobile version, but my perseverance and refusal to bow to the whims of a dialog tag lead me to victory. Come through!
What specific areas of your project would you like help with?honestly i'm a mess at everything so any help is appreciated
- P@makogeborisSubmitted 10 months ago
- @KrishnaPoddar1Submitted about 1 year agoWhat specific areas of your project would you like help with?
The image and the card have been made relative and absolute but when you zoom in or out the card position keeps changing. Is there a better way to change it so that it looks good.
Any Advice or suggestions are welcomed
- @KrishnaPoddar1Submitted about 1 year agoWhat specific areas of your project would you like help with?
Any ideas/suggestions would be welcomed
- @ShilohGeorge12Submitted over 1 year ago@jownsuPosted over 1 year ago
Hello there 👋. Good job on completing the challenge !
Your solution looks great, and you've done a fantastic job overall! However, I have other small suggestions to make it even better:
Instead of hardcoding the text for the winner. You can create an objects with rules on it and another one for the result.
const RESULT = { "tie": "Tie Game", "win": "You win", "lose": "House win" }; const RULES = { "scissors" : "paper", "paper" : "rock", "rock" : "scissors" }; const [winner, setWinner] = useState(null);
Then you can make a function like this for computing the winner.
const calculateResult = (computerPicked) => { if(userPicked === computerPicked){ setWinner("tie"); } else if(RULES[userPicked] === computerPicked){ setWinner("win"); onWinCallback(); } else{ setWinner("lose"); onLoseCallback(); } }
Then you can render the result text like this.
return ( <div id="winner_text">RESULT[winner]</div> )
I hope you find it useful! 😄
Happy coding!
0