Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 3 years ago

Expenses Chart Component

Prisca Onwudebelu•170
@PriscaTonia
A solution to the Expenses chart component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Okay, so this project challenged me, lol... so please guys, go through my solution and you can state things that could have been done better or that I can improve on. I would also love to know how you access a JSON file, had a little problem with that :).

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Enmanuel Otero Montano•2,155
    @Enmanuel-Otero-Montano
    Posted almost 3 years ago

    Hello Prisca!

    In general your code is good and it's fine to use "fetch" to access the JSON. The result of the challenge is good. If I have a couple of suggestions for your CSS.

    I suggest you load the fonts from the HTML and not from the CSS, this way they will load faster and therefore your website will have a better performance, keep in mind that the browser has to read the code to render it, and the first thing it reads is the HTML, for this reason. I'm going to leave you an example of how it would look from the HTML

    <link rel="preconnect" href="https://fonts.googleapis.com">
     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
     <link href="https://fonts.googleapis.com/css2family=DM+Sans:wght@400;700&display=swap" rel="stylesheet">
    

    The above code ☝ goes inside the head tag.

    The rel="preconnect" attribute to a link informs the browser that your page intends to establish a connection to another domain and that you want the process to begin as soon as possible. The resources will load faster because the setup process is already complete when the browser requests them.

    The other suggestion is that you try not to chain so many selectors to apply styles, if you know that there are several elements with the same style, directly put a class on it and apply the style to them with the class selector. I tell you this because it can affect performance in larger projects and also because it makes the code more difficult to read. I leave you a sample of your code to be more explanatory.

    .mon span, .tue span, .wed span, .thur span, .fri span, .sat span, .sun span{
        color: hsl(28, 10%, 53%);
        margin-top: 5px;
    }
    

    The above advice will prevent you from having to use !important, as it is considered bad practice. In general, always try to apply styles with the class selector, this way you will always have the same specificity in your code and you will only have to worry about the cascade.

    Any questions do not hesitate to contact me.

    Greetings.

    Marked as helpful

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub