Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix link and prop types #407

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PurchaseHistoryItem extends Component {
} = this.props;

return (
<Link className={classes.body} to={'/'}>
<Link className={classes.body} to={link}>
<img
src={imageSrc}
alt="clothes"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { Component } from 'react';
import { shape, string, date, arrayOf } from 'prop-types';
import { shape, number, string, date, arrayOf } from 'prop-types';
import { List } from '@magento/peregrine';

import PurchaseHistoryItem from './PurchaseHistoryItem';
import classify from 'src/classify';
import defaultClasses from './purchaseHistory.css';
import Filter from './Filter';
import mockPurchaseHistory from './purchaseHistoryItemsMock';

class PurchaseHistory extends Component {
static propTypes = {
Expand All @@ -15,14 +16,19 @@ class PurchaseHistory extends Component {
itemsContainer: string
}),
items: arrayOf(shape({
id: 4,
id: number,
imageSrc: string,
title: string,
date: date,
link: string
}))
};

//TODO: remove this mock items setting
static defaultProps = {
items: mockPurchaseHistory
}

render() {
const { classes, items } = this.props;
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ const mockPurchaseHistory = [
imageSrc: 'dress.png',
title: 'Lorem ipsum dolor sit amet',
date: new Date(2018, 3, 20),
link: '/prettyDress/1/'
link: '/'
},
{
id: 2,
imageSrc: 'dress.png',
title: 'Duis aute irure dolor in reprehenderit in voluptate',
date: new Date(2017, 2, 12),
link: '/prettyDress/2/'
link: '/'
},
{
id: 3,
imageSrc: 'dress.png',
title: 'Ut enim ad minima',
date: new Date(2016, 1, 1),
link: '/prettyDress/3/'
link: '/'
},
{
id: 4,
imageSrc: 'dress.png',
title: 'Quis autem vel',
date: new Date(),
link: '/prettyDress/4/'
link: '/'
}
];

Expand Down