Skip to content

Commit

Permalink
Convert NbItmesField to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
josephktcheung committed Mar 12, 2020
1 parent 7f9c9d5 commit 90caa62
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
13 changes: 0 additions & 13 deletions examples/demo/src/orders/NbItemsField.js

This file was deleted.

20 changes: 20 additions & 0 deletions examples/demo/src/orders/NbItemsField.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React, { FC, ReactElement, ComponentType } from 'react';
import { FunctionField } from 'react-admin';
import { Order, FieldProps } from '../types';

const render = (record: Order) => record.basket.length;

interface NbItemsFieldProps extends FieldProps {
textAlign?: string;
}

const NbItemsField: FC<NbItemsFieldProps> = props => (
<FunctionField {...props} render={render} />
);

NbItemsField.defaultProps = {
label: 'Nb Items',
textAlign: 'right',
};

export default NbItemsField;

0 comments on commit 90caa62

Please sign in to comment.