This is a solution to the Results summary component challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- View the optimal layout for the interface depending on their device's screen size
- See hover and focus states for all interactive elements on the page
- Solution URL: Frontend Mentor solution
- Live Site URL: Github Pages
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- CSS Grid
- Mobile-first workflow
- Javascript for injecting JSON
- Variable font file
The most influencial thing I learned were basic operations with JSON files and injecting them into HTML.
The other thing was in this project I first learned about variable fonts and how to declare them in CSS.
@font-face {
font-family: 'HankenGrotesk';
src: url(assets/fonts/HankenGrotesk-VariableFont_wght.ttf) format('truetype');
font-weight: 500 800;
}
async function loadJSONData(){
const response = await fetch('./data.json');
const names = await response.json();
let i = 0;
for(const component of componentsArray){
component.children[0].children[1].innerHTML = names[i].category;
component.children[1].children[0].innerHTML = names[i].score;
component.children[0].children[0].setAttribute("src", names[i].icon);
i++;
}
}
In future project I plan to use a CSS preprocessor, probably Sass, because the code bloat is getting tiring. Also, as I'm actively learning jQuery, I plan to use it more often. Another subject that requires my attention are JS Promises.
- CSS Reset - An awesome CSS Reset.
- Getting started with Variable fonts on the web - This video helped me implement my first @font-face into CSS.
- 10 CSS Tips - This video helped me make a stagger animation for the summary components.
- Github - Łukasz Lubaszewski
- Frontend Mentor - @luckyszakul0