browse page is functional now
This commit is contained in:
@ -12,20 +12,37 @@ class cable {
|
||||
brand,
|
||||
description,
|
||||
short_description,
|
||||
image
|
||||
image,
|
||||
category,
|
||||
application
|
||||
) {
|
||||
this.part_number = part_number;
|
||||
this.position = position;
|
||||
this.name = name;
|
||||
this.brand = brand;
|
||||
this.description = description;
|
||||
this.short_description = short_description
|
||||
? short_description
|
||||
: description;
|
||||
this.image = image ? `http://localhost${image}` : DefaultPartImg;
|
||||
|
||||
if (this.short_description != undefined) {
|
||||
this.short_description = this.short_description.charAt(0).toUpperCase() + this.short_description.slice(1);
|
||||
this.category = category;
|
||||
this.application = application;
|
||||
this.short_description = short_description;
|
||||
this.description = description;
|
||||
|
||||
if (short_description === undefined) {
|
||||
if (this.description !== undefined) {
|
||||
this.short_description = this.description;
|
||||
} else if (this.application !== undefined) {
|
||||
this.short_description = this.application;
|
||||
} else if (this.category !== undefined) {
|
||||
this.short_description = this.category;
|
||||
} else {
|
||||
this.short_description = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (this.short_description !== undefined) {
|
||||
this.short_description =
|
||||
this.short_description.charAt(0).toUpperCase() +
|
||||
this.short_description.slice(1);
|
||||
if (this.short_description.length > 100) {
|
||||
this.short_description =
|
||||
this.short_description.substring(0, 80) + "...";
|
||||
@ -43,6 +60,14 @@ class cable {
|
||||
<span style={{ color: "#007cbe" }}></span>
|
||||
{this.short_description}
|
||||
</div>
|
||||
{this.category ? (
|
||||
<div className="browse-cable-category">
|
||||
<span style={{ color: "black", backgroundColor: "transparent" }}>
|
||||
Category:{" "}
|
||||
</span>
|
||||
{this.category}
|
||||
</div>
|
||||
) : null}
|
||||
<div className="browse-cable-brand">
|
||||
<span style={{ color: "black", backgroundColor: "transparent" }}>
|
||||
Brand:{" "}
|
||||
@ -97,6 +122,8 @@ export default class BrowseComponent extends Component {
|
||||
let brand = map[i].brand;
|
||||
let description = map[i].description;
|
||||
let short_description = map[i].short_description;
|
||||
let category = map[i].category;
|
||||
let application = map[i].application;
|
||||
cableList.push(
|
||||
new cable(
|
||||
part_number,
|
||||
@ -105,7 +132,9 @@ export default class BrowseComponent extends Component {
|
||||
brand,
|
||||
description,
|
||||
short_description,
|
||||
image
|
||||
image,
|
||||
category,
|
||||
application
|
||||
)
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user