Skip to content

Commit 397e8a1

Browse files
committed
fix(SearchInput): clearable state
1 parent 8521d39 commit 397e8a1

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/components/fields/SearchInput/SearchInput.stories.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ Default.args = {};
2626
export const Clearable = Template.bind({});
2727
Clearable.args = {
2828
isClearable: true,
29+
value: 'value',
30+
};
31+
32+
export const SmallClearable = Template.bind({});
33+
SmallClearable.args = {
34+
isClearable: true,
35+
value: 'value',
36+
size: 'small',
2937
};
3038

3139
export const WithDefaultValue = Template.bind({});

src/components/fields/SearchInput/SearchInput.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ const ClearButton = tasty(Button, {
2727
icon: <CloseIcon />,
2828
styles: {
2929
radius: 'right (1r - 1bw)',
30-
width: '4x',
30+
width: {
31+
'': '4x',
32+
'[data-size="small"]': '3x',
33+
},
3134
height: 'auto',
3235
placeSelf: 'stretch',
3336
},
@@ -63,6 +66,7 @@ export const SearchInput = forwardRef(function SearchInput(
6366
{props.suffix}
6467
{showClearButton && (
6568
<ClearButton
69+
size={props.size}
6670
type={validationState === 'invalid' ? 'clear' : 'neutral'}
6771
theme={validationState === 'invalid' ? 'danger' : undefined}
6872
{...ariaToCubeButtonProps(clearButtonProps)}

0 commit comments

Comments
 (0)