LearnNewsExamplesServices
Frontmatter
title>-
authorTheCoderAdi
stateMerged
createdAtOct 1, 2024, 3:43 AM
updatedAtOct 1, 2024, 11:33 AM
closedAtOct 1, 2024, 11:33 AM
mergedAtOct 1, 2024, 11:33 AM
branchesdevdev
urlhttps://github.com/neomjs/neo/pull/5995
Merged
TheCoderAdi
TheCoderAdi commented on Oct 1, 2024, 3:43 AM

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:

  • It's submitted to the dev branch, not the main branch
  • Enhancement #5429

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 commented on Oct 1, 2024, 11:32 AM

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