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

Advice Generator App - HTML | CSS | JS

#accessibility#fetch#lighthouse
Faris Pβ€’ 2,810

@FarisPalayi

Desktop design screenshot for the Advice generator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


  • Added simple Intro transition animation
  • Shows a snackbar on request failure
  • Shows a simple loader while loading for advices
  • Fluidly responsive text
  • Keyboard accessible
  • Screen reader accessible
  • Progressively enhanced

Community feedback

Anna Leighβ€’ 5,135

@brasspetals

Posted

Hi, Faris! Awesome job on this solution! I really like the animations you've added, and the loader is a great touch. πŸ™Œ

My only suggestion for improvement would be to have the advice h2 and blockquote animate on every new quote not just the first time the page loads. In vanilla JS, I believe the only way to do this would be to put your animations in classes. Then in showRandomAdvice() you would first remove the animation classes from adviceElm & adviceElmID. After the rest of the function had finished, you would then re-add the classes so that the animations would run again.

Example for clarity:

adviceElm.classList.remove("animation");

getRandomAdvice()
// rest of your function, adding innerText, etc.

adviceElm.classList.add("animation");

Might be worth trying out just for fun. Again, great job on this one and looking forward to seeing your next solution! πŸ˜„

Marked as helpful

1

Faris Pβ€’ 2,810

@FarisPalayi

Posted

@brasspetals First off, thanks for the feedback/suggestion and for looking at my code.

About the suggestion, actually, It was my plan to add those transitions, and I did play with a bunch of animation effects too. But, since I looked at the site so many times that I got to a point where I couldn't really judge if certain things are better than others or not. So, in the end, I couldn't decide if I should implement it or not. So, I abandoned it. And I'm someone who kinda gets stuck between deciding minor things like a 10ms difference in the animation duration Β―_(ツ)_/Β―. But, now that you mentioned it, I think the current sudden transition is not working well with the overall look & feel of the site. So, thanks again for your suggestion, cuz, it's nice to have a fresh pair of eyes. So yeah, I'll be adding that.

1
Anna Leighβ€’ 5,135

@brasspetals

Posted

@FarisPalayi I feel you! I once spent nearly an hour messing with a cubic bezier curve for an animation. 🀣

1
Faris Pβ€’ 2,810

@FarisPalayi

Posted

@brasspetals Yeah, exactly πŸ˜‚. I know a bunch of projects in which I spent loads of time playing with the bezier curves and decided to go with something inbuilt like ease-in or linear in the end.

1
Faris Pβ€’ 2,810

@FarisPalayi

Posted

@brasspetals Added it πŸ™Œ. Before | After.

  • Even though it first seemed like just as simple as toggling animation classes, It created a bunch of problems like a long delay and long intervals when generating new advice. i.e. intro animation didn't work well for the "new advice animation". So, I used pure CSS for the intro animation and used a variable to keep track of the fetch request state, and ran the "new advice animation" only after the first successful fetch request. πŸ‘
1
Anna Leighβ€’ 5,135

@brasspetals

Posted

@FarisPalayi Sorry to hear it gave you more trouble than expected! πŸ€¦β€β™€οΈ Isn't that just the way it seems to go? The end result turned out great though! πŸ™Œ That little (or, not so little) bit of extra just makes it. πŸ’―

1
Faris Pβ€’ 2,810

@FarisPalayi

Posted

@brasspetals Yeah, it definitely is the way it goes, evry single timeπŸ˜„ (sometimes the opposite happens too, right?). Doing this has definitely helped me organize my CSS and also, I have forgotten to add button :focus styles, so, was able to add that. And as a new little feature/bugfix, I disabled the button while loading data to prevent multiple fetch requests. So, everything's considered, It wasn't as bad as I expected it to be, though. So, yeah, thanks, it was worth it. And thanks for your kind words, appreciate it :)

1
Kamasah-Dicksonβ€’ 5,610

@Kamasah-Dickson

Posted

I really like your solution it is really working well and all. Besides there are no ccessibility issuesπŸ“Œ

Good job Keep codingπŸ‘

1

Faris Pβ€’ 2,810

@FarisPalayi

Posted

@Kamasah-Dickson Thanks, appreciate it :)

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