diff --git a/src/index.css b/src/index.css index 9c467eb24..bf8003d92 100644 --- a/src/index.css +++ b/src/index.css @@ -2,7 +2,7 @@ body { --primary-color: #00cc9b; - --accent-color: #FA504F; + --accent-color: #fa504f; --primary-text-color: #333; --primary-hover-bg-color: #e8fff1; --primary-chiffon-color: #e6fcf7; @@ -27,11 +27,11 @@ body[data-chain-type='testnet'] { margin: 0; padding: 0; box-sizing: border-box; - font-family: Lato, sans-serif, Montserrat, "PingFang SC", -apple-system; + font-family: Lato, sans-serif, Montserrat, 'PingFang SC', -apple-system; } .monospace { - font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; } *[role]:focus { diff --git a/src/pages/Script/index.tsx b/src/pages/Script/index.tsx index 1a8ba0ad2..f6fed3894 100644 --- a/src/pages/Script/index.tsx +++ b/src/pages/Script/index.tsx @@ -1,7 +1,6 @@ import { useEffect, useState } from 'react' import { useHistory } from 'react-router' import { useParams } from 'react-router-dom' -import { Tabs } from 'antd' import { useQuery } from '@tanstack/react-query' import { useTranslation } from 'react-i18next' import Content from '../../components/Content' @@ -19,6 +18,7 @@ import DecimalCapacity from '../../components/DecimalCapacity' import styles from './styles.module.scss' import { explorerService } from '../../services/ExplorerService' import type { ScriptInfo } from '../../services/ExplorerService/fetcher' +import { ScriptTab, ScriptTabPane, ScriptTabTitle } from './styled' const scriptDataList = isMainnet() ? MainnetContractHashTags : TestnetContractHashTags @@ -153,12 +153,12 @@ export const ScriptPage = () => { - { history.push(`/script/${codeHash}/${hashType}?page=${pageOfTransactions}&size=${pageSize}`) } }} - items={[ - { - label: `${t('transaction.transactions')} (${localeNumberString(countOfTransactions!)})`, - key: 'transactions', - children: , - }, - { - label: `${t('scripts.deployed_cells')} (${localeNumberString(countOfDeployedCells)})`, - key: 'deployed_cells', - children: , - }, - { - label: `${t('scripts.referring_cells')} (${localeNumberString(countOfReferringCells)})`, - key: 'referring_cells', - children: , - }, - ]} - /> + > + + {`${t('transaction.transactions')} (${localeNumberString(countOfTransactions!)})`} + + } + key="transactions" + > + + + + {`${t('scripts.deployed_cells')} (${localeNumberString(countOfDeployedCells)})`} + + } + key="deployed_cells" + > + + + + {`${t('scripts.referring_cells')} (${localeNumberString(countOfReferringCells)})`} + + } + key="referring_cells" + > + + + ) diff --git a/src/pages/Script/styled.tsx b/src/pages/Script/styled.tsx new file mode 100644 index 000000000..3c15a5889 --- /dev/null +++ b/src/pages/Script/styled.tsx @@ -0,0 +1,66 @@ +import { Tabs } from 'antd' +import TabPane from 'antd/lib/tabs/TabPane' +import styled from 'styled-components' + +export const ScriptTab = styled(Tabs)` + display: flex; + flex-direction: column; + justify-content: center; + width: 100%; + background-color: #fff; + border-radius: 6px 6px 0 0; + + /* stylelint-disable-next-line selector-class-pattern */ + .ant-tabs-nav-list { + padding-left: 40px; + } + + /* stylelint-disable-next-line selector-class-pattern */ + .ant-tabs-tab.ant-tabs-tab-active { + /* stylelint-disable-next-line selector-class-pattern */ + .ant-tabs-tab-btn { + color: var(--primary-color); + } + } + + /* stylelint-disable-next-line selector-class-pattern */ + .ant-tabs-tab-active { + /* stylelint-disable-next-line selector-class-pattern */ + .ant-tabs-tab-btn { + color: #333; + } + } + + /* stylelint-disable-next-line selector-class-pattern */ + .ant-tabs-tab-btn { + color: #333; + font-weight: 400; + font-size: 20px; + line-height: 23px; + margin-bottom: 0; + + &[aria-selected='true'] { + font-weight: 500; + } + } + + /* stylelint-disable-next-line selector-class-pattern */ + .ant-tabs-nav .ant-tabs-ink-bar { + background: linear-gradient( + to right, + transparent 30%, + var(--primary-color) 30%, + var(--primary-color) 70%, + transparent 70% + ); + height: 3px; + bottom: 3px; + } +` +export const ScriptTabTitle = styled.span` + font-size: 20px; +` + +export const ScriptTabPane = styled(TabPane)` + color: #333; +` diff --git a/src/pages/Script/styles.module.scss b/src/pages/Script/styles.module.scss index 19940b69a..29079d941 100644 --- a/src/pages/Script/styles.module.scss +++ b/src/pages/Script/styles.module.scss @@ -16,63 +16,6 @@ } } -.scriptTabs { - display: flex; - flex-direction: column; - justify-content: center; - width: 100%; - background-color: #fff; - border-radius: 6px 6px 0 0; - - :global { - /* stylelint-disable-next-line selector-class-pattern */ - .ant-tabs-nav { - &::before { - border-bottom-width: 4px; - } - } - - /* stylelint-disable-next-line selector-class-pattern */ - .ant-tabs-nav-list { - padding-left: 40px; - } - - /* stylelint-disable-next-line selector-class-pattern */ - .ant-tabs-tab-btn { - color: #333; - font-weight: 400; - font-size: 20px; - line-height: 23px; - margin-bottom: 0; - - &[aria-selected='true'] { - font-weight: 500; - } - } - - /* stylelint-disable-next-line selector-class-pattern */ - .ant-tabs-tab-active { - /* stylelint-disable-next-line selector-class-pattern */ - .ant-tabs-tab-btn { - color: #333; - } - } - } - - /* stylelint-disable-next-line selector-class-pattern */ - & > :global(.ant-tabs-nav .ant-tabs-ink-bar) { - background: linear-gradient( - to right, - transparent 30%, - var(--primary-color) 30%, - var(--primary-color) 70%, - transparent 70% - ); - height: 3px; - bottom: 3px; - } -} - .scriptCellsPanel, .scriptTransactionsPanel { table { diff --git a/src/pages/Transaction/TransactionCellScript/index.tsx b/src/pages/Transaction/TransactionCellScript/index.tsx index 0f37d4ba5..8babfc406 100644 --- a/src/pages/Transaction/TransactionCellScript/index.tsx +++ b/src/pages/Transaction/TransactionCellScript/index.tsx @@ -9,13 +9,12 @@ import { TransactionDetailCopyButton, TransactionDetailContainer, TransactionDetailPanel, - TransactionDetailLock, - TransactionDetailType, TransactionCellDetailPanel, - TransactionDetailData, - TransactionDetailCapacityUsage, TransactionCellInfoValuePanel, TransactionDetailScriptButton, + TransactionCellDetailTab, + TransactionCellDetailPane, + TransactionCellDetailTitle, } from './styled' import SmallLoading from '../../../components/Loading/SmallLoading' import CloseIcon from './modal_close.png' @@ -250,32 +249,54 @@ export default ({ cell, onClose }: TransactionCellScriptProps) => { return ( - changeType(CellInfo.LOCK)}> - {t('transaction.lock_script')} - - - changeType(CellInfo.TYPE)}> - {t('transaction.type_script')} - - - changeType(CellInfo.DATA)}> - {t('transaction.data')} - - changeType(CellInfo.CAPACITY)} + + close icon {}} onClick={() => onClose()} /> + + } + tabBarStyle={{ fontSize: '10px' }} + onTabClick={key => { + const state = parseInt(key, 10) + if (state && !Number.isNaN(state)) { + changeType(state) + } + }} > - {t('transaction.capacity_usage')} - - - -
- close icon {}} onClick={() => onClose()} /> -
+ + {t('transaction.lock_script')} + + + } + key={CellInfo.LOCK} + /> + + {t('transaction.type_script')} + + + } + key={CellInfo.TYPE} + /> + {t('transaction.data')}} + key={CellInfo.DATA} + /> + + {t('transaction.capacity_usage')} + + + } + key={CellInfo.CAPACITY} + /> +
-
- {isFetched ? (
diff --git a/src/pages/Transaction/TransactionCellScript/styled.tsx b/src/pages/Transaction/TransactionCellScript/styled.tsx index 495ccdc4a..e4e69bef2 100644 --- a/src/pages/Transaction/TransactionCellScript/styled.tsx +++ b/src/pages/Transaction/TransactionCellScript/styled.tsx @@ -1,3 +1,5 @@ +import { Tabs } from 'antd' +import TabPane from 'antd/lib/tabs/TabPane' import styled from 'styled-components' export const TransactionDetailContainer = styled.div` @@ -18,6 +20,7 @@ export const TransactionDetailItem = styled.div<{ selected?: boolean }>` font-weight: 600; font-size: 16px; align-items: center; + white-space: pre-wrap; @media (max-width: 750px) { margin-top: 5px; @@ -73,6 +76,43 @@ export const TransactionDetailCapacityUsage = styled(TransactionDetailItem)` } ` +export const TransactionCellDetailTab = styled(Tabs)` + display: flex; + flex-direction: column; + justify-content: center; + width: 100%; + background-color: #fff; + border-radius: 6px 6px 0 0; + + /* stylelint-disable-next-line selector-class-pattern */ + .ant-tabs-nav-operations { + display: none !important; + } + + /* stylelint-disable-next-line selector-class-pattern */ + .ant-tabs-tab.ant-tabs-tab-active { + /* stylelint-disable-next-line selector-class-pattern */ + .ant-tabs-tab-btn { + color: var(--primary-color); + } + } + + /* stylelint-disable-next-line selector-class-pattern */ + .ant-tabs-nav .ant-tabs-ink-bar { + background: linear-gradient(to right, var(--primary-color) 100%, transparent 100%); + height: 3px; + bottom: 3px; + } +` + +export const TransactionCellDetailTitle = styled.span` + font-size: 16px; +` + +export const TransactionCellDetailPane = styled(TabPane)` + color: #333; +` + export const TransactionCellDetailPanel = styled.div` width: 100%; font-weight: 500; @@ -92,11 +132,7 @@ export const TransactionCellDetailPanel = styled.div` } .transactionDetailModalClose { - flex: 1; - display: flex; - justify-content: flex-end; - align-items: center; - padding-bottom: 17px; + padding: 17px 0 17px 17px; > img { cursor: pointer; @@ -105,7 +141,7 @@ export const TransactionCellDetailPanel = styled.div` } @media (max-width: 750px) { - padding-bottom: 15px; + padding: 15px 0 15px 15px; > img { width: 12px;