Git Product home page Git Product logo

advice-generator's Introduction

Frontend Mentor - Advice generator app solution

This is a solution to the Advice generator app challenge on Frontend Mentor.

Table of contents

Note: Delete this note and update the table of contents based on what sections you keep.

Overview

The challenge

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

Screenshot

When Code Works

When there is an error, e.g Internet Connection.

Links

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • Mobile-first workflow
  • Javascript
  • API Integration
  • Async/Await

What I learned

I really learnt alot in this project. I learnt how to use the fetch API to fetch data from an API. I also improved in my css styling and learnt new ways to structure my code better. I also learnt how to handle errors using the try/catch syntax that async/await provides. I also learnt how to handle events better in Javascript. I also learnt how to use Dom manipulation to dynamically update the content of the webpage.

To see how you can add code snippets, see below:

<marquee direction="ltr" scrollamount="8">Click on the dice to load new advice</marquee>
.dice{
    position: absolute;
    bottom: -25px;
    background-color: hsl(150, 100%, 66%);
    left: 50%;
    transform: translate(-50%, 0);
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    cursor: pointer;
}
let timestamp = Date.now(); // Get current timestamp
let url = `https://api.adviceslip.com/advice?timestamp=${timestamp}`; // Append timestamp as a query parameter
let response = await fetch(url);
let data = await response.json();

Continued development

  • Async/Await.
  • Timestamps.
  • Caching with API integration.

Author

Acknowledgments

I give great thanks to my Lord and Saviour Jesus Christ for making me see this project through. He really lead me through the internet to see I came out with something great

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.