Skip to content

Comments

refactor(Button): align with Mantine API using leftSection/rightSection#7

Open
beaucalvez wants to merge 1 commit intomainfrom
feat/button-leftSection-rightSection-refactor
Open

refactor(Button): align with Mantine API using leftSection/rightSection#7
beaucalvez wants to merge 1 commit intomainfrom
feat/button-leftSection-rightSection-refactor

Conversation

@beaucalvez
Copy link
Collaborator

Summary

  • Refactored Button component to use leftSection/rightSection props instead of leftIcon/rightIcon to align with Mantine v7+ official API
  • Updated Button.figma.tsx Code Connect to use hasLeftSection/hasRightSection properties
  • Fixed CloseButton.figma.tsx to import from local Design System component
  • Updated Figma URL references to correct node IDs

Changes

Button Component

  • Removed leftIcon and rightIcon props from DSButtonProps interface
  • Added leftSection and rightSection props with improved documentation
  • Updated component implementation to use Mantine-aligned prop names
  • Fixed typo in JSDoc example (</ADDSButton></Button>)
  • Updated CSS class logic from hasLeftIcon to hasLeftSection

Button Code Connect

  • Updated Figma node URL to correct ID: 5331-12700
  • Renamed props from hasIconLeft/hasIconRight to hasLeftSection/hasRightSection
  • Updated documentation to reflect generic content support vs icon-specific

CloseButton Code Connect

  • Changed import from @mantine/core to local DS component ./CloseButton
  • Updated Figma tracking parameter for consistency

Benefits

  • Better Mantine alignment: Uses official Mantine v7+ API conventions
  • More flexible: Props are named for generic content, not just icons
  • Clearer intent: Documentation now reflects that sections can contain any React content (badges, text, icons, etc.)
  • Correct Code Connect: Both Button and CloseButton now map to correct Figma nodes

Test Plan

  • Button Code Connect published successfully to Figma
  • CloseButton Code Connect published successfully to correct node
  • Verify Button renders correctly with leftSection/rightSection props
  • Verify all Button variants still work as expected
  • Test in Figma that code examples generate correctly

- Replace leftIcon/rightIcon props with leftSection/rightSection to match Mantine's official API
- Update Button.figma.tsx to use hasLeftSection/hasRightSection properties
- Update CloseButton.figma.tsx to import from local DS component instead of @mantine/core
- Update Figma URL references to correct node IDs (Button: 5331-12700, CloseButton: 1298-2247)
- Improve prop documentation to reflect generic content vs icon-specific usage

This change improves consistency with Mantine v7+ API and makes the component more flexible for non-icon content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant