Skip to content

Commit

Permalink
Fixed button with its width is longer then expected
Browse files Browse the repository at this point in the history
  • Loading branch information
Ynng committed Feb 22, 2023
1 parent 3dfb4a4 commit 3479f69
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/components/Atoms/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Stories file for Button component
import { faServer } from '@fortawesome/free-solid-svg-icons';
import { ComponentStory, ComponentMeta } from '@storybook/react';
import Button from './Button';

Expand Down Expand Up @@ -31,4 +32,5 @@ StartServer.args = {
onClick: () => {
console.log('Start Server');
},
icon: faServer,
};
20 changes: 9 additions & 11 deletions src/components/Atoms/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,15 @@ const Button = forwardRef(
>
{iconComponent}
{icon && <FontAwesomeIcon icon={icon} className="w-4 opacity-50" />}
<div className="flex grow items-center truncate">
<div className="relative h-fit w-fit truncate">
{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')}>{label}</span>
</div>
<div className="relative h-fit w-fit truncate">
{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')}>{label}</span>
</div>

{iconRight && (
Expand Down

0 comments on commit 3479f69

Please sign in to comment.