Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.3 kB
2
Indexable
Never
  const contarStrellas= (rating)=>{
    switch(rating){
      case 1:
        return (
            <div className="stars">
            <i className="star bi bi-star-fill"></i>
            <i className="star bi bi-star"></i>
            <i className="star bi bi-star"></i>
            <i className="star bi bi-star"></i>
            <i className="star bi bi-star"></i>
            <span>{card.price} €</span>
          </div> ) ;
        case 2:
          return (
            <div className="stars">
            <i className="star bi bi-star-fill"></i>
            <i className="star bi bi-star-fill"></i>
            <i className="star bi bi-star"></i>
            <i className="star bi bi-star"></i>
            <i className="star bi bi-star"></i>
            <span>{card.price} €</span>
          </div>  
          );
          case 3:
            return (
              <div className="stars">
              <i className="star bi bi-star-fill"></i>
              <i className="star bi bi-star-fill"></i>
              <i className="star bi bi-star-fill"></i>
              <i className="star bi bi-star"></i>
              <i className="star bi bi-star"></i>
              <span>{card.price} €</span>
            </div> 
            );
            case 4:
              return (
                <div className="stars">
                <i className="star bi bi-star-fill"></i>
                <i className="star bi bi-star-fill"></i>
                <i className="star bi bi-star-fill"></i>
                <i className="star bi bi-star-fill"></i>
                <i className="star bi bi-star"></i>
                <span>{card.price} €</span>
              </div> 
              );
              case 5:
                return (
                  <div className="stars">
                  <i className="star bi bi-star-fill"></i>
                  <i className="star bi bi-star-fill"></i>
                  <i className="star bi bi-star-fill"></i>
                  <i className="star bi bi-star-fill"></i>
                  <i className="star bi bi-star-fill"></i>
                  <span>{card.price} €</span>
                </div> 
                );
                default:
                  return rating;
    }
  }