Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Edit TagGroup component to support onClick and displaying titles #129

Merged
merged 2 commits into from
Jul 10, 2019

Conversation

hstastna
Copy link

@hstastna hstastna commented Jul 1, 2019

What:
Edit TagGroup component to support onClick and displaying titles (if they are specified).
Add some data for the appropriate storybook.

Why:
Needed for ManageIQ/manageiq-ui-classic#5675

Related RFE:
https://bugzilla.redhat.com/show_bug.cgi?id=1678124

Some screenshots at:
ManageIQ/manageiq-ui-classic#5675

@hstastna hstastna force-pushed the Add_links_titles_for_TagGroup branch from 58ca058 to 417f655 Compare July 2, 2019 08:34
@hstastna
Copy link
Author

hstastna commented Jul 2, 2019

@miq-bot add_reviewer @rvsia

@miq-bot miq-bot requested a review from rvsia July 2, 2019 08:38
@hstastna hstastna force-pushed the Add_links_titles_for_TagGroup branch from 417f655 to df06f8d Compare July 2, 2019 08:41
@hstastna hstastna changed the title [WIP] Edit TagGroup component to support onClick and displaying titles Edit TagGroup component to support onClick and displaying titles Jul 2, 2019
@hstastna hstastna force-pushed the Add_links_titles_for_TagGroup branch 3 times, most recently from c6578af to 2cc535a Compare July 9, 2019 08:47
@hstastna
Copy link
Author

hstastna commented Jul 9, 2019

@miq-bot add_reviewer @Hyperkid123

@miq-bot miq-bot requested a review from Hyperkid123 July 9, 2019 10:46
<IconOrImage icon={subitem.icon} image={subitem.image} text={subitem.text} />
{this.renderSubiteList(subitem)}
{Array.isArray(subitem.value) ? this.renderSubiteList(subitem) : this.renderSubitem(subitem)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you fix this typo renderSubiteList? I know it was here before 😉

Copy link
Contributor

@Hyperkid123 Hyperkid123 left a comment

Choose a reason for hiding this comment

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

Code looks good.

@hstastna hstastna force-pushed the Add_links_titles_for_TagGroup branch from 2cc535a to 1949ade Compare July 9, 2019 12:04
*/
renderSubiteList = subitem => (
renderSubitemList = subitem => (
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

<IconOrImage icon={item.icon} image={item.image} title={item.title} />
{item.value}
<td title={item.title} onClick={e => this.checkLinkItem(item, e)}>
<IconOrImage icon={item.icon} image={item.image} title={item.title} /> {item.value}
Copy link
Contributor

@himdel himdel Jul 9, 2019

Choose a reason for hiding this comment

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

keep the 2 lines as 2 lines please :)

(otherwise, {item.value} is completely hidden in the code)

Copy link
Author

@hstastna hstastna Jul 9, 2019

Choose a reason for hiding this comment

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

Do you think it is better to add &nbsp; before {item.value} if I want to achieve a nice space between icon and the item name? Like this:
icon_space
Because I think we don't want this:
icon_close

Moving {item.value} to the same line as IconOrImage was the simplest and working fix for this.

Copy link
Contributor

@himdel himdel Jul 10, 2019

Choose a reason for hiding this comment

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

Ah, sorry, react jsx is not html...

I think the canonical way to do this (if I understand facebook/jsx#19 (comment) right) is..

<td title={item.title} onClick={e => this.checkLinkItem(item, e)}>
  <IconOrImage icon={item.icon} image={item.image} title={item.title} />
  {' '}
  {item.value}
</td>

up to you :)

@himdel
Copy link
Contributor

himdel commented Jul 9, 2019

Overall, matches the other components which already do the same thing 👍

(I don't agree that onClick is ever the right way to go to a different screen, we should be using proper links, but that's a separate issue.)

@hstastna hstastna force-pushed the Add_links_titles_for_TagGroup branch from 1949ade to 64486c6 Compare July 9, 2019 15:31
@martinpovolny
Copy link
Member

@himdel : all feedback properly adressed?

@hstastna hstastna force-pushed the Add_links_titles_for_TagGroup branch from 64486c6 to 740737b Compare July 10, 2019 10:04
@himdel
Copy link
Contributor

himdel commented Jul 10, 2019

@martinpovolny No real issues from me, only #129 (comment) but it's not really that important.

@hstastna hstastna force-pushed the Add_links_titles_for_TagGroup branch from 740737b to 9a34979 Compare July 10, 2019 13:41
@miq-bot
Copy link
Member

miq-bot commented Jul 10, 2019

Checked commits hstastna/react-ui-components@0837a10~...9a34979 with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
0 files checked, 0 offenses detected
Everything looks fine. ⭐

@himdel himdel self-assigned this Jul 10, 2019
@himdel himdel added this to the Sprint 116 Ending Jul 22, 2019 milestone Jul 10, 2019
@himdel himdel added the enhancement New feature or request label Jul 10, 2019
@himdel himdel merged commit 59de50b into ManageIQ:master Jul 10, 2019
@karelhala
Copy link
Contributor

🎉 This PR is included in version 0.11.28 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants