Commit 2a751b98 authored by Moody Salem's avatar Moody Salem

Workaround for popover placement on elements that move, styling for small amounts of search results

parent 175e93fb
...@@ -3,6 +3,7 @@ import React, { useState } from 'react' ...@@ -3,6 +3,7 @@ import React, { useState } from 'react'
import { createPortal } from 'react-dom' import { createPortal } from 'react-dom'
import { usePopper } from 'react-popper' import { usePopper } from 'react-popper'
import styled, { keyframes } from 'styled-components' import styled, { keyframes } from 'styled-components'
import useInterval from '../../hooks/useInterval'
const fadeIn = keyframes` const fadeIn = keyframes`
from { from {
...@@ -105,7 +106,7 @@ export default function Popover({ content, showPopup, children }: PopoverProps) ...@@ -105,7 +106,7 @@ export default function Popover({ content, showPopup, children }: PopoverProps)
const [referenceElement, setReferenceElement] = useState<HTMLDivElement>(null) const [referenceElement, setReferenceElement] = useState<HTMLDivElement>(null)
const [popperElement, setPopperElement] = useState<HTMLDivElement>(null) const [popperElement, setPopperElement] = useState<HTMLDivElement>(null)
const [arrowElement, setArrowElement] = useState<HTMLDivElement>(null) const [arrowElement, setArrowElement] = useState<HTMLDivElement>(null)
const { styles, attributes } = usePopper(referenceElement, popperElement, { const { styles, update, attributes } = usePopper(referenceElement, popperElement, {
placement: 'auto', placement: 'auto',
strategy: 'fixed', strategy: 'fixed',
modifiers: [ modifiers: [
...@@ -127,6 +128,8 @@ export default function Popover({ content, showPopup, children }: PopoverProps) ...@@ -127,6 +128,8 @@ export default function Popover({ content, showPopup, children }: PopoverProps)
document.getElementById('popover-container') document.getElementById('popover-container')
) )
useInterval(update, showPopup ? 100 : null)
return ( return (
<> <>
<ReferenceElement ref={setReferenceElement}>{children}</ReferenceElement> <ReferenceElement ref={setReferenceElement}>{children}</ReferenceElement>
......
...@@ -25,7 +25,13 @@ export default function PairList({ ...@@ -25,7 +25,13 @@ export default function PairList({
} }
return ( return (
<FixedSizeList itemSize={54} height={500} itemCount={pairs.length} width="100%" style={{ flex: '1' }}> <FixedSizeList
itemSize={54}
height={500}
itemCount={pairs.length}
width="100%"
style={{ flex: '1', minHeight: 200 }}
>
{({ index, style }) => { {({ index, style }) => {
const pair = pairs[index] const pair = pairs[index]
......
...@@ -47,7 +47,13 @@ export default function TokenList({ ...@@ -47,7 +47,13 @@ export default function TokenList({
return <ModalInfo>{t('noToken')}</ModalInfo> return <ModalInfo>{t('noToken')}</ModalInfo>
} }
return ( return (
<FixedSizeList width="100%" height={500} itemCount={tokens.length} itemSize={50} style={{ flex: '1' }}> <FixedSizeList
width="100%"
height={500}
itemCount={tokens.length}
itemSize={50}
style={{ flex: '1', minHeight: 200 }}
>
{({ index, style }) => { {({ index, style }) => {
const { address, symbol } = tokens[index] const { address, symbol } = tokens[index]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment