Problem
the MoneyRequestAmountForm is currently designed to be used from the Amount pages where it is displayed in a view that takes up the whole page, and has specific style for that. We'd like to reuse this input without any extra style and be able to re-style it with ease.
Solution
Decouple the logic that handles accepting and formatting amounts from MoneyRequestAmountForm, by creating a new MoneyRequestAmountInput that doesn't have any custom styles and looks like a basic input.
- Move all the logic for handling input from
MoneyRequestAmountForm into the new input.
- The
MoneyRequestAmountForm should only keep navigation and form logic.
- The input should have a new callback
onAmountChange that can be used by parent components.
- Display currency as part of the input as in the mocks. For this we can simply use the
prefixCharacter that should be prop drilled into the underlying TextInput used in this component. We will need to configure the padding of the prefix text to accomodate for both single character currencies and 3 characters currencies. (e.g. $ and AED). Since the prefix is absolutely positioned, this is necessary.
- The new input should accept styles so that it can be reused from the Amount full pages, e.g. no borders, increased font, etc.
Here's a mock of how the input should look like when used from the Splits page:
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~01f6b340c95c53b510
- Upwork Job ID: 1780706666038550528
- Last Price Increase: 2024-04-30
- Automatic offers:
- hungvu193 | Reviewer | 0
- ZhenjaHorbach | Contributor | 0
Problem
the
MoneyRequestAmountFormis currently designed to be used from the Amount pages where it is displayed in a view that takes up the whole page, and has specific style for that. We'd like to reuse this input without any extra style and be able to re-style it with ease.Solution
Decouple the logic that handles accepting and formatting amounts from
MoneyRequestAmountForm, by creating a newMoneyRequestAmountInputthat doesn't have any custom styles and looks like a basic input.MoneyRequestAmountForminto the new input.MoneyRequestAmountFormshould only keep navigation and form logic.onAmountChangethat can be used by parent components.prefixCharacterthat should be prop drilled into the underlyingTextInputused in this component. We will need to configure the padding of the prefix text to accomodate for both single character currencies and 3 characters currencies. (e.g.$andAED). Since the prefix is absolutely positioned, this is necessary.Here's a mock of how the input should look like when used from the Splits page:
Upwork Automation - Do Not Edit