Skip to content
Snippets Groups Projects
Unverified Commit 5f77b87b authored by Joel Jeremy Marquez's avatar Joel Jeremy Marquez Committed by GitHub
Browse files

[Mobile] Add negative/positive colors to mobile transaction amount input (#2628)

* Add colors to mobile transaction amount input

* VRT updates

* Release notes
parent 97ec8f8d
No related branches found
No related tags found
No related merge requests found
Showing
with 21 additions and 4 deletions
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -75,9 +75,9 @@ export function makeAmountFullStyle( ...@@ -75,9 +75,9 @@ export function makeAmountFullStyle(
zeroColor?: string; zeroColor?: string;
}, },
) { ) {
const positiveColorToUse = colors.positiveColor || theme.noticeText; const positiveColorToUse = colors?.positiveColor || theme.noticeText;
const negativeColorToUse = colors.negativeColor || theme.errorText; const negativeColorToUse = colors?.negativeColor || theme.errorText;
const zeroColorToUse = colors.zeroColor || theme.tableTextSubdued; const zeroColorToUse = colors?.zeroColor || theme.tableTextSubdued;
return { return {
color: color:
value < 0 value < 0
......
...@@ -17,6 +17,7 @@ import { ...@@ -17,6 +17,7 @@ import {
import { useLocalPref } from '../../../hooks/useLocalPref'; import { useLocalPref } from '../../../hooks/useLocalPref';
import { useMergedRefs } from '../../../hooks/useMergedRefs'; import { useMergedRefs } from '../../../hooks/useMergedRefs';
import { type CSSProperties, theme } from '../../../style'; import { type CSSProperties, theme } from '../../../style';
import { makeAmountFullStyle } from '../../budget/util';
import { Button } from '../../common/Button'; import { Button } from '../../common/Button';
import { Text } from '../../common/Text'; import { Text } from '../../common/Text';
import { View } from '../../common/View'; import { View } from '../../common/View';
...@@ -230,6 +231,9 @@ export const FocusableAmountInput = memo(function FocusableAmountInput({ ...@@ -230,6 +231,9 @@ export const FocusableAmountInput = memo(function FocusableAmountInput({
onUpdateAmount={amount => onUpdateAmount(amount, isNegative)} onUpdateAmount={amount => onUpdateAmount(amount, isNegative)}
focused={focused && !disabled} focused={focused && !disabled}
style={{ style={{
...makeAmountFullStyle(value, {
zeroColor: isNegative ? theme.errorText : theme.noticeText,
}),
width: 80, width: 80,
justifyContent: 'center', justifyContent: 'center',
...style, ...style,
...@@ -276,7 +280,14 @@ export const FocusableAmountInput = memo(function FocusableAmountInput({ ...@@ -276,7 +280,14 @@ export const FocusableAmountInput = memo(function FocusableAmountInput({
...style, ...style,
}} }}
> >
<Text style={{ fontSize: 15, userSelect: 'none', ...textStyle }}> <Text
style={{
...makeAmountFullStyle(value),
fontSize: 15,
userSelect: 'none',
...textStyle,
}}
>
{amountToCurrency(Math.abs(value))} {amountToCurrency(Math.abs(value))}
</Text> </Text>
</View> </View>
......
---
category: Enhancements
authors: [joel-jeremy]
---
Add negative/positive colors to mobile transaction amount input
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment