Skip to content
This repository was archived by the owner on Oct 6, 2024. It is now read-only.

Commit 3866ac1

Browse files
committed
Show cards and links in service navigator
Will show cards for the first 4 services and links for all.
1 parent 583d1df commit 3866ac1

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

src/components/ServiceNavigator/ServiceCards.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const ServiceCards = ({services}) =>
1212
className="card-img-top cover"/>
1313
<div className="card-body">
1414
<p className="card-text">
15-
<Link to="/providers">{service.serviceName}</Link>
15+
<Link to={`/providers/${service.id}`}>{service.serviceName}</Link>
1616
</p>
1717
</div>
1818
</div>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react'
2+
import {Link} from "react-router-dom";
3+
import "./index.css"
4+
5+
const ServiceLinks = ({services}) =>
6+
<div className="row">
7+
{services.map(service =>
8+
<div key={service.id} className="col-4 mb-3">
9+
<Link to={`/providers/${service.id}`}>{service.serviceName}</Link>
10+
</div>
11+
)}
12+
</div>;
13+
14+
export default ServiceLinks

src/components/ServiceNavigator/index.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
}
44

55
.cover {
6-
max-height: 15rem;
6+
max-height: 13rem;
77
object-fit: cover;
8+
border-radius: 0.5rem;
89
}

src/components/ServiceNavigator/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import ServiceCategoryService from "../../services/ServiceCategoryService";
55
import "./index.css"
66
import ServiceCards from "./ServiceCards";
77
import ServiceService from "../../services/ServiceService";
8+
import ServiceLinks from "./ServiceLinks";
89

910
export default class ServiceNavigator extends React.Component {
1011

@@ -41,7 +42,9 @@ export default class ServiceNavigator extends React.Component {
4142
// if switching ids then load the services for the new one
4243
this.loadServices("");
4344

44-
} else if (currentCatID && prevCatID) {
45+
} else if (currentCatID && prevCatID
46+
&& this.state.serviceCategories.length
47+
!== prevState.serviceCategories.length) {
4548
// if user selects a category then filters it out,
4649
// deselect that category
4750
const pred = cat => cat.id === Number(currentCatID);
@@ -93,7 +96,9 @@ export default class ServiceNavigator extends React.Component {
9396
</div>
9497
<div className="col-8">
9598
<h1>{this.currentServiceTitle()}</h1>
96-
<ServiceCards services={this.state.services}/>
99+
<ServiceCards services={this.state.services.slice(0, 4)}/>
100+
<hr/>
101+
<ServiceLinks services={this.state.services}/>
97102
</div>
98103
</div>;
99104
}

0 commit comments

Comments
 (0)