Skip to content

FarisPalayi/time-tracking-dashboard

Repository files navigation

Frontend Mentor - Time tracking dashboard solution

This is a solution to the Time tracking dashboard challenge on Frontend Mentor.

Table of contents

Overview

The challenge

Users should be able to:

  • View the optimal layout for the site depending on their device's screen size
  • See hover states for all interactive elements on the page
  • Switch between viewing Daily, Weekly, and Monthly stats

Screenshot

screenshot of the solution site

Links

My process

Built with

  • CSS custom properties
  • Flexbox
  • CSS Grid
  • Mobile-first workflow
  • Pug - HTML preprocessor
  • Sass/Scss - CSS preprocessor
  • Vue3 - JS framework
  • Typescript - JS Preprocessor
  • Vite - Build tool

What I learned

Git

  • To see all of the commits that changed a specific file: git log with the --follow flag and filename can be used. link
git log --follow -- filename

Javascript

  • To get the number of the children of an element, childElementCount property can be used.
<ul>
  <li>item 1</li>
  <li>item 2</li>
  <li>item 3</li>
</ul>
const ulElement = document.querySelector("ul");
console.log(ul.childElementCount); //  3

Typescript

  • To create an interface/type that have another interface's types and some additional types, extends can be used
interface X {
  name: string;
}

interface Y extends X {
  age: number;
}

// interface Y will be equivalent to:
interface XY {
  name: string;
  age: number;
}
  • For this same purpose, type aliases with intersection(&) can be used as well.
type Y = X & { age: number };

SASS/SCSS

  • If there are no parameters in a sass mixin, the parentheses can be omitted.
@mixin foo() {
  // ...
}

@mixin foo { // 👈 no parentheses
  // ...
}

@include foo; // it can be omitted when calling the mixin too

Vue

  • Composition api setup() function can be used as a separate script tag. doc
<script>
import { ref } from "@vue";
import VComponent from "./components/VComponent.vue"

export default {
  components: {
    VComponent
  }
  setup() {
    const x = ref(0);
    return { x };
  },
};
</script>

<template>
  <VComponent>{{ x }}</VComponent>
</template>

👆 This can be written like this 👇

<script setup>
import VComponent from "./components/VComponent.vue"
import { ref } from "@vue";

const x = ref(0);
</script>

<template>
  <VComponent>{{ x }}</VComponent>
</template>

<script setup> can be used alongside normal <script>

  • Ref sugar (currently it is an experimental feature) proposal
import { ref } from 'vue'

const x = ref(0)
const y = () => x.value + 1

With $ref, the code above can be shortened to this:

let x = $ref(0)
const y = () => x + 1

Basically, it eliminates the need to use .value when using refs. And since it's a compiler macro, it doesn't need to be imported.

Project setup

Clone the repo locally

git clone https://github.com/FarisPalayi/time-tracking-dashboard.git

Install dependencies

yarn

Compiles and hot-reloads for development

yarn dev

Compiles and minifies for production

yarn build

Recommended IDE Setup

Continued development

I find that when writing asynchronous code with the composition api, I'm running into a lot of problems. So, my next focus will be to read the composition api docs well. And I'm also planning to create some vanilla js, typescript projects.

Useful resources

Author

About

⏱️ A time tracking dashboard page created using Vue3 and typescript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published