-
+ const { refs, context, floatingStyles } = useFloating({
+ open: isOpen,
+ onOpenChange: setIsOpen,
+ placement: "bottom",
+ middleware: [
+ offset(6),
+ size({
+ apply({ rects, elements }) {
+ Object.assign(elements.floating.style, { width: `${rects.reference.width}px` });
+ },
+ }),
+ ],
+ });
- {tokenOptions.length > 1 ? (
-
- ) : null}
-
- );
-}
+ const { styles, isMounted } = useTransitionStyles(context, {
+ initial: { transform: "translateY(-10px)", opacity: 0 },
+ open: { transform: "translateY(0)", opacity: 1 },
+ close: { transform: "translateY(-10px)", opacity: 0 },
+ });
-function ChainOption({
- selected,
- option,
- token,
- onSelect = () => undefined,
-}: {
- selected: ChainConfig;
- option: ChainConfig;
- token: Token;
- onSelect?: (chain: ChainConfig) => void;
-}) {
- const { balanceAll } = useApp();
+ const click = useClick(context);
+ const dismiss = useDismiss(context);
+ const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss]);
return (
-