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

Commit

Permalink
Add defaultPerPage prop
Browse files Browse the repository at this point in the history
  • Loading branch information
MrXyfir committed Apr 16, 2019
1 parent b39b144 commit 278cd70
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion web/components/panel/aliases/Matches.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { CATEGORIES } from 'constants/categories';
import { FileCopy } from '@material-ui/icons';
import { Matches } from 'components/panel/utils/Matches';
import * as moment from 'moment';
import * as React from 'react';
// @ts-ignore
import * as copy from 'clipboard-copy';
import * as React from 'react';
import { Ptorx } from 'types/ptorx';

export const AliasMatches = () => (
Expand All @@ -21,6 +21,7 @@ export const AliasMatches = () => (
</IconButton>
</ListItemSecondaryAction>
)}
defaultPerPage={10}
description={(alias: Ptorx.AliasList[0]) =>
`Created ${moment.unix(alias.created).fromNow()}`
}
Expand Down
1 change: 1 addition & 0 deletions web/components/panel/messages/Matches.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Ptorx } from 'types/ptorx';

export const MessageMatches = () => (
<Matches
defaultPerPage={25}
description={(message: Ptorx.MessageList[0]) =>
`Received ${moment.unix(message.created).fromNow()}`
}
Expand Down
3 changes: 2 additions & 1 deletion web/components/panel/utils/Matches.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const styles = createStyles({ link: { textDecoration: 'none' } });

interface MatchesProps extends WithStyles<typeof styles> {
secondaryAction?: (item: any) => React.ReactNode;
defaultPerPage?: 5 | 10 | 25 | 50 | 100;
description: (item: any) => string;
category: Category;
noLink?: boolean;
Expand All @@ -31,7 +32,7 @@ interface MatchesState {
}

class _Matches extends React.Component<MatchesProps, MatchesState> {
state: MatchesState = { perPage: 5, page: 1 };
state: MatchesState = { perPage: this.props.defaultPerPage || 5, page: 1 };

static contextType = PanelContext;
context!: React.ContextType<typeof PanelContext>;
Expand Down

0 comments on commit 278cd70

Please sign in to comment.