Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tab.Container: getLayoutConfig() => replaced the switch block with an object (map) #5995

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

TheCoderAdi
Copy link
Contributor

Tab Container

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

The PR fulfills these requirements:

Other information:
This PR refactors the getLayoutConfig method to replace the switch statement with an object map. The new approach simplifies the logic and improves code readability by using an object to map tabBarPosition values directly to their respective layout configurations.

Changes:

  • Replaced the switch block with an object layoutMap to store layout configurations for bottom, left, right, and top.
  • Simplified the layout selection logic to access the corresponding configuration from the map based on this.tabBarPosition.
  • Fallback behavior remains the same — if no matching layout configuration is found, the function will return null.

This change doesn't introduce any breaking changes but enhances maintainability and readability.

@tobiu tobiu added the hacktoberfest related to the event => https://hacktoberfest.com/ label Oct 1, 2024
@tobiu
Copy link
Collaborator

tobiu commented Oct 1, 2024

Hi @TheCoderAdi,

I added the #hacktoberfest label to the PR and approve it.

Cleanup ideas:

  • For the object map, we do not need strings for the keys. E.g. 'top' => top
  • I would also use block formatting (align on colon) for the map content.

Worth a follow-up PR or I can do it.

Best regards and thx,
Tobias

@tobiu tobiu merged commit a1cfc5f into neomjs:dev Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest related to the event => https://hacktoberfest.com/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants