mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* UI customizations: new features Fixes #2905 * colors for graphs * introduce env variable * colors for topbar, stats, selected state and tabs * fix build * fix validator * refactor link.primary.hover color token * refactor selected colors * update styles for switch and fix some color tokens * change color for selectable controls * icon color tokens refactoring * UI customizations: new features Fixes #2905 * test for common components * tweaks * migrate from color-mode-hex cookie to color-theme cookie * clean up * update screenshots * more screenshot updates * update default color of chart line * update envs for mega eth
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { chakra, Flex } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
import { Switch } from 'toolkit/chakra/switch';
|
|
import { Hint } from 'toolkit/components/Hint/Hint';
|
|
|
|
interface Props {
|
|
id: string;
|
|
onChange: (isChecked: boolean) => void;
|
|
initialValue?: boolean;
|
|
isDisabled?: boolean;
|
|
className?: string;
|
|
}
|
|
|
|
const UserOpCallDataSwitch = ({ className, initialValue, isDisabled, onChange, id }: Props) => {
|
|
const [ isChecked, setIsChecked ] = React.useState(initialValue ?? false);
|
|
|
|
const handleChange = React.useCallback(() => {
|
|
setIsChecked((prevValue) => {
|
|
const nextValue = !prevValue;
|
|
onChange(nextValue);
|
|
return nextValue;
|
|
});
|
|
}, [ onChange ]);
|
|
|
|
return (
|
|
<Flex ml="auto" alignItems="center" gap={ 2 }>
|
|
<Switch
|
|
className={ className }
|
|
id={ id }
|
|
checked={ isChecked }
|
|
disabled={ isDisabled }
|
|
onCheckedChange={ handleChange }
|
|
direction="rtl"
|
|
labelProps={{ fontWeight: '600', textStyle: 'sm' }}
|
|
>
|
|
<chakra.span hideBelow="lg">Show external call data</chakra.span>
|
|
<chakra.span hideFrom="lg">External call data</chakra.span>
|
|
</Switch>
|
|
<Hint label="Inner call data is a predicted decoded call from this user operation"/>
|
|
</Flex>
|
|
);
|
|
};
|
|
|
|
export default React.memo(chakra(UserOpCallDataSwitch));
|