Skip to content

Commit

Permalink
fix(numberinput): add arrowicon to buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Bien committed Jan 15, 2021
1 parent 43f4852 commit e8f96d2
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/ColorButton/ColorButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ColorButton = ({ disabled, color, ...rest }: Props) => {
/>
<Divider orientation='vertical' size={previewHeight} />
<ArrowIcon
direction='bottom'
direction='down'
disabled={disabled}
segments={3}
style={styles.dropdownIcon}
Expand Down
4 changes: 2 additions & 2 deletions src/Icons/ArrowIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Props = {
const pixelSize = 2;

const ArrowIcon = ({
direction = 'bottom',
direction = 'down',
disabled = false,
segments = 4,
style = {},
Expand All @@ -24,7 +24,7 @@ const ArrowIcon = ({

const segmentSizes = new Array(segments).fill(null).map((_, i) => 1 + i * 2);

if (['right', 'bottom'].includes(direction)) {
if (['right', 'down'].includes(direction)) {
segmentSizes.reverse();
}
const isHorizontal = ['left', 'right'].includes(direction);
Expand Down
4 changes: 2 additions & 2 deletions src/Icons/ChevronIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const pixelSize = 2;

const ChevronIcon = ({
color,
direction = 'bottom',
direction = 'down',
disabled = false,
segments = 5,
style = {},
Expand All @@ -27,7 +27,7 @@ const ChevronIcon = ({
const baseColor = color || theme.materialText;
let segmentSizes = new Array(segments).fill(null).map((_, i) => 1 + i * 2);

if (['right', 'bottom'].includes(direction)) {
if (['right', 'down'].includes(direction)) {
segmentSizes = segmentSizes.reverse();
}
const isHorizontal = ['left', 'right'].includes(direction);
Expand Down
4 changes: 2 additions & 2 deletions src/List/ListAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ const ListAccordion = ({
<ChevronIcon
color={theme.progress}
segments={3}
direction={expanded ? 'top' : 'bottom'}
direction={expanded ? 'up' : 'down'}
/>
<ChevronIcon
color={theme.progress}
segments={3}
style={{ marginVertical: 1 }}
direction={expanded ? 'top' : 'bottom'}
direction={expanded ? 'up' : 'down'}
/>
</View>
</View>
Expand Down
18 changes: 11 additions & 7 deletions src/NumberInput/NumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { DimensionValue } from '../types';
import { blockSizes } from '../common/styles';
import { clamp } from '../common/utils';

import { TextInput, Button, Text } from '..';
import { TextInput, Button, ArrowIcon } from '..';

type Props = {
defaultValue?: number;
Expand Down Expand Up @@ -80,9 +80,11 @@ const NumberInput = ({
style={styles.button}
testID='decrement'
>
<Text disabled={isDecrementDisabled} style={styles.buttonText}>
-
</Text>
<ArrowIcon
segments={4}
disabled={isDecrementDisabled}
direction='left'
/>
</Button>
<TextInput
variant={variant}
Expand All @@ -101,9 +103,11 @@ const NumberInput = ({
style={styles.button}
testID='increment'
>
<Text disabled={isIncrementDisabled} style={styles.buttonText}>
+
</Text>
<ArrowIcon
segments={4}
disabled={isIncrementDisabled}
direction='right'
/>
</Button>
</View>
);
Expand Down
4 changes: 2 additions & 2 deletions src/ScrollView/ScrollView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const ScrollView = ({
style={[styles.scrollbarButton]}
>
<ArrowIcon
direction={horizontal ? 'left' : 'top'}
direction={horizontal ? 'left' : 'up'}
disabled={contentFullyVisible}
segments={4}
/>
Expand Down Expand Up @@ -229,7 +229,7 @@ const ScrollView = ({
style={[styles.scrollbarButton]}
>
<ArrowIcon
direction={horizontal ? 'right' : 'bottom'}
direction={horizontal ? 'right' : 'down'}
disabled={contentFullyVisible}
segments={4}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const Select = ({
>
<ArrowIcon
segments={4}
direction='bottom'
direction='down'
disabled={disabled}
style={{
paddingTop: isPressed ? 2 : 0,
Expand Down
2 changes: 1 addition & 1 deletion src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type Sizes = 'sm' | 'md' | 'lg';

export type Orientation = 'horizontal' | 'vertical';

export type Direction = 'top' | 'bottom' | 'left' | 'right';
export type Direction = 'up' | 'down' | 'left' | 'right';

export type DimensionValue = undefined | number | string;

Expand Down

0 comments on commit e8f96d2

Please sign in to comment.