-
Notifications
You must be signed in to change notification settings - Fork 5.2k
/
Copy pathPlusMinusButton.tsx
38 lines (36 loc) · 1.02 KB
/
PlusMinusButton.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Plus as PlusIcon, Minus as MinusIcon } from 'ui/src/components/icons'
import { Flex } from 'ui/src/components/layout/Flex'
import { TouchableArea } from 'ui/src/components/touchable/TouchableArea'
import { iconSizes } from 'ui/src/theme'
export enum PlusMinusButtonType {
Plus,
Minus,
}
export function PlusMinusButton({
type,
disabled,
onPress,
}: {
type: PlusMinusButtonType
disabled: boolean
onPress: (type: PlusMinusButtonType) => void
}): JSX.Element {
return (
<TouchableArea
alignItems="center"
backgroundColor={disabled ? '$surface3' : '$neutral2'}
borderRadius="$roundedFull"
disabled={disabled}
height={iconSizes.icon28}
justifyContent="center"
width={iconSizes.icon28}
onPress={(): void => onPress(type)}
>
{type === PlusMinusButtonType.Plus ? (
<PlusIcon color="$surface1" size="$icon.12" strokeWidth={2.5} />
) : (
<MinusIcon color="$surface1" size="$icon.12" strokeWidth={2.5} />
)}
</TouchableArea>
)
}