Skip to content

Commit

Permalink
fix: [GSW-2033] TokenSelect Modal UI Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrg committed Jan 6, 2025
1 parent e2d5244 commit 8b29821
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions packages/web/src/components/common/select-token/SelectToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const SelectToken: React.FC<SelectTokenProps> = ({
changeToken,
close,
themeKey,
modalRef,
breakpoint,
recents = [],
isSwitchNetwork,
Expand All @@ -51,7 +50,6 @@ const SelectToken: React.FC<SelectTokenProps> = ({
const tokenNameRef = useRef(tokens.map(() => React.createRef<HTMLSpanElement>()));
const [widthList, setWidthList] = useState<number[]>(tokens.map(() => 0));
const [tokenNameWidthList, setTokenNameWidthList] = useState<number[]>(tokens.map(() => 0));
const [positionTop, setPositionTop] = useState(0);
const [, setRecentsData] = useAtom(TokenState.selectRecents);
const { getGnoscanUrl, getTokenUrl } = useGnoscanUrl();

Expand Down Expand Up @@ -98,22 +96,6 @@ const SelectToken: React.FC<SelectTokenProps> = ({
[changeKeyword],
);

useEffect(() => {
const getPositionTop = () => {
const element = myElementRef.current;
if (element) {
const rect = element.getBoundingClientRect();
const temp = Math.max(positionTop, rect.top);
if (modalRef && modalRef.current) {
modalRef.current.style.top = `${temp}px`;
modalRef.current.style.transform = "translate(-50%, 0)";
}
setPositionTop(temp);
}
};
getPositionTop();
}, [positionTop]);

useEffect(() => {
const temp: number[] = [];
priceRefs.current.forEach(ref => {
Expand All @@ -123,7 +105,7 @@ const SelectToken: React.FC<SelectTokenProps> = ({
}
});
setWidthList(temp);
}, [priceRefs]);
}, [priceRefs, tokens]);

useEffect(() => {
const temp: number[] = [];
Expand Down

0 comments on commit 8b29821

Please sign in to comment.