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

fix(Dropdown): display icon in selected text #1172

Closed
wants to merge 2 commits into from

Conversation

rbideau
Copy link

@rbideau rbideau commented Jan 17, 2017

First attempt at fixing #1147

@levithomason levithomason changed the title fix(Dropdown): display icon in selected text (#1147) fix(Dropdown): display icon in selected text Jan 17, 2017
@levithomason
Copy link
Member

@rbideau what is the status on this one?

@rbideau
Copy link
Author

rbideau commented Feb 15, 2017

I didn't spent any time on it lately, but I'm still stuck at the same point as I said in #1147.

It's in line 990 of src/modules/Dropdown/Dropdown.js of this PR.

@levithomason
Copy link
Member

The DropdownItem's create method does not set children:

https://github.com/Semantic-Org/Semantic-UI-React/pull/1172/files#diff-39c9e693d6f8be797267ef676395ef14R171

-DropdownItem.create = createShorthandFactory(DropdownItem, value => value)
+DropdownItem.create = createShorthandFactory(DropdownItem, children => ({ children }))

The callback above is invoked when the shorthand value is a string, number, or an array. This change will map those values to the children of the DropdownItem so that:

DropdownItem.create('item 1')
// => <DropdownItem>item 1</DropdownItem>

@codecov-io
Copy link

Codecov Report

Merging #1172 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #1172      +/-   ##
==========================================
+ Coverage   95.88%   95.88%   +<.01%     
==========================================
  Files         879      879              
  Lines        4881     4887       +6     
==========================================
+ Hits         4680     4686       +6     
  Misses        201      201
Impacted Files Coverage Δ
src/modules/Dropdown/Dropdown.js 100% <100%> (ø)
src/modules/Dropdown/DropdownItem.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a0d8011...8290b49. Read the comment docs.

@rbideau
Copy link
Author

rbideau commented Feb 20, 2017

This doesn't work because when there is an icon, rest is an object and then mapValueToProps is not called in factories/createShorthand

@levithomason
Copy link
Member

This PR has gotten stale and seems abandoned. Closing for housekeeping. Still happy to merge an updated and complete community PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants