Extract and refactor dropdown item rendering
Basic Intent: Allow all branch names without accidentally creating layout or backstage DOM. e.g. a branch named `separator` should never create a separator `li` element. Ideally, there should never be a string that could cause this kind of conflict. Implementation: All of `GitLabDropdown.renderItem` is extracted to a standalone module. To render a divider or separator, consumers must now pass in an object like `{ "type": "divider" }` or `{ "type": "separator" }` Notable choices: - All of the functions have a cyclomatic complexity of 3 or less - See: https://en.wikipedia.org/wiki/Cyclomatic_complexity - Note the "Correlation to number of defects" section - While software complexity may not have a directly causal relationship with defects, less complex software is generally easier to reason about, and **may** reduce defects. I personally try to maintain complexity of no higher than 3.
Loading