diff --git a/centrifuge-app/src/components/AssetSummary.tsx b/centrifuge-app/src/components/AssetSummary.tsx new file mode 100644 index 0000000000..f187b57253 --- /dev/null +++ b/centrifuge-app/src/components/AssetSummary.tsx @@ -0,0 +1,45 @@ +import { Loan, TinlakeLoan } from '@centrifuge/centrifuge-js' +import { Box, Shelf, Stack, Text } from '@centrifuge/fabric' +import * as React from 'react' +import { useTheme } from 'styled-components' +import LoanLabel from './LoanLabel' + +type Props = { + data?: { + label: React.ReactNode + value: React.ReactNode + }[] + children?: React.ReactNode + loan: Loan | TinlakeLoan +} + +export const AssetSummary: React.FC = ({ data, children, loan }) => { + const theme = useTheme() + return ( + + + + Details + + + + + {data?.map(({ label, value }, index) => ( + + + {label} + + {value} + + ))} + {children} + + + ) +} diff --git a/centrifuge-app/src/components/PageSummary.tsx b/centrifuge-app/src/components/PageSummary.tsx index ce94e9e0c4..679ab84a60 100644 --- a/centrifuge-app/src/components/PageSummary.tsx +++ b/centrifuge-app/src/components/PageSummary.tsx @@ -8,31 +8,27 @@ type Props = { value: React.ReactNode }[] children?: React.ReactNode - title?: React.ReactNode } -export const PageSummary: React.FC = ({ data, children, title }) => { +export const PageSummary: React.FC = ({ data, children }) => { const theme = useTheme() return ( - - {title} - - {data?.map(({ label, value }, index) => ( - - - {label} - - {value} - - ))} - {children} - - + + {data?.map(({ label, value }, index) => ( + + {label} + {value} + + ))} + {children} + ) } diff --git a/centrifuge-app/src/pages/Loan/index.tsx b/centrifuge-app/src/pages/Loan/index.tsx index 7992678b57..23e1015bff 100644 --- a/centrifuge-app/src/pages/Loan/index.tsx +++ b/centrifuge-app/src/pages/Loan/index.tsx @@ -16,11 +16,10 @@ import { import BN from 'bn.js' import * as React from 'react' import { useHistory, useParams, useRouteMatch } from 'react-router' +import { AssetSummary } from '../../components/AssetSummary' import { LabelValueStack } from '../../components/LabelValueStack' -import LoanLabel from '../../components/LoanLabel' import { PageHeader } from '../../components/PageHeader' import { PageSection } from '../../components/PageSection' -import { PageSummary } from '../../components/PageSummary' import { PageWithSideBar } from '../../components/PageWithSideBar' import { PodAuthSection } from '../../components/PodAuthSection' import { RouterLinkButton } from '../../components/RouterLinkButton' @@ -182,15 +181,8 @@ const Loan: React.FC<{ setShowOraclePricing?: () => void }> = ({ setShowOraclePr pool && (loan.pricing.maturityDate || templateMetadata?.keyAttributes?.length || 'oracle' in loan.pricing) && ( <> - - - Details - - - - } + templateMetadata?.attributes?.[key].public)