Skip to content

Commit

Permalink
feat: starting to remove framer-motion
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrorezende committed Dec 30, 2024
1 parent bdfad78 commit 5e6dc8b
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions apps/namadillo/src/App/Sidebars/YourStakingDistribution.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { PieChart, PieChartData } from "@namada/components";
import { shortenAddress } from "@namada/utils";
import BigNumber from "bignumber.js";
import { AnimatePresence, motion } from "framer-motion";
import clsx from "clsx";
import { AnimatePresence } from "framer-motion";
import { useState } from "react";
import { twMerge } from "tailwind-merge";
import { MyValidator } from "types";

type YourStakingDistributionProps = {
Expand Down Expand Up @@ -62,29 +64,34 @@ export const YourStakingDistribution = ({
setDisplayedValidator(myValidators[index]);
}}
>
<div className="max-w-[75%] mx-auto leading-tight">
<div className="relative flex items-center justify-center max-w-[75%] mx-auto leading-tight">
<AnimatePresence>
{displayedValidator === undefined && (
<motion.span
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
>
Your Stake Distribution
</motion.span>
)}
{displayedValidator && (
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
>
{displayedValidator.validator.alias}
<span className="block text-neutral-500 text-sm">
{getFormattedPercentage(displayedValidator)}
</span>
</motion.div>
)}
<span
className={twMerge(
clsx("absolute transition-opacity duration-300 opacity-100", {
"opacity-0 pointer-events-none": displayedValidator,
})
)}
>
Your Stake Distribution
</span>
<span
className={twMerge(
clsx(
"flex flex-col text-neutral-500 text-sm opacity-0 pointer-events-none",
"transition-opacity duration-300",
{
"opacity-100 pointer-events-auto": displayedValidator,
}
)
)}
>
{displayedValidator?.validator.alias}
<span className="block">
{displayedValidator &&
getFormattedPercentage(displayedValidator)}
</span>
</span>
</AnimatePresence>
</div>
</PieChart>
Expand Down

0 comments on commit 5e6dc8b

Please sign in to comment.