Skip to content

Commit

Permalink
[sparkle] - fix: adjust button wrapping based on disabled state
Browse files Browse the repository at this point in the history
 - Buttons now render directly without wrapping in SheetClose if disabled
 - Ensures correct visual and interaction pattern for disabled state buttons in SheetFooter
  • Loading branch information
JulesBelveze committed Nov 28, 2024
1 parent 3fec337 commit 03b3668
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
22 changes: 16 additions & 6 deletions sparkle/src/components/Sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,22 @@ const SheetFooter = ({
)}
{...props}
>
{(leftButtonProps || rightButtonProps) && (
<SheetClose className={sheetCloseClassName}>
{leftButtonProps && <Button {...leftButtonProps} />}
{rightButtonProps && <Button {...rightButtonProps} />}
</SheetClose>
)}
{leftButtonProps &&
(leftButtonProps.disabled ? (
<Button {...leftButtonProps} />
) : (
<SheetClose className={sheetCloseClassName}>
<Button {...leftButtonProps} />
</SheetClose>
))}
{rightButtonProps &&
(rightButtonProps.disabled ? (
<Button {...rightButtonProps} />
) : (
<SheetClose className={sheetCloseClassName}>
<Button {...rightButtonProps} />
</SheetClose>
))}
{children}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion sparkle/src/stories/Sheet.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function SheetDemo() {
<SheetFooter
sheetCloseClassName="s-flex s-gap-2"
leftButtonProps={{ label: "Cancel", variant: "warning" }}
rightButtonProps={{ label: "Save" }}
rightButtonProps={{ label: "Save", disabled: true }}
/>
</SheetContent>
</Sheet>
Expand Down

0 comments on commit 03b3668

Please sign in to comment.