Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/components/Common/EnhancedInputs.js
import * as React from 'react'; | import * as React from 'react'; | ||||
import { Form, Input, Select } from 'antd'; | import { Form, Input, Select } from 'antd'; | ||||
import { DollarOutlined, WalletOutlined } from '@ant-design/icons'; | import { | ||||
ThemedDollarOutlined, | |||||
ThemedWalletOutlined, | |||||
} from '@components/Common/CustomIcons'; | |||||
import styled from 'styled-components'; | import styled from 'styled-components'; | ||||
import { ScanQRCode } from './ScanQRCode'; | import { ScanQRCode } from './ScanQRCode'; | ||||
import useBCH from '@hooks/useBCH'; | import useBCH from '@hooks/useBCH'; | ||||
import { currency } from '@components/Common/Ticker.js'; | import { currency } from '@components/Common/Ticker.js'; | ||||
export const InputAddonText = styled.span` | export const InputAddonText = styled.span` | ||||
width: 100%; | width: 100%; | ||||
height: 100%; | height: 100%; | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | return ( | ||||
type="number" | type="number" | ||||
step={ | step={ | ||||
inputProps.dollar === 1 | inputProps.dollar === 1 | ||||
? 0.01 | ? 0.01 | ||||
: 1 / 10 ** currency.cashDecimals | : 1 / 10 ** currency.cashDecimals | ||||
} | } | ||||
prefix={ | prefix={ | ||||
inputProps.dollar === 1 ? ( | inputProps.dollar === 1 ? ( | ||||
<DollarOutlined /> | <ThemedDollarOutlined /> | ||||
) : ( | ) : ( | ||||
<img | <img | ||||
src={currency.logo} | src={currency.logo} | ||||
alt="" | alt="" | ||||
width={16} | width={16} | ||||
height={16} | height={16} | ||||
/> | /> | ||||
) | ) | ||||
Show All 40 Lines | export const FormItemWithQRCodeAddon = ({ | ||||
onScan, | onScan, | ||||
loadWithCameraOpen, | loadWithCameraOpen, | ||||
inputProps, | inputProps, | ||||
...otherProps | ...otherProps | ||||
}) => { | }) => { | ||||
return ( | return ( | ||||
<Form.Item {...otherProps}> | <Form.Item {...otherProps}> | ||||
<Input | <Input | ||||
prefix={<WalletOutlined />} | prefix={<ThemedWalletOutlined />} | ||||
autoComplete="off" | autoComplete="off" | ||||
addonAfter={ | addonAfter={ | ||||
<ScanQRCode | <ScanQRCode | ||||
loadWithCameraOpen={loadWithCameraOpen} | loadWithCameraOpen={loadWithCameraOpen} | ||||
onScan={onScan} | onScan={onScan} | ||||
/> | /> | ||||
} | } | ||||
{...inputProps} | {...inputProps} | ||||
Show All 24 Lines |