-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI Framework] Reactify actionItem (#12142)
* issue 12137 Reactify ui_framework/components/action_item * use KuiMenu and KuiMenuItem in the doc_site view
- Loading branch information
1 parent
e2a5b27
commit a271d7c
Showing
11 changed files
with
146 additions
and
75 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
ui_framework/components/action_item/__snapshots__/action_item.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders KuiActionItem 1`] = ` | ||
<div | ||
aria-label="aria-label" | ||
class="kuiActionItem testClass1 testClass2" | ||
data-test-subj="test subject string" | ||
> | ||
children | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React, { | ||
PropTypes, | ||
} from 'react'; | ||
import classNames from 'classnames'; | ||
|
||
export const KuiActionItem = ({ children, className, ...rest }) => { | ||
const classes = classNames('kuiActionItem', className); | ||
return <div className={classes} {...rest} >{children}</div>; | ||
}; | ||
KuiActionItem.propTypes = { | ||
children: PropTypes.node, | ||
className: PropTypes.string, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import { render } from 'enzyme'; | ||
import { requiredProps } from '../../test/required_props'; | ||
|
||
import { | ||
KuiActionItem, | ||
} from './action_item'; | ||
|
||
test('renders KuiActionItem', () => { | ||
const component = <KuiActionItem { ...requiredProps }>children</KuiActionItem>; | ||
expect(render(component)).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { KuiActionItem } from './action_item'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export { KuiActionItem } from './action_item'; | ||
|
||
export { | ||
KuiKeyboardAccessible, | ||
} from './accessibility'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
ui_framework/doc_site/src/views/action_item/action_item.html
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
ui_framework/doc_site/src/views/action_item/action_item.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
KuiActionItem | ||
} from '../../../../components'; | ||
|
||
export default () => ( | ||
<KuiActionItem> | ||
<p className="kuiText">Item</p> | ||
<div className="kuiMenuButtonGroup"> | ||
<button className="kuiMenuButton kuiMenuButton--basic"> | ||
Acknowledge | ||
</button> | ||
<button className="kuiMenuButton kuiMenuButton--basic"> | ||
Silence | ||
</button> | ||
<button className="kuiMenuButton kuiMenuButton--danger"> | ||
Delete | ||
</button> | ||
</div> | ||
</KuiActionItem> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 0 additions & 52 deletions
52
ui_framework/doc_site/src/views/action_item/action_items_in_menu.html
This file was deleted.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
ui_framework/doc_site/src/views/action_item/action_items_in_menu.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
KuiActionItem, | ||
KuiMenu, | ||
KuiMenuItem | ||
} from '../../../../components'; | ||
|
||
export default () => ( | ||
<KuiMenu contained> | ||
<KuiMenuItem> | ||
<KuiActionItem> | ||
<p className="kuiText">Item A</p> | ||
<div className="kuiMenuButtonGroup"> | ||
<button className="kuiMenuButton kuiMenuButton--basic"> | ||
Acknowledge | ||
</button> | ||
<button className="kuiMenuButton kuiMenuButton--basic"> | ||
Silence | ||
</button> | ||
<button className="kuiMenuButton kuiMenuButton--danger"> | ||
Delete | ||
</button> | ||
</div> | ||
</KuiActionItem> | ||
</KuiMenuItem> | ||
|
||
<KuiMenuItem> | ||
<KuiActionItem> | ||
<p className="kuiText">Item B</p> | ||
<div className="kuiMenuButtonGroup"> | ||
<button className="kuiMenuButton kuiMenuButton--basic"> | ||
Acknowledge | ||
</button> | ||
<button className="kuiMenuButton kuiMenuButton--basic"> | ||
Silence | ||
</button> | ||
<button className="kuiMenuButton kuiMenuButton--danger"> | ||
Delete | ||
</button> | ||
</div> | ||
</KuiActionItem> | ||
</KuiMenuItem> | ||
|
||
<KuiMenuItem> | ||
<KuiActionItem> | ||
<p className="kuiText">Item C</p> | ||
<div className="kuiMenuButtonGroup"> | ||
<button className="kuiMenuButton kuiMenuButton--basic"> | ||
Acknowledge | ||
</button> | ||
<button className="kuiMenuButton kuiMenuButton--basic"> | ||
Silence | ||
</button> | ||
<button className="kuiMenuButton kuiMenuButton--danger"> | ||
Delete | ||
</button> | ||
</div> | ||
</KuiActionItem> | ||
</KuiMenuItem> | ||
</KuiMenu> | ||
); |