LaunchPadLab / lp-components

Our Components
http://lp-components.herokuapp.com
MIT License
5 stars 1 forks source link

Accept selectedOptionsDisplayFormatter prop #504

Open bhennes2 opened 2 years ago

bhennes2 commented 2 years ago

Author Checklist

bhennes2 commented 2 years ago

@chawes13 Also looking to port over some default styles for this component too from MTC. Ben is working to parse out those styles that I'd like to include in this PR.

chawes13 commented 2 years ago

@bhennes2 Has your local implementation held up on your client project? Still interested in including this functionality in the library?

josiasds commented 6 months ago

@CodiumAI-Agent /improve --extended

CodiumAI-Agent commented 6 months ago

PR Code Suggestions

💡 Suggestion:

Correct the validator's logic by passing the selectedOptionsDisplayFormatter prop to the DropdownSelect component.

File: src/forms/inputs/dropdown-checkbox-group.js (62-64)

Example code: ___ Existing code: ```python ``` Improved code: ```python ```

💡 Suggestion:

Wrap the PropTypes and defaultProps into a function to improve reusability and maintainability.

File: src/forms/helpers/dropdown-select.js (7-18)

Example code: ___ Existing code: ```python const propTypes = { children: PropTypes.node, className: PropTypes.string, selectedValues: PropTypes.arrayOf(PropTypes.string), selectedOptionsDisplayFormatter: PropTypes.func, ...togglePropTypes('expanded'), } const defaultProps = { className: '', selectedValues: [], selectedOptionsDisplayFormatter: getLabel, } ``` Improved code: ```python function getDropdownSelectProps() { return { propTypes: { children: PropTypes.node, className: PropTypes.string, selectedValues: PropTypes.arrayOf(PropTypes.string), selectedOptionsDisplayFormatter: PropTypes.func, ...togglePropTypes('expanded'), }, defaultProps: { className: '', selectedValues: [], selectedOptionsDisplayFormatter: getLabel, } } } ```