Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 8 months ago

Article preview component solution

bem, oocss, smacss, accessibility
Vitor Emanoel da Silva Nogueira•170
@VitorEmanoelNogueira
A solution to the Article preview component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

I'm proud of:

  • doing the challenge;
  • using the BEM, SMACSS, OOCSS methodologies in this project. It's the first time I used then so it took a long time for me to figure out some of the classes, but I did and liked how my HTML looked after XD;
  • of doing a project with JavaScript alone, this really places in perspective how much you really know and can do without tutorials, etc. and I'm looking forward to improve my abilities in using it.

Next time I will look forward to use a preprocessor like Sass to help me organize my CSS better, specially with the use of BEM.

What challenges did you encounter, and how did you overcome them?
  • I got some problems with the image when testing for different screen sizes, but it was a problem with the height of the container and I overcame then by fixing it and using the aspect-ratio property in the wrapper of the image.
  • Also got some problems with styling the share button icon color and the sizes of the SVG's in general, but I overcame these problems by using the aspect-ratio on the files and by putting the share button icon in the HTML instead of using the SVG of other file.
What specific areas of your project would you like help with?
  • I would like some tips on naming the classes and styling using BEM, SMACSS and OCSS. I used them, but I know there's a lot of room for improvement. Also I would like the same tips for namespaces, although I didn't use them here;
  • JavaScript tips;
  • Tips in general.
Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Martin Liesche•590
    @marliedev
    Posted 8 months ago

    Overall a clean and well done solution! Code is structured well and readable.

    What could be improved...maybe some tips, but as always it depends on the personal style and taste of developing also standards like BEM and SMACSS are quite useful (i use them too)

    As the challenge title says: its a component. If you use the BEM Methodology, I personally prefer when naming the classes of the individual parts of a component that you can clearly see that they belong to the component

    e. g. don't use "container" for a component; instead name it "article-preview"!

    Thought ahead the different parts should be named "article-preview__image", "article-preview__content", "article-preview__share-button" ....

    This way it's clear when scanning the code what belongs to what.

    Another tip, when using "skins and themes": Don't combine different properties in one class

    e.g.:

    .text--dark-blue{
        color: var(--dark-grayish-blue);
        font-weight: var(--font-weight-bold); 
        // what if you want a text to be dark blue but a light font-weight?
    }
    //better
    .text--dark-blue{
        color: var(--dark-grayish-blue);
    }
    .font--bold{
       font-weight: var(--font-weight-bold);
    }
    
    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