-
Notifications
You must be signed in to change notification settings - Fork 101
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
Refactor Menu #715
Merged
Merged
Refactor Menu #715
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLA Assistant Lite All Contributors have signed the CLA. |
|
alfetopito
approved these changes
Jun 21, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, works fine.
I'm just confused by one interface
W3stside
reviewed
Jun 21, 2022
W3stside
approved these changes
Jun 21, 2022
nenadV91
reviewed
Jun 21, 2022
nenadV91
reviewed
Jun 21, 2022
nenadV91
approved these changes
Jun 21, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR is an attempt to refactor and cleanup further of #707
The logic is maintained, but I just rewrote all types, and restructure the code to try to make it more maintainable.
Some of the changes in style were:
get
functions are in reality a component. So they also should be capitalised.i.e before , after )
<Name-of-component>Props
. For example before , afterAlso MAIN_MENU_TYPE because is a type shouldn't be written in all capitals. It was also broken down to be able to define more semantic types and reuse for both the data definition and the components. For example, now the new types can be both be used in the data definition (so they are checked), and also in they components, like this DropDown can receive a
DropDownItem
and render.Breaking down the types also allowed to model as mandatory some fields that before where optional i.e. this title is not optional anymore.
The external/internal logic is better handled, instead of relying on a boolean and then adding this logic which can be complex to follow, because reports duplicated fields like
onClick
andonClickOptional
. Now relies in types so representing the internal/external link is simpler.A similar thing was done for the Dark Mode button. Instead of relying on some String action which makes the component too hard to maintain, we rely on types so rendering this special link is simple