This is a solution to the Time tracking dashboard challenge on Frontend Mentor.
- Frontend Mentor - Time tracking dashboard solution
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
- 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
- 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
- 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
- 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 };
- 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
- 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.
git clone https://github.com/FarisPalayi/time-tracking-dashboard.git
yarn
yarn dev
yarn build
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.
- Vue 3 docs - Vue's official doc
- SFC
<script setup>
- api reference page - Ref sugar - Ref sugar proposal
- How can I list all commits that changed a specific file - Stack overflow
- Frontend Mentor - @farispalayi
- Twitter - @farispalayi