From 2e2993a7b25c44240e9f59dbcf91b49a7c86fc8a Mon Sep 17 00:00:00 2001 From: yyyyaaa Date: Sat, 18 Nov 2023 21:12:05 +0700 Subject: [PATCH] fix(staking): footer position --- .../stories/staking/LiquidStaking.stories.tsx | 301 ++++++------------ .../chain-swap-input/chain-swap-input.css.ts | 1 + src/ui/liquid-staking/liquid-staking.css.ts | 6 + src/ui/liquid-staking/liquid-staking.lite.tsx | 8 +- 4 files changed, 105 insertions(+), 211 deletions(-) diff --git a/packages/react/stories/staking/LiquidStaking.stories.tsx b/packages/react/stories/staking/LiquidStaking.stories.tsx index 12b005ff..6639f638 100644 --- a/packages/react/stories/staking/LiquidStaking.stories.tsx +++ b/packages/react/stories/staking/LiquidStaking.stories.tsx @@ -143,126 +143,6 @@ export const Primary: Story = { /> ); - - // return ( - // <> - // ( - // - // )} - // isOpen={isOpen} - // title={ - // - // - // Liquid Staking {stakeToken?.name} - // - // - // - // } - // onClose={() => setIsOpen(false)} - // > - // { - // if (payloadToken) { - // console.log("[SB]", { - // payloadToken, - // payloadStakedAmount, - // }); - // setStakedAmount(payloadStakedAmount); - // setStakeToken(payloadToken); - // setReward((prevReward) => { - // // This is just mock reward calculation - // const amt = random(100, 1000, true); - // const notional = random(500, 20000, true); - - // return { - // ...prevReward, - // rewardAmount: amt, - // priceDisplayAmount: notional, - // }; - // }); - // } - // }} - // footerLabel={ - // - // - // Powered by - // - // - // - // } - // onSubmit={() => { - // alert( - // `Staked [${stakeToken?.symbol}]: amt ${stakedAmount} rward ${reward.rewardAmount}` - // ); - // }} - // /> - // - // - // ); }, }; @@ -313,97 +193,102 @@ export const WithModal: Story = { } onClose={() => setIsOpen(false)} > - { - if (payloadToken) { - console.log("[SB]", { - payloadToken, - payloadStakedAmount, - }); - setStakedAmount(payloadStakedAmount); - setStakeToken(payloadToken); - setReward((prevReward) => { - // This is just mock reward calculation - const amt = random(100, 1000, true); - const notional = random(500, 20000, true); + + { + if (payloadToken) { + console.log("[SB]", { + payloadToken, + payloadStakedAmount, + }); + setStakedAmount(payloadStakedAmount); + setStakeToken(payloadToken); + setReward((prevReward) => { + // This is just mock reward calculation + const amt = random(100, 1000, true); + const notional = random(500, 20000, true); - return { - ...prevReward, - rewardAmount: amt, - priceDisplayAmount: notional, - }; - }); - } - }} - footerLabel={ - - - Powered by - - - - } - onSubmit={() => { - alert( - `Staked [${stakeToken?.symbol}]: amt ${stakedAmount} rward ${reward.rewardAmount}` - ); - }} - /> + > + + Powered by + + + + } + onSubmit={() => { + alert( + `Staked [${stakeToken?.symbol}]: amt ${stakedAmount} rward ${reward.rewardAmount}` + ); + }} + attributes={{ + p: "$0", + }} + /> + ); diff --git a/src/ui/chain-swap-input/chain-swap-input.css.ts b/src/ui/chain-swap-input/chain-swap-input.css.ts index 3d8d0b3f..545baaa7 100644 --- a/src/ui/chain-swap-input/chain-swap-input.css.ts +++ b/src/ui/chain-swap-input/chain-swap-input.css.ts @@ -40,6 +40,7 @@ export const chainSwapInput = styleVariants({ "@media": { [`screen and (min-width: ${breakpoints.mdMobile}px)`]: { fontSize: themeVars.fontSize["2xl"], + maxWidth: "160px", }, }, "@container": { diff --git a/src/ui/liquid-staking/liquid-staking.css.ts b/src/ui/liquid-staking/liquid-staking.css.ts index 6aa62bf9..4fcda215 100644 --- a/src/ui/liquid-staking/liquid-staking.css.ts +++ b/src/ui/liquid-staking/liquid-staking.css.ts @@ -13,8 +13,13 @@ const expandVerticalReverse = keyframes({ "100%": { height: CONTRACTED_HEIGHT_PX }, }); +export const accordionBase = style({ + position: "relative", +}); + export const accordionPanel = styleVariants({ expanded: [ + accordionBase, { height: EXPANDED_HEIGHT_PX, overflow: "auto", @@ -22,6 +27,7 @@ export const accordionPanel = styleVariants({ }, ], contracted: [ + accordionBase, { height: CONTRACTED_HEIGHT_PX, opacity: 1, diff --git a/src/ui/liquid-staking/liquid-staking.lite.tsx b/src/ui/liquid-staking/liquid-staking.lite.tsx index 458d94ad..1ce06cc0 100644 --- a/src/ui/liquid-staking/liquid-staking.lite.tsx +++ b/src/ui/liquid-staking/liquid-staking.lite.tsx @@ -295,7 +295,7 @@ export default function LiquidStaking(props: LiquidStakingProps) { direction="horizontal" space="$4" attributes={{ - p: "$4", + py: "$4", position: "relative", justifyContent: "flex-end", zIndex: 1, @@ -468,9 +468,11 @@ export default function LiquidStaking(props: LiquidStakingProps) {