Skip to content

Commit b3057c9

Browse files
authored
fix(NumberInput): small size (#222)
1 parent 1eba92e commit b3057c9

File tree

4 files changed

+45
-5
lines changed

4 files changed

+45
-5
lines changed

.changeset/five-walls-beam.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Fix for the small size of the NumberInput.

src/components/forms/NumberInput/NumberInput.stories.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,13 @@ Default.args = {};
3131

3232
export const WithDefaultValue = Template.bind({});
3333
WithDefaultValue.args = { defaultValue: 5 };
34+
35+
export const Small = Template.bind({});
36+
Small.args = {
37+
size: 'small',
38+
};
39+
40+
export const Disabled = Template.bind({});
41+
Disabled.args = {
42+
isDisabled: true,
43+
};

src/components/forms/NumberInput/NumberInput.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,18 @@ function NumberInput(props: WithNullableValue<CubeNumberInputProps>, ref) {
6666
suffix={
6767
showStepper ? (
6868
<StepperContainer>
69-
<StepButton direction="up" {...incrementButtonProps} />
70-
<StepButton direction="down" {...decrementButtonProps} />
69+
<StepButton
70+
isDisabled={props.isDisabled}
71+
direction="up"
72+
{...incrementButtonProps}
73+
size={otherProps.size}
74+
/>
75+
<StepButton
76+
isDisabled={props.isDisabled}
77+
direction="down"
78+
{...decrementButtonProps}
79+
size={otherProps.size}
80+
/>
7181
</StepperContainer>
7282
) : null
7383
}

src/components/forms/NumberInput/StepButton.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,20 @@ const STEP_BUTTON_STYLES: Styles = {
99
'': '0 (1r - 1bw) 0 0',
1010
down: '0 0 (1r - 1bw) 0',
1111
},
12-
preset: 't4',
13-
lineHeight: '1em',
12+
fontSize: '12px',
13+
lineHeight: '12px',
1414
height: 'auto',
15+
fill: {
16+
'': '#dark.0',
17+
hovered: '#dark.04',
18+
pressed: '#purple.10',
19+
'[disabled]': '#dark.0',
20+
},
21+
22+
'@icon-size': {
23+
'': '14px',
24+
'[data-size="small"]': '13px',
25+
},
1526
};
1627

1728
/**
@@ -24,7 +35,11 @@ export function StepButton(props) {
2435
type="neutral"
2536
styles={STEP_BUTTON_STYLES}
2637
icon={
27-
props.direction === 'up' ? <CaretUpOutlined /> : <CaretDownOutlined />
38+
props.direction === 'up' ? (
39+
<CaretUpOutlined style={{ fontSize: 'var(--icon-size)' }} />
40+
) : (
41+
<CaretDownOutlined style={{ fontSize: 'var(--icon-size)' }} />
42+
)
2843
}
2944
mods={{
3045
up: props.direction === 'up',

0 commit comments

Comments
 (0)