更正Props类型定义。
This commit is contained in:
parent
2c53ec3e12
commit
9a6db8b8de
|
@ -4,13 +4,13 @@ import { useCallback, useRef, useState } from 'react';
|
|||
import type { Option } from '../models';
|
||||
import styles from './HSegmentedControl.module.css';
|
||||
|
||||
type SegmentedConttrolProps = {
|
||||
type HSegmentedControlProps = {
|
||||
options?: Option[];
|
||||
value?: Option['value'];
|
||||
onChange?: (value: Option['value']) => void;
|
||||
};
|
||||
|
||||
export function HSegmentedControl({ options = [], value, onChange }: SegmentedConttrolProps) {
|
||||
export function HSegmentedControl({ options = [], value, onChange }: HSegmentedControlProps) {
|
||||
const [selected, setSelected] = useState(value ?? options[0].value ?? null);
|
||||
const [sliderPosition, setSliderPosition] = useState(0);
|
||||
const [sliderWidth, setSliderWidth] = useState(0);
|
||||
|
|
Loading…
Reference in New Issue
Block a user