diff --git a/packages/neuron-ui/src/components/AddressBook/addressBook.module.scss b/packages/neuron-ui/src/components/AddressBook/addressBook.module.scss index c6f6a9d5d6..118ab0d4b2 100644 --- a/packages/neuron-ui/src/components/AddressBook/addressBook.module.scss +++ b/packages/neuron-ui/src/components/AddressBook/addressBook.module.scss @@ -132,6 +132,7 @@ height: 56px; line-height: 56px; min-width: 100px; + max-width: 200px; .descTips { @media screen and (max-width: 1400px) { transform: translateX(-70%) !important; @@ -165,47 +166,6 @@ transform: translateX(-40%) !important; } } - - .descTipRoot { - position: relative; - width: 208px; - .autoHeight { - width: 100%; - height: 100%; - position: absolute; - - & > svg { - position: absolute; - right: 0; - bottom: 8px; - } - } - .descInput { - border: none; - word-break: break-word; - resize: none; - width: 100%; - height: 100%; - line-height: 24px; - background-color: transparent; - color: var(--main-text-color); - caret-color: #000000; - pointer-events: none; - - @media (prefers-color-scheme: dark) { - caret-color: #fff; - } - } - & > .hidden { - word-break: break-word; - white-space: break-spaces; - visibility: hidden; - min-width: 100px; - min-height: 24px; - padding: 2px; - line-height: 24px; - } - } } @media screen and (max-width: 1330px) { diff --git a/packages/neuron-ui/src/components/AddressBook/index.tsx b/packages/neuron-ui/src/components/AddressBook/index.tsx index 02a9c597ba..5bcd15bd13 100644 --- a/packages/neuron-ui/src/components/AddressBook/index.tsx +++ b/packages/neuron-ui/src/components/AddressBook/index.tsx @@ -3,11 +3,12 @@ import { useTranslation } from 'react-i18next' import { useState as useGlobalState, useDispatch } from 'states' import Dialog from 'widgets/Dialog' import CopyZone from 'widgets/CopyZone' -import { Copy, Edit } from 'widgets/Icons/icon' +import { Copy } from 'widgets/Icons/icon' import Table, { TableProps, SortType } from 'widgets/Table' import { shannonToCKBFormatter, useLocalDescription } from 'utils' import { HIDE_BALANCE } from 'utils/const' import Tooltip from 'widgets/Tooltip' +import ShowOrEditDesc from 'widgets/ShowOrEditDesc' import styles from './addressBook.module.scss' enum TabIdx { @@ -42,8 +43,7 @@ const AddressBook = ({ onClose }: { onClose?: () => void }) => { }, [tabIdx, addresses]) const dispatch = useDispatch() - const { localDescription, onDescriptionPress, onDescriptionChange, onDescriptionFieldBlur, onDescriptionSelected } = - useLocalDescription('address', walletId, dispatch, 'textarea') + const { onChangeEditStatus, onSubmitDescription } = useLocalDescription('address', walletId, dispatch) const columns = useMemo['columns']>( () => [ @@ -87,32 +87,15 @@ const AddressBook = ({ onClose }: { onClose?: () => void }) => { dataIndex: 'description', align: 'center', render(description: string, _idx, item) { - const isSelected = localDescription.key === item.address return ( -
-