Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Job listing board using React and React Context

Jordan Lewis• 100

@jordanlewis9

Desktop design screenshot for the Job listings with filtering coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
3intermediate
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hello!

This was a neat challenge, as I got to utilize React Context for the first time. I'm not sure how I would feel using it in a larger application (over, say, Redux), but it went fairly smooth. It's also the first React App I've deployed without using CRA, so there were a few growing pains.

Two general questions:

  1. How does the site look? I used mobile-first, but noted that the desktop app felt weird around 900px. The layout of each card smashed together, and it felt kind of messy, hence why I set the media query to 900px.
  2. SVG bundling - The longest part of this project was figuring out how to load the SVGs without manually placing them in dist/ or build/. I eventually just placed them with the components, and imported each into index.js one at a time. Is there a better way to do that?

As far as I could tell, I couldn't automate the import in JobInfo.js.

const JobInfo = ({ listing }) => {
    return (
        <div className="job__info--container">
            <img src={listing.logo} className="job__info--picture"/>
            <div className="job__info--listing-container">
                <p className="job__info--company">{listing.company}</p>
                <div className="job__info--extra-container">

listing.logo is the company logo photo, a SVG file, pulled from State from the parent component.

So I did this in index.js:

import './public/styles/main.scss';
import './components/listings/images/account.svg';
import './components/listings/images/eyecam-co.svg';
import './components/listings/images/faceit.svg';
import './components/listings/images/insure.svg';
import './components/listings/images/loop-studios.svg';
...

Is this the intended way to access assets like this? Thanks for any feedback!

Community feedback

Mojtaba Mosavi• 3,760

@MojtabaMosavi

Posted

Hi!, look nice and functions well, I am no expert in React but according to my limited knowledge the way you import assets if fine and a sublte improvement would be to a named import( assign the asset to variable on import). For example you can do something like this:

import logo from "./src/assets/images/logo"

Keep coding :)

1

Jordan Lewis• 100

@jordanlewis9

Posted

@MojtabaMosavi Thanks for the feedback! Unless my understanding from import statements and React is off, I couldn't import at the top level because each section had a different logo, and the logo location was passed down via Context. Since it was passed down from Context, I don't have access to the location outside of the function.

0

Please log in to post a comment

Log in with GitHub
Discord logo

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