Results summary component built with Vue.js
Frontend Mentor – Results summary component solution
This is a solution to the Results summary component challenge on Frontend Mentor.
Overview
I am using Vue
to structure this project and using Vite
to build it. The preview page is deployed on GitHub Pages. You can visit it here.
The challenge
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
Screenshot
Links
- Solution URL: Results-summary-component
- Live Site URL: Demo page
My process
- whole design:
-
flex
is used to lay out the page.
-
- This page has “left-card” and “right-card”.
-
- Two part mentioned above is wrapped by a “wrapper”
div
.
- Two part mentioned above is wrapped by a “wrapper”
- right design:
-
- Four “dataBar”s are generated by
v-for
command, and their style is controlled byv-bind
command.
- Four “dataBar”s are generated by
Built with
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- vue.js – JS library
What I learned
- I learned how to use
v-for
andv-bind
to generate elements and control their style.
<div class="card-right">
<h2>Summary</h2>
<div v-for=" (data, index ) in dataList" :key="data.category" class="dataBar" :style="colors[index]">
<!-- img with path of data.icon -->
<div class="icon" >
<img :src=data.icon alt="icon">
</div>
<h3 :style="TextColors[index]">{{data.category}}</h3>
<div class="score-end">
<span class="strong">{{data.score}}</span>
<span class="weak">/ 100</span>
</div>
</div>
<button>Continue</button>
</div>
Author
- Website – pzq123456
- Frontend Mentor – @pzq123456
problems
- I have a problem with the “SVG” icons in the build stage.
-
- Solve: I put the icons in the
public
folder and use the hard-code (http//…/*.svg) path insrc
to load them.
- Solve: I put the icons in the
HELP ME:
- I think this is not a good way to solve this problem.
- If you have any good idea, please tell me in the issue part of my project.
Thank you very much!