Giter Site home page Giter Site logo

talk-hdm-svelte's Introduction

HDM - Entwicklung von Webanwendungen - Svelte 101

Setup

  • Make sure to have Node.js installed. You can download it here if necessary: https://nodejs.org/en/download
  • Execute the following commands to clone the repo, install the dependencies and start the dev server:
    git clone [email protected]:inovex/talk-hdm-svelte.git # clone the repo
    cd talk-hdm-svelte
    npm install # install external dependencies
    npm start # start the dev server that serves the application locally
  • Navigate to http://localhost:5173/ in your browser

Assignment

Assignment 1

In the directory /src/lib you'll find a client for an API that returns weather data. The client provides only method (getWeatherData) that can be used to retrieve the current weather data asynchronously.

The returned object has the following structure:

type WEATHER_TYPE = 'SUN' | 'SUN_CLOUDY' | 'CLOUDY' | 'RAIN' | 'SNOW'

WeatherData {
  type: WEATHER_TYPE
  temperatureCelsius: number
  humidityPercent: number
  windKmH: number
}

Implement a component that on first render pulls the data from the remote API and renders the data on the screen.

To illustrate the weather types, use the following emojis that correspond to the types returned by the weather API: ☀️ ⛅ ☁️ 🌧️ 🌨️

Bonus-Assignment: Render a button that refreshes the weather data on every mouse click.

Assignment 2

Refactor the previous example so that the weather data is being retrieved continuously e.g. every second. Provide this data in your application so that it can be consumed from any arbitrary component. Store all the accumulating data points. Hint: A good solution would be the usage of a writable store! (https://svelte.dev/tutorial/writable-stores)

Refactor the component from the previous assignment to always display the latest weather information.

Implement a second component that renders the history of weather data points.

Bonus-Assignment: Vor each Value, render an Arrow indicating if the value is currently trending upwards or downwards.

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.