Skip to content

Commit

Permalink
Button fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Soumyadas15 committed Dec 24, 2023
1 parent 534a857 commit 1ee9156
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
49 changes: 23 additions & 26 deletions app/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ interface ButtonProps {
outline?: boolean;
small?: boolean;
icon?: IconType;
dontShowLoading?: boolean; // New prop
}

const Button: React.FC<ButtonProps> = ({
const Button: React.FC<ButtonProps> = ({
label,
onClick,
disabled,
outline,
small,
icon: Icon
icon: Icon,
dontShowLoading = false, // Default value for the new prop
}) => {
return (
return (
<button
onClick={onClick}
disabled={disabled}
Expand Down Expand Up @@ -57,38 +59,33 @@ const Button: React.FC<ButtonProps> = ({
'
/>
)}
{/* {disabled ? (
<div className="flex items-center justify-center w-[2rem]">
<Lottie animationData={animationData}/>
</div>
) : (
<div>{label}</div>
)} */}

<div className='h-full w-full flex items-center justify-center'>
<div className='h-[75%] w-[95%] items-center justify-center flex'>
{disabled ? (
<div>
<div className='block dark:hidden'>
<div className="flex items-center justify-center w-[2rem]">
<Lottie animationData={animationData}/>
</div>
</div>
<div className='hidden dark:block'>
<div className="flex items-center justify-center w-[8rem]">
<Lottie animationData={blackLoader}/>
</div>
</div>

{!dontShowLoading && (
<>
<div className='block dark:hidden'>
<div className="flex items-center justify-center w-[2rem]">
<Lottie animationData={animationData}/>
</div>
</div>
<div className='hidden dark:block'>
<div className="flex items-center justify-center w-[8rem]">
<Lottie animationData={blackLoader}/>
</div>
</div>
</>
)}
</div>

) : (
<div>{label}</div>
)}
</div>

</div>
</button>
);
);
}
export default Button;

export default Button;
7 changes: 6 additions & 1 deletion app/events/[eventId]/EventClient2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,12 @@ const EventClient2: React.FC<EventClient2Props> = ({
onClick={handleCancelRegistration}
/>
) : (
<div></div>
<Button
disabled
label='Cancellation unavailable'
onClick={() => {}}
dontShowLoading={true}
/>
)
) : (
<Button
Expand Down

0 comments on commit 1ee9156

Please sign in to comment.