-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
12 changed files
with
156 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,3 @@ | |
.row:last-child { | ||
background: var(--background-surface-1); | ||
} | ||
|
||
.finalPrice { | ||
color: var(--focus); | ||
} |
45 changes: 45 additions & 0 deletions
45
packages/web/src/components/summary-table/SummaryTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { ReactNode } from 'react' | ||
|
||
import { Text } from 'components/typography' | ||
|
||
import styles from './SummaryTable.module.css' | ||
|
||
export type SummaryTableItem = { | ||
id: string | ||
label: ReactNode | ||
value: ReactNode | ||
} | ||
|
||
export type SummaryTableProps = { | ||
items: SummaryTableItem[] | ||
summaryItem: SummaryTableItem | ||
title: ReactNode | ||
} | ||
|
||
export const SummaryTable = ({ | ||
items, | ||
summaryItem, | ||
title | ||
}: SummaryTableProps) => { | ||
return ( | ||
<div className={styles.container}> | ||
<Text className={styles.row} variant='title' size='large'> | ||
{title} | ||
</Text> | ||
{items.map(({ id, label, value }) => ( | ||
<div key={id} className={styles.row}> | ||
<Text>{label}</Text> | ||
<Text>{value}</Text> | ||
</div> | ||
))} | ||
<div className={styles.row}> | ||
<Text variant='title' size='medium'> | ||
{summaryItem.label} | ||
</Text> | ||
<Text variant='title' size='medium' color='secondary'> | ||
{summaryItem.value} | ||
</Text> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './SummaryTable' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
packages/web/src/components/usdc-purchase-details-modal/components/TransactionSummary.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { USDCPurchaseDetails, formatUSDCWeiToUSDString } from '@audius/common' | ||
import BN from 'bn.js' | ||
|
||
import { SummaryTable, SummaryTableItem } from 'components/summary-table' | ||
|
||
const messages = { | ||
cost: 'Cost of Track', | ||
payExtra: 'Pay Extra', | ||
title: 'Transaction Summary', | ||
total: 'Total' | ||
} | ||
|
||
export const TransactionSummary = ({ | ||
transaction | ||
}: { | ||
transaction: USDCPurchaseDetails | ||
}) => { | ||
const amountBN = new BN(transaction.amount) | ||
const items: SummaryTableItem[] = [ | ||
{ | ||
id: 'cost', | ||
label: messages.cost, | ||
value: `$${formatUSDCWeiToUSDString(amountBN)}` | ||
} | ||
] | ||
const extraAmountBN = new BN(transaction.extraAmount) | ||
if (!extraAmountBN.isZero()) { | ||
items.push({ | ||
id: 'payExtra', | ||
label: messages.payExtra, | ||
value: `$${formatUSDCWeiToUSDString(extraAmountBN)}` | ||
}) | ||
} | ||
|
||
return ( | ||
<SummaryTable | ||
title={messages.title} | ||
items={items} | ||
summaryItem={{ | ||
id: 'total', | ||
label: messages.total, | ||
value: `$${formatUSDCWeiToUSDString(amountBN.add(extraAmountBN))}` | ||
}} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters