forked from nervosnetwork/ckb-explorer-frontend
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extract lite transaction components
- Loading branch information
1 parent
3688aef
commit 6630178
Showing
8 changed files
with
116 additions
and
53 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/pages/Transaction/TransactionComp/TransactionLite/TransactionBadge.module.scss
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,12 @@ | ||
.transactionBadge { | ||
font-size: 12px; | ||
padding: 1px 8px; | ||
|
||
border-radius: 4px; | ||
border: 1px solid #b0cbfc; | ||
background: #d7e5fd; | ||
} | ||
|
||
.tootip { | ||
text-align: center; | ||
} |
40 changes: 40 additions & 0 deletions
40
src/pages/Transaction/TransactionComp/TransactionLite/TransactionBadge.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,40 @@ | ||
import { Tooltip } from 'antd' | ||
import styles from './TransactionBadge.module.scss' | ||
|
||
type Props = { | ||
cellType: State.CellType | ||
capacity?: string | ||
} | ||
const cellTypeDisplayMap: Record<State.CellType, string> = { | ||
nervos_dao_deposit: 'Nervos DAO Deposit', | ||
nervos_dao_withdrawing: 'Nervos DAO Withdraw', | ||
spore_cell: 'Spore', | ||
nrc_721_token: 'Mint', | ||
normal: '', | ||
udt: '', | ||
spore_cluster: '', | ||
cota_regular: '', | ||
cota_registry: '', | ||
m_nft_issuer: '', | ||
m_nft_class: '', | ||
m_nft_token: '', | ||
nrc_721_factory: '', | ||
} | ||
|
||
export const TransactionBadge = ({ cellType, capacity }: Props) => { | ||
const displayName = cellTypeDisplayMap[cellType] | ||
if (!displayName) return null | ||
|
||
return ( | ||
<Tooltip | ||
title={ | ||
<div className={styles.tootip}> | ||
<div>{displayName}</div> | ||
<div>{capacity} CKB</div> | ||
</div> | ||
} | ||
> | ||
<div className={styles.transactionBadge}>{displayName}</div> | ||
</Tooltip> | ||
) | ||
} |
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 |
---|---|---|
|
@@ -57,6 +57,10 @@ | |
font-size: 14px; | ||
} | ||
|
||
.capacityChange { | ||
margin-left: 12px; | ||
} | ||
|
||
& > div { | ||
width: 100%; | ||
height: 22px; | ||
|
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