Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Commit

Permalink
Ændret billede-placeholders til imagePath
Browse files Browse the repository at this point in the history
  • Loading branch information
Thom9521 authored and Thom9521 committed Dec 18, 2019
1 parent c7c3ecf commit 551a5df
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/components/scooters/ScooterCards.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import { Link } from 'react-router-dom';
import { useQuery } from '@apollo/react-hooks';
import { gql } from 'apollo-boost';
import dummyImgScooter from '../../assets/images/dummyImgScooter.png';
import GetCategoryById from '../categories/GetCategoryById';

// Importér Reactstrap komponenter
Expand Down Expand Up @@ -31,6 +30,7 @@ function ScooterCards() {
price
priceVAT
categoryId
imagePath
}
}
`;
Expand All @@ -47,10 +47,10 @@ function ScooterCards() {
_id,
itemNo,
name,
description,
price,
priceVAT,
categoryId
categoryId,
imagePath
} = scooter; // Destructuring
return (
<Col
Expand All @@ -63,8 +63,8 @@ function ScooterCards() {
<CardImg
width="100%"
className="p-2"
src={dummyImgScooter}
alt={description}
src={imagePath}
alt={imagePath && imagePath.slice(42)}
/>
</Link>
<CardBody>
Expand Down
7 changes: 4 additions & 3 deletions src/components/showScooter/ShowScooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import GetCategoryById from '../categories/GetCategoryById';
import { useParams } from 'react-router';
import { useQuery } from '@apollo/react-hooks';
import { gql } from 'apollo-boost';
import dummyImgScooter from '../../assets/images/dummyImgScooter.png';
import './ShowScooter.css';

// Importér Reactstrap komponenter
Expand All @@ -26,6 +25,7 @@ function ShowScooter() {
description
itemNo
categoryId
imagePath
}
}
`;
Expand All @@ -46,6 +46,7 @@ function ShowScooter() {
const scoDescription = data.getScooterById.description;
const scoItemNo = data.getScooterById.itemNo;
const scoCategoryId = data.getScooterById.categoryId;
const scoImagePath = data.getScooterById.imagePath;

// Løber gennem alle tags og udskriver hvert enkelt som et list item
const tagCloudItems = scoTagsArray.map(tag => (
Expand All @@ -61,8 +62,8 @@ function ShowScooter() {
<Col lg="4" md="3" className="mb-4 mr-5">
<img
className="img-fluid"
src={dummyImgScooter}
alt={scoName}
src={scoImagePath}
alt={scoImagePath && scoImagePath.slice(42)}
title={scoName}
/>
</Col>
Expand Down
8 changes: 5 additions & 3 deletions src/components/showSubCategory/ShowSubCategory.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useParams } from 'react-router';
import { useQuery } from '@apollo/react-hooks';
import { gql } from 'apollo-boost';
import './ShowSubCategory.css';
import dummyImgDrawing from '../../assets/images/dummyImgDrawing.jpg';

// Importér Reactstrap komponenter
import { Container, Row, CardDeck } from 'reactstrap';
Expand Down Expand Up @@ -35,9 +34,12 @@ function ShowSubCategory() {
<h3>{data.getSubCategoryById.name}</h3>
<img
className="fadeIn"
src={dummyImgDrawing}
src={data.getSubCategoryById.imagePath}
width="100%"
alt="Splittegning"
alt={
data.getSubCategoryById.imagePath &&
data.getSubCategoryById.imagePath.slice(42)
}
/>
<h3 className="mb-3">Reservedele</h3>
<Row>
Expand Down

0 comments on commit 551a5df

Please sign in to comment.