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

Add inputClasses option #602

Merged
merged 3 commits into from Jan 12, 2024

Conversation

andreyyudin
Copy link
Contributor

Add input classes to implement a part of #428

@colinrotherham colinrotherham added the awaiting triage Needs triaging by team label Nov 17, 2023
@kellylee-gds kellylee-gds removed the awaiting triage Needs triaging by team label Dec 20, 2023
@romaricpascal romaricpascal added this to the Next milestone Jan 11, 2024
@romaricpascal romaricpascal self-assigned this Jan 11, 2024
@@ -471,6 +473,11 @@ export default class Autocomplete extends Component {
}
}

let inputClassesFinal = ''
if (inputClasses && (typeof inputClasses === 'string' || inputClasses instanceof String) && inputClasses.length > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andreyyudin Thanks for adding this new option. Our other string options don't go through as thorough a check, so we'd be happy to leave this as if (inputClasses) for simplicity and consistency of treatment with the rest of the string. Which situations would the extra conditions prevent (if an [object Object], 1 or true slips in, it wouldn't be the end of the world)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @romaricpascal, I am happy if it is as you suggest. I think I was just being overly careful.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brill! Would you prefer I make the change (I'll likely have to force push on your branch to keep the rebuild the last commit) or are you OK doing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that is not too much trouble to do the change on your end, please go ahead, otherwise I am happy to do it too, thank you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem at all, I'll make the change, rebase your branch and re-build dist to get everything ready for merging 😊

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andreyyudin That will likely involve a force push to your branch, as a heads up 😊

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which GitHub is not letting me do, so I'll open a new PR with your rebased commits and the rebuild to facilitate the merge 😊

andreyyudin and others added 3 commits January 12, 2024 17:34
Co-authored-by: Romaric Pascal <romaric.pascal@digital.cabinet-office.gov.uk>
The string concatenation was a little long to be in the JSX, and required each part to include a leading space
Using an Array and join makes things a little easier to follow and less prone to forgetting a space
Copy link
Member

@romaricpascal romaricpascal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andreyyudin I ended up managing to push on your branch so I did the edit, as well as two little refactors:

  • to rearrange the computation of the input class that was getting a bit lengthy to do with strings
  • to simplify the test.

Thanks again for your contribution 😊

@romaricpascal romaricpascal merged commit 0b74fcd into alphagov:main Jan 12, 2024
3 checks passed
@andreyyudin
Copy link
Contributor Author

@romaricpascal Thank you for accepting my contribution and improving it!

@romaricpascal romaricpascal changed the title input classes Add inputClasses option Feb 22, 2024
@romaricpascal romaricpascal mentioned this pull request Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants