Skip to content

Commit

Permalink
chore(components): remove any in SelectBar
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemonexe committed Dec 3, 2024
1 parent fda6178 commit 8e06da9
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export type SelectBarProps<V extends ValueTypes> = {
} & AllowedFrameProps;

// Generic type V is determined by selectedOption/options values
export const SelectBar: <V extends ValueTypes>(props: SelectBarProps<V>) => JSX.Element = ({
export const SelectBar = <V extends ValueTypes>({
label,
options,
selectedOption,
Expand All @@ -180,7 +180,7 @@ export const SelectBar: <V extends ValueTypes>(props: SelectBarProps<V>) => JSX.
className,
'data-testid': dataTest,
...rest
}) => {
}: SelectBarProps<V>) => {
const [selectedOptionIn, setSelected] = useState<ValueTypes | undefined>(selectedOption);
const { elevation } = useElevation();
const frameProps = pickAndPrepareFrameProps(rest, allowedSelectBarFrameProps);
Expand All @@ -192,14 +192,14 @@ export const SelectBar: <V extends ValueTypes>(props: SelectBarProps<V>) => JSX.
}, [selectedOption, setSelected]);

const handleOptionClick = useCallback(
(option: Option<ValueTypes>) => () => {
(option: Option<V>) => () => {
if (isDisabled || option.value === selectedOptionIn) {
return;
}

setSelected(option.value);

onChange?.(option?.value as any);
onChange?.(option?.value);
},
[isDisabled, selectedOptionIn, onChange],
);
Expand Down

0 comments on commit 8e06da9

Please sign in to comment.