Skip to content

Commit

Permalink
Fixed Button's behaviour when loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Ynng committed Feb 19, 2023
1 parent c80abe2 commit c3d050e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/components/Atoms/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,14 @@ const Button = forwardRef(
{iconComponent}
{icon && <FontAwesomeIcon icon={icon} className="w-4 opacity-50" />}
<div className={`flex grow items-center truncate`}>
{loading && (
<BeatLoader size={5} color="#6b7280" className="absolute" />
)}
<span className={clsx(loading && 'opacity-0') + 'truncate'}>
{label}
</span>
<div className="relative h-fit w-fit">
{loading && (
<BeatLoader size={5} color="#6b7280" className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 transform" />
)}
<span className={clsx(loading && 'opacity-0', 'truncate')}>
{label}
</span>
</div>
</div>

{iconRight && (
Expand Down

0 comments on commit c3d050e

Please sign in to comment.