0

I have this design here:

enter image description here

You can see the material icon is a bit too close to the description. I thought I could create some padding between both by doing something like this:

.location-secondary-info span:first-child {
  padding-right: 5px;
}

That has been ineffectual.

This is the component code:

renderLocation() {
    const filteredLocations = this.props.locations.filter(location => {
      return !location.name.match(/[A-Z0-9]+$/);
    });

    return filteredLocations.map(location => {
      if (location.airport_code) {
        return (
          <div key={location.id}>
            <div className="location">
              <h1>
                {location.name} ({location.airport_code})
              </h1>
              <div className="location-secondary-info">
                <span>
                  <i className="material-icons">airplanemode_active</i>
                  {location.description}
                </span>
              </div>
            </div>
          </div>
        );
      } else {
        return (
          <div key={location.id}>
            <div className="location">
              <h1>{location.name}</h1>
              <div className="location-secondary-info">
                <span>
                  <i className="material-icons">location_city</i>
                  {location.description}
                </span>
              </div>
            </div>
          </div>
        );
      }
    });
  }
Daniel
  • 14,004
  • 16
  • 96
  • 156

1 Answers1

3

You should select the i element inside the span, so:

.location-secondary-info span i {
  padding-right: 5px;
}

With span:first-child you were selecting the first span element inside .location-secondary.

Giu Magnani
  • 448
  • 1
  • 3
  • 12