-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* perf: ai param config * pacakge import * perf: ai config doc
- Loading branch information
Showing
19 changed files
with
287 additions
and
172 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React, { useMemo } from 'react'; | ||
import { Slider, SliderTrack, SliderThumb, HStack, SliderMark } from '@chakra-ui/react'; | ||
import MyNumberInput from '../Input/NumberInput'; | ||
|
||
const InputSlider = ({ | ||
onChange, | ||
value, | ||
max = 100, | ||
min = 0, | ||
step = 1 | ||
}: { | ||
value: number; | ||
onChange: (index: number) => void; | ||
max: number; | ||
min: number; | ||
step?: number; | ||
}) => { | ||
const markList = useMemo(() => { | ||
const valLen = max - min; | ||
return [ | ||
valLen * 0.007 + min, | ||
valLen * 0.2 + min, | ||
valLen * 0.4 + min, | ||
valLen * 0.6 + min, | ||
valLen * 0.8 + min, | ||
valLen * 0.985 + min | ||
]; | ||
}, []); | ||
|
||
return ( | ||
<HStack zIndex={10} spacing={3}> | ||
<Slider | ||
max={max} | ||
min={min} | ||
step={step} | ||
value={value} | ||
focusThumbOnChange={false} | ||
onChange={onChange} | ||
> | ||
<SliderTrack bg={'myGray.100'} h={'4px'} /> | ||
{markList.map((val, i) => ( | ||
<SliderMark | ||
key={i} | ||
value={val} | ||
w={'2px'} | ||
h={'2px'} | ||
bg={'#A4A4A4'} | ||
borderRadius={'2px'} | ||
opacity={0.4} | ||
transform={'translateY(-50%)'} | ||
/> | ||
))} | ||
<SliderThumb | ||
bg={'primary.500'} | ||
border={'4px solid'} | ||
borderColor={'#dee7f6'} | ||
w={'18px'} | ||
h={'18px'} | ||
boxShadow={'none'} | ||
// transform={'translate(-50%, -50%) !important'} | ||
/> | ||
</Slider> | ||
<MyNumberInput | ||
size={'sm'} | ||
width={'150px'} | ||
min={min} | ||
max={max} | ||
step={step} | ||
value={value} | ||
onChange={(e) => onChange(e ?? min)} | ||
/> | ||
</HStack> | ||
); | ||
}; | ||
|
||
export default InputSlider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.