-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
feat(Dropdown): support additionLabel components #757
Conversation
Current coverage is 99.48% (diff: 100%)@@ master #757 diff @@
==========================================
Files 136 134 -2
Lines 2183 2154 -29
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
- Hits 2172 2143 -29
Misses 11 11
Partials 0 0
|
This is awesome, thanks! Would you consider adding an example showing use of a custom |
@levithomason to docs/app/Examples/modules/Dropdown/Usage ? something like this? render() {
// etc
<Dropdown
additionLabel="Custom: "
{...etc}
/>
// etc
<Dropdown
additionLabel={<i>Custom: </i>}
{...etc}
/>
} |
Exactly. Two separate example files would be superb. One showing a text label, and a separate one showing a component example. |
Added requested examples. 🎉 |
Note: I forgot to mention that this is technically a breaking change and I have added such in the commit message for commitizen
|
…Position="top", just like the jQuery semantic-ui plugin BREAKING CHANGE: Dropdown now now wraps additions in \<b> and uses additionPosition="top" by default.
doh! fixed. I incorrectly assumed it would lint as part of the test runner. Might be helpful to create a pre-commit hook that lints the code. |
We used a few pre-commit |
Could you clarify something regarding the breaking change? I'd like to release this as a feature rather than an API change. My understanding:
My conclusion based on ^ these points is that old additionLabel code will still work, it will just be bold and default to the top of the Dropdown. I see this as a non-breaking feature. What are your thoughts? |
I'm actually going to release this as a feature and we can adjust if there are issues 👍 |
@levithomason okiedokie |
Released in |
Dropdown now wraps additions in
<b>
tags and usesadditionPosition="top"
by default, just like the jQuery semantic-ui plugin.There is also some more subtle changes to align with the jQuery version:
addResult : 'Add <b>{term}</b>'
. We could instead use callbacks, if even more alignment was preferred.addResult={term => <span>Add <b>{term}</b></span>
dangerouslySetInnerHTML
😨addition
className added to it--this can be important for themesYou will notice that, because of a React limitation/design I am passing
text
as an array of elements. Because of the current way the React diffing algorithm works, even though these elements will always be in the same order we must define akey
for them. This isn't pretty--but at least for me, having the same styling behavior of the wrapped<b>
is critical to UX.This was my first experience with enzyme/chai-enzyme so lmk if there is a better way to write the prop tests that contain the array of elements. It's not ideal 😞