// Copyright 2017-2024 @polkadot/react-signer authors & contributors // SPDX-License-Identifier: Apache-2.0 import type { BN } from '@polkadot/util'; import React, { useEffect, useState } from 'react'; import { InputBalance, Modal, Toggle } from '@polkadot/react-components'; import { BN_ZERO } from '@polkadot/util'; import { useTranslation } from './translate.js'; interface Props { className?: string; onChange: (tip?: BN) => void; } function Tip ({ className, onChange }: Props): React.ReactElement | null { const { t } = useTranslation(); const [tip, setTip] = useState(); const [showTip, setShowTip] = useState(false); useEffect((): void => { onChange(showTip ? tip : BN_ZERO); }, [onChange, showTip, tip]); return ( {showTip && ( )} ); } export default React.memo(Tip);