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

Comments Section w/ Vue 3 + Pinia + TS + SCSS + Toasts

pinia, sass/scss, typescript, vue, vite
ricardoychino•190
@ricardoychino
A solution to the Interactive comments section 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?

What I am proud of:

  • The templates (mixins) created with SCSS, particularly the ones to style button themes and the one to create the classes for Vue.js' Transition classes. It is a cool feature but it kind of becomes a pain to write after a while.

  • The use of slots to maintain scalability (ModalBase component); clean code & readability (CommentItemLayout component); and to avoid repetition (ButtonWithLoading component)

  • The first clear and effective use of Grid layout, personally speaking

  • Dynamic load of SVGs using Vue 3's defineAsyncComponent and Vite's SVG loader (This resource is GOLD)

  • Toasts feature created from scratch, and working surprisingly well

  • The "Backend" using local storage, the composable useFakeStorage, which (kind of) simulates a database and a RESTful API behavior. I'm kind of proud of using the Promises well to simulate the asynchronous actions and the setTimeout to simulate latency. That was pretty cool, even if not being the prettiest and most performant of codes.

What I'd do differently: The "Backend" again. At the same time that I'm proud of doing so, perhaps could be faster and less difficult if I just created some instance of MongoDB or whatever.

What challenges did you encounter, and how did you overcome them?

I had lots of challenges since I tried to achieve too much stuff, but the most painful one was to type the results from the "fake API".

My approach used the try / catch blocks to handle errors, as I always did with old plain JS and with PHP, but I didn't know how it could be a pain with TS. I kind of handled with the help of some articles like this one, but I still need some improvements.

What specific areas of your project would you like help with?

First of all, please have fun playing with the layout. It was pretty fun to code and I am quite satisfied with the outcome. Then as always, any feedback is welcome.

But the most important thing(s) that I want help:

[TypeScript] Do you recommend some good resources or do you have some tips for typing error handling in catch block? And what about API responses? This would help me a lot

[Tests] I started some testing in project with vitest + vue-test-utils, but I didn't have the patience to write every test case I was thinking of, and one of the main reasons that I stopped trying is that I was spending too much time looking for references and usage examples in their documentation (I'm kind of new to automated tests).So if you may recommend any resources, cheatsheet, alternative documentation or something like that, I would greatly appreciate it

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on ricardoychino's solution.

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.