-
Notifications
You must be signed in to change notification settings - Fork 19
Conversation
src/toolbar/ToolbarButton.jsx
Outdated
name={props.name} | ||
title={props.title} | ||
className={classNames('btn btn-default', { active: props.selected, disabled: !props.enabled })} | ||
data-explorer={props.explorer} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you get rid of these explicit keys in favor of generic data?
No part of toolbar code (except for miqToolbarOnClick
) should be aware that data-function and data-function-data and data-click even exist.. (and all the others).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess yes. Just I'd love to get a functional parity with the current implementation first and then improve.
But right, using generic data
should be fine as long as we do not handle some data-
key in some special way in the current implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will be removing all the data-
tags because the onClick
handler now uses props
directly. So this will go away.
f594fb0
to
f960e16
Compare
1efc5f4
to
b0a890e
Compare
b0a890e
to
1717a04
Compare
src/toolbar/ToolbarList.jsx
Outdated
|
||
import CountContext from './ToolbarContext'; | ||
|
||
// const classNames = require('classnames'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment here
src/toolbar/Toolbar.jsx
Outdated
const toolbarGroupHasContent = group => | ||
group && | ||
group.filter(item => item && | ||
(isButtonOrSelect(item))).length !== 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary parenthesis around isButtonOrSelect
src/toolbar/ToolbarButton.jsx
Outdated
|
||
const classNames = require('classnames'); | ||
|
||
const ButtonIcon = (props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
({ img_url: imgUrl, icon, color, enabled })
src/toolbar/ToolbarButton.jsx
Outdated
enabled: PropTypes.bool, | ||
}; | ||
|
||
/* FIXME |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about these comments? Are they still valid?
src/toolbar/ToolbarButton.jsx
Outdated
data: PropTypes.any, | ||
selected: PropTypes.bool, | ||
enabled: PropTypes.bool, | ||
// hidden: PropTypes.bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented prop
.kebab .btn-group.open .dropdown-toggle { | ||
box-shadow: none; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty line
|
||
describe('Toolbar', () => { | ||
it('Well it works ;-)', () => { | ||
const t = shallow(<Toolbar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename t
to something more meaningful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well I like the 't' as toolbar, or the test subject
I think that the short name does not negatively affect readability in this context
src/toolbar/tests/toolbar.test.js
Outdated
@@ -0,0 +1,97 @@ | |||
import React from 'react'; | |||
import toJson from 'enzyme-to-json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't use it here
src/toolbar/ToolbarButton.jsx
Outdated
id: PropTypes.string, | ||
name: PropTypes.string, | ||
url: PropTypes.string, | ||
url_parms: PropTypes.any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This triggers Prop type
any is forbidden eslint(react/forbid-prop-types)
src/toolbar/tests/toolbar.test.js
Outdated
import { ToolbarList } from '../ToolbarList'; | ||
import { ToolbarView } from '../ToolbarView'; | ||
|
||
const toolbarData = require('../data/toolbar-big.json'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use import
here
Looks solid and works well in the storybook! 👍 I found only small nitpicks. |
src/toolbar/ToolbarKebab.jsx
Outdated
@@ -0,0 +1,78 @@ | |||
import React from 'react'; | |||
import PropTypes from 'prop-types'; | |||
import { DropdownButton, MenuItem } from 'patternfly-react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put HorizontalNavMenuItem
here
Fix according to @rvsia. Requires patternfly/patternfly-react#2984
@rvsia: used your code to fix the multi-open issue (2.), made a small PR to PF3 to fix the console error: patternfly/patternfly-react#2984 |
fbbf01d
to
8d51825
Compare
Fixed UX issue (1.) I think that the 3rd issue is PF issue and I'd prefer to work on that separately if needed (if it's relevant for ManageIQ where the custom buttons buttons should not be rightmost, I belive). |
src/toolbar/ToolbarKebab.jsx
Outdated
|
||
return ( | ||
<div className="kebab"> | ||
<DropdownButton id="menu_kebab" title={<span className="fa fa-ellipsis-v" />}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide here onClick={() => setIsOpenId(undefined)}
to reset the openId when user closes/opens the kebab
src/toolbar/ToolbarKebab.jsx
Outdated
} | ||
|
||
if (item.type === 'buttonSelect') { | ||
return <ToolbarSubmenu key={item.id} {...item} onClick={onClick} onSelect={console.log} openId={openId} setIsOpenId={setIsOpenId} />; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log here
dba82b5
to
91e26f0
Compare
91e26f0
to
570de8a
Compare
Checked commits martinpovolny/react-ui-components@cd4de67~...570de8a with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
I cannot tell why the issue got back, was pretty sure I got it right yesterday. However I have redone the rule to be more specific and added Now it looks good to me. Thx! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏆
🎉 This PR is included in version 0.11.47 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@martinpovolny One more issue I'm seeing in the screenshots - mixing buttons with and without icon in the dropdown causes surprising alignment. I think we should have 2 cases - no icons in the dropdown would render as is, (I think an empty icon div with |
Let me take a look into that in a follow-up PR. |
Depends on
patternfly/patternfly-react#2041(merged)patternfly/patternfly-react#2984(merged)TODO:
remove the(done)data-
tags