fix(striker-ui): show clear indicator when Select has value

main
Tsu-ba-me 3 years ago
parent 7de3e951f7
commit a0993d5e10
  1. 17
      striker-ui/components/Select.tsx

@ -29,14 +29,15 @@ const Select: FC<SelectProps> = (selectProps) => {
onClearIndicatorClick = SELECT_DEFAULT_PROPS.onClearIndicatorClick,
...muiSelectProps
} = selectProps;
const { children, sx } = muiSelectProps;
const clearIndicator: JSX.Element | undefined = onClearIndicatorClick ? (
<MUIInputAdornment position="end">
<MUIIconButton onClick={onClearIndicatorClick}>
<CloseIcon fontSize="small" />
</MUIIconButton>
</MUIInputAdornment>
) : undefined;
const { children, sx, value } = muiSelectProps;
const clearIndicator: JSX.Element | undefined =
String(value).length > 0 && onClearIndicatorClick ? (
<MUIInputAdornment position="end">
<MUIIconButton onClick={onClearIndicatorClick}>
<CloseIcon fontSize="small" />
</MUIIconButton>
</MUIInputAdornment>
) : undefined;
const combinedSx = {
[`& .${muiSelectClasses.icon}`]: {

Loading…
Cancel
Save