import React, { FunctionComponent } from 'react' import styled from '@emotion/styled' import { LinkIcon } from '@heroicons/react/outline' import useMangoStore from '../stores/useMangoStore' import { MoveIcon } from './icons' import EmptyState from './EmptyState' const StyledDragWrapperContent = styled.div` transition: all 0.25s ease-in; opacity: 0; ` const StyledDragBkg = styled.div` transition: all 0.25s ease-in; opacity: 0; ` const StyledDragWrapper = styled.div` :hover { ${StyledDragWrapperContent} { opacity: 1; } ${StyledDragBkg} { opacity: 0.9; } } ` interface FloatingElementProps { className?: string showConnect?: boolean } const FloatingElement: FunctionComponent = ({ className, children, showConnect, }) => { const { uiLocked } = useMangoStore((s) => s.settings) const connected = useMangoStore((s) => s.wallet.connected) const wallet = useMangoStore((s) => s.wallet.current) return (
{!connected && showConnect ? (
} onClickButton={() => wallet.connect()} title="Connect Wallet" />
) : null} {!uiLocked ? (
Drag to reposition
) : null} {children}
) } export default FloatingElement