Skip to content

Commit

Permalink
fix: toast ui and earn card position (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangdevnull authored Dec 20, 2023
1 parent 7b4b96c commit 27fcb48
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { media } from "@styles/media";
import mixins from "@styles/mixins";

export const CardListWrapper = styled.div`
${mixins.flexbox("column", "center", "center")};
${mixins.flexbox("column", "center", "start")};
width: 100%;
gap: 24px;
min-height: 390px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const toastOutRightClose = keyframes`
transform: translateX(0);
}
to {
transform: translateX(100%);
transform: translateX(150%);
}
`;

Expand Down
6 changes: 4 additions & 2 deletions packages/web/src/components/common/notice/NoticeToast.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, useCallback, useEffect, useMemo, useState } from "react";
import { FC, useCallback, useEffect, useMemo, useRef, useState } from "react";
import {
INoticeContext,
NoticeContext,
Expand Down Expand Up @@ -107,6 +107,7 @@ const FailContent: FC<{ content?: INoticeContent }> = ({ content }: { content?:
};

const NoticeUIItem: FC<NoticeProps> = ({ onClose, type = "success", id, content }) => {
const isClosed = useRef(false);
const [typeAnimation, setTypeAnimation] = useState<
"toast-item" | "closing" | ""
>("toast-item");
Expand All @@ -116,6 +117,7 @@ const NoticeUIItem: FC<NoticeProps> = ({ onClose, type = "success", id, content
const timeout = setTimeout(() => {
onClose?.(id);
setTypeAnimation("");
isClosed.current = true;
}, 500);
return () => clearTimeout(timeout);
}, [onClose]);
Expand All @@ -124,7 +126,7 @@ const NoticeUIItem: FC<NoticeProps> = ({ onClose, type = "success", id, content
const autoCloseTimeout = setTimeout(() => {
setTypeAnimation("closing");
const animationTimeout = setTimeout(() => {
onClose?.(id);
if (isClosed.current === false) onClose?.(id);
}, 500);
return () => clearTimeout(animationTimeout);
}, 6000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const IncentivizedPoolCard: React.FC<IncentivizedPoolCardProps> = ({
<span className="label-text">{POOL_CONTENT_TITLE.APR}</span>
</div>
<div className="list-content">
<span className="value-text">{pool.liquidity}</span>
<span className="value-text">${pool.liquidity}</span>
<span className="value-text">{pool.apr}</span>
</div>
</div>
Expand Down

0 comments on commit 27fcb48

Please sign in to comment.