Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/pf3-component-mapper/demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class App extends React.Component {
formFieldsMapper={formFieldsMapper}
layoutMapper={layoutMapper}
schema={sandbox}
onCancel={() => console.log('cancel')}
/>
</Row>
</Grid>
Expand Down
18 changes: 10 additions & 8 deletions packages/pf3-component-mapper/src/form-fields/layout-components.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import { layoutComponents } from '@data-driven-forms/react-form-renderer';
import { FormGroup, ButtonGroup, Icon, HelpBlock, Form } from 'patternfly-react';
import Button from './button';
import { Button, FormGroup, Icon, HelpBlock, Form } from 'patternfly-react';
import './layout-components.scss';

const ArrayFieldWrapper = ({ children }) => (
<div style={{
Expand All @@ -27,18 +27,20 @@ FormButton.propTypes = {
children: PropTypes.oneOfType([ PropTypes.node, PropTypes.arrayOf(PropTypes.node) ]),
};

const ButtonGroupWrapper = ({ children, ...props }) => (
<ButtonGroup
className="pull-right"
style={{ display: 'inline-block' }}
{ ...props }
const ButtonGroupWrapper = ({ children, className, ...props }) => (
<div className={ `ddorg__pf3-layout-components__button-group ${className}` } { ...props }
>
{ children }
</ButtonGroup>
</div>
);

ButtonGroupWrapper.propTypes = {
children: PropTypes.oneOfType([ PropTypes.node, PropTypes.arrayOf(PropTypes.node) ]).isRequired,
className: PropTypes.string,
};

ButtonGroupWrapper.defaultProps = {
className: '',
};

const TitleWrapper = ({ children }) => <h3>{ children }</h3>;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.ddorg__pf3-layout-components__button-group {
display: flex;
margin-bottom: 8px;
button {
margin-left: 4px;
&:first-child {
margin-left: auto
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mount } from 'enzyme';
import { FormGroup, Button, ButtonGroup, Icon, HelpBlock, Form } from 'patternfly-react';
import { FormGroup, Button, Icon, HelpBlock, Form } from 'patternfly-react';
import { layoutComponents } from '@data-driven-forms/react-form-renderer';
import layoutMapper from '../form-fields/layout-components';

Expand All @@ -20,10 +20,6 @@ describe('Layout mapper', () => {
expect(layoutMapper[layoutComponents.FORM_GROUP]).toEqual(FormGroup);
});

it('should return PF3 ButtonGroup', () => {
expect(mount(layoutMapper[layoutComponents.BUTTON_GROUP]({})).find(ButtonGroup)).toHaveLength(1);
});

it('should return PF3 Icon', () => {
expect(mount(layoutMapper[layoutComponents.ICON]({ name: 'Foo' })).find(Icon)).toHaveLength(1);
});
Expand Down
Loading