Skip to content

Commit

Permalink
style(busy-bar): animate opacity instead of removing the element
Browse files Browse the repository at this point in the history
this makes the appearance look much smoother
  • Loading branch information
steveoh committed Nov 20, 2024
1 parent d9a3c83 commit 22a02d9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/utah-design-system/src/components/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useProgressBar } from 'react-aria';
import { twJoin } from 'tailwind-merge';

export const Spinner = () => {
const { progressBarProps } = useProgressBar({
Expand Down Expand Up @@ -48,14 +49,13 @@ export const BusyBar = ({ busy }: { busy?: boolean }) => {
isIndeterminate: true,
});

if (!busy) {
return null;
}

return (
<div
{...progressBarProps}
className="absolute inset-x-0 top-0 z-[1] h-2 w-full min-w-full animate-gradient-x bg-gradient-to-r from-secondary-700/90 from-30% via-accent-400/90 to-primary-800/90 to-70% transition-all duration-700 ease-in-out"
className={twJoin(
[busy ? 'opacity-100' : 'opacity-0'],
'will-change absolute inset-x-0 top-0 z-[1] h-2 w-full min-w-full animate-gradient-x bg-gradient-to-r from-secondary-700/90 from-30% via-accent-400/90 to-primary-800/90 to-70% transition-all duration-700 ease-in-out',
)}
></div>
);
};

0 comments on commit 22a02d9

Please sign in to comment.