Skip to content

Fix auto init bug and refactor code on button components#37

Merged
zainphp merged 3 commits into
mainfrom
sensasi-delight/issue36
Jun 30, 2024
Merged

Fix auto init bug and refactor code on button components#37
zainphp merged 3 commits into
mainfrom
sensasi-delight/issue36

Conversation

@zainphp

@zainphp zainphp commented Jun 30, 2024

Copy link
Copy Markdown
Owner

This pull request introduces several changes to the Button, FAB, and IconButton components in the src/Components directory, focusing on refactoring and improving the code structure. The changes include the introduction of enums for button variants, modifications to component properties, and updates to the rendering logic.

Key changes include:

Button Component Refactoring:

  • Introduced Variant enum to manage button variants and updated the Button class to use this enum.
  • Changed public properties to private where applicable and updated the constructor to initialize these properties correctly.
  • Updated the attributesPreprocess method to include new attributes and refactored the method to use the Variant enum.
  • Added a new method getHtmlTag to determine the HTML tag based on attributes.
  • Added slot validation logic to ensure proper usage of the label attribute and component slot.

FAB Component Refactoring:

  • Introduced Variant enum for FAB variants and updated the FAB class to use this enum.
  • Refactored the constructor to initialize properties correctly and updated the attributesPreprocess method to use the Variant enum. [1] [2]
  • Updated validation logic to use the Variant enum for checking the mini variant.

IconButton Component Refactoring:

  • Removed redundant properties and refactored the constructor to initialize properties directly.
  • Updated the attributesPreprocess method to handle new properties and refactored the logic for setting attributes.

Enum Definitions:

  • Added Variant enums for both Button and FAB components to manage different variants. [1] [2]

Blade Template Updates:

  • Updated the button.blade.php template to use the new getHtmlTag method and refactored the ripple effect logic. [1] [2]
  • Refactored the icon-button.blade.php template to align with the changes in the IconButton component. [1] [2] [3] [4]

These changes improve the maintainability and readability of the code by using enums for variants, encapsulating properties, and refining the rendering logic.

@zainphp zainphp merged commit 5fe1425 into main Jun 30, 2024
@zainphp zainphp deleted the sensasi-delight/issue36 branch June 30, 2024 21:17
@zainphp zainphp linked an issue Dec 11, 2024 that may be closed by this pull request
14 tasks
@zainphp zainphp added Button component FAB component IconButton component labels Dec 13, 2024
@zainphp zainphp self-assigned this Dec 13, 2024
@zainphp zainphp changed the title Refactor IconButton auto init bug Fix auto init bug and refactor code on button components Dec 13, 2024
@zainphp zainphp linked an issue Dec 13, 2024 that may be closed by this pull request
@zainphp zainphp mentioned this pull request Dec 14, 2024
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Button component FAB component IconButton component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto init bug in mbc::icon-button Migrate components init to MDCAutoInit

1 participant