-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from okx/feat/bridgeTokenPair
Feat/bridge token pair
- Loading branch information
Showing
9 changed files
with
213 additions
and
96 deletions.
There are no files selected for viewing
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
33 changes: 33 additions & 0 deletions
33
packages/widget-configurator/src/app/configurator/controls/WidthControl.tsx
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,33 @@ | ||
import { Dispatch, SetStateAction, useCallback } from 'react'; | ||
import TextField from '@mui/material/TextField'; | ||
import FormControl from '@mui/material/FormControl'; | ||
import debounce from '@mui/material/utils/debounce'; | ||
|
||
const WidthControl = ({ state, widgetHandler, params }: { state: [string, Dispatch<SetStateAction<string>>], widgetHandler: any, params: any }) => { | ||
const [width, setWidth] = state; | ||
|
||
const updateWidth = debounce((width: string) => { | ||
widgetHandler.current?.updateParams({ ...params, width: width }) | ||
}, 500); | ||
|
||
const handleChange = useCallback((event: any) => { | ||
const width = event.target.value; | ||
setWidth(width) | ||
updateWidth(width); | ||
}, [params]); | ||
|
||
return ( | ||
<FormControl fullWidth> | ||
<TextField | ||
size='small' | ||
value={width} | ||
fullWidth | ||
label='Width' | ||
placeholder='number' | ||
onChange={handleChange} | ||
/> | ||
</FormControl> | ||
); | ||
}; | ||
|
||
export default WidthControl; |
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.