Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Kevin/Calculator show contractsize #1930

Merged
2 commits merged into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/components/elements/dropdown-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const DropdownInput = styled.input`
`

const DropdownSearch = ({
contract_size,
contractSize,
error,
has_short_name,
items,
Expand All @@ -48,9 +48,8 @@ const DropdownSearch = ({
}) => {
const [input_value, setInputValue] = useState('')
const [dropdown_items, setDropdownItems] = useState([...items])
const [is_open, dropdown_ref, nodes, handleChange, toggleListVisibility, setOpen] = useDropdown(
onChange,
)
const [is_open, dropdown_ref, nodes, handleChange, toggleListVisibility, setOpen] =
useDropdown(onChange)

const handleInputChange = (e) => {
setInputValue(e.target.value)
Expand Down Expand Up @@ -116,13 +115,13 @@ const DropdownSearch = ({
selected_option={selected_item}
/>
</DropdownContainer>
<BottomLabel contract_size={contract_size} error={error} />
<BottomLabel contractSize={contractSize} error={error} />
</>
)
}

DropdownSearch.propTypes = {
contract_size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
contractSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
default_item: PropTypes.any,
error: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
has_short_name: PropTypes.bool,
Expand Down
14 changes: 7 additions & 7 deletions src/components/elements/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,24 +304,24 @@ ItemList.propTypes = {
selected_option: PropTypes.any,
}

export const BottomLabel = ({ error, contract_size }) => {
export const BottomLabel = ({ error, contractSize }) => {
return (
<StyledDiv>
<ErrorMessages lh="1.4" align="left" color="red-1">
{error}
</ErrorMessages>

{contract_size && (
{contractSize && (
<ContractSizeWrapper lh="1.4" align="left">
Contract size : {getCommaSeparatedNumber(contract_size)}
Contract size : {getCommaSeparatedNumber(contractSize)}
</ContractSizeWrapper>
)}
</StyledDiv>
)
}

BottomLabel.propTypes = {
contract_size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
contractSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
error: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
}

Expand All @@ -333,7 +333,7 @@ const Dropdown = ({
label,
error,
selected_option,
contract_size,
contractSize,
...props
}) => {
const [is_open, dropdown_ref, nodes, handleChange, toggleListVisibility] = useDropdown(onChange)
Expand Down Expand Up @@ -374,13 +374,13 @@ const Dropdown = ({
selected_option={selected_option}
/>
</DropdownContainer>
<BottomLabel contract_size={contract_size} error={error} />
<BottomLabel contractSize={contractSize} error={error} />
</>
)
}

Dropdown.propTypes = {
contract_size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
contractSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
default_option: PropTypes.any,
error: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
has_short_name: PropTypes.bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const MarginCalculator = () => {
<DropdownSearch
id="symbol"
key={tab}
contract_size={values.contractSize}
contractSize={values.contractSize}
default_item={optionItemDefault}
error={touched.symbol && errors.symbol}
items={values.optionList}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const SwapCalculator = () => {
)
setFieldValue('symbol', value)
}}
contract_size={values.contractSize}
contractSize={values.contractSize}
error={touched.symbol && errors.symbol}
onBlur={handleBlur}
/>
Expand Down Expand Up @@ -516,6 +516,7 @@ const SwapCalculator = () => {

<CalculatorBody>
<Dropdown
mb="3.6rem"
default_option={optionItemDefault}
option_list={values.optionList}
label={localize('Symbol')}
Expand Down