This is a solution to the Advice generator app challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
This is an advice generator app that generates random advice using the Ron Swanson API.
Users should be able to:
- View the optimal layout for the app depending on their device's screen size
- See hover states for all interactive elements on the page
- Generate a new piece of advice by clicking the dice icon
- Solution URL: Solution URL
- Live Site URL: Live site URL
- I researched and found an api for the site.
- I used the api to generate a random advice.
- Since the api didn't return an id. I randomly generated one for each request.
- Parse the data and styled the entire site.
- Semantic HTML5 markup
- CSS custom properties
- Typescript
- Vite
Use this section to recap over some of your major learnings while working through this project. Writing these out and providing code samples of areas you want to highlight is a great way to reinforce your own knowledge.
To see how you can add code snippets, see below:
<h1>Some JS code I'm proud of</h1>
const generateQuoteOnLoad = async () => {
const figure = generateFigure();
await generateAdvice().then((advice) => {
if (quote) {
quote.textContent = `"${advice}"`;
}
if (header) {
header.textContent = "Advice" + " " + `${figure}`;
}
});
}
window.onload = generateQuoteOnLoad;
If you want more help with writing markdown, we'd recommend checking out The Markdown Guide to learn more.
I would like to use the quotes free api instead since that gives much more info about the author, tags, and more.
- MDN - This is an amazing article which helped me finally understand async/await. I'd recommend it to anyone still learning this concept.