Skip to content

Commit

Permalink
👌 [#454] PR feedback round 1
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed Oct 31, 2023
1 parent 519e65c commit bc9d4bc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
7 changes: 4 additions & 3 deletions src/components/EditGrid/EditGrid.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Button} from '@utrecht/component-library-react';

import Body from 'components/Body';
import Button from 'components/Button';

import {EditGrid, EditGridButtonGroup, EditGridItem} from '.';

Expand All @@ -17,7 +18,7 @@ export default {
heading="Item 1"
buttons={
<EditGridButtonGroup>
<Button variant="primary">A button</Button>
<Button appearance="primary-action-button">A button</Button>
</EditGridButtonGroup>
}
>
Expand All @@ -27,7 +28,7 @@ export default {
heading="Item 2"
buttons={
<EditGridButtonGroup>
<Button variant="primary">A button</Button>
<Button appearance="primary-action-button">A button</Button>
</EditGridButtonGroup>
}
>
Expand Down
13 changes: 4 additions & 9 deletions src/components/EditGrid/EditGridButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ import {ButtonGroup} from '@utrecht/component-library-react';
import PropTypes from 'prop-types';
import React from 'react';

const EditGridButtonGroup = ({children}) => {
const role = children && React.Children.count(children) > 1 ? 'group' : undefined;
return (
<ButtonGroup role={role} className="utrecht-button-group--openforms-editgrid">
{children}
</ButtonGroup>
);
};
const EditGridButtonGroup = ({children}) => (
<ButtonGroup className="utrecht-button-group--openforms-editgrid">{children}</ButtonGroup>
);

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

export default EditGridButtonGroup;
9 changes: 6 additions & 3 deletions src/components/EditGrid/EditGridItem.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Button} from '@utrecht/component-library-react';

import Body from 'components/Body';
import Button from 'components/Button';

import {EditGridButtonGroup, EditGridItem as EditGridItemComponent} from '.';

Expand All @@ -15,8 +16,10 @@ export default {
children: <Body>Item body, typically form fields</Body>,
buttons: (
<EditGridButtonGroup>
<Button variant="primary">Save</Button>
<Button variant="danger">Remove</Button>
<Button appearance="primary-action-button">Save</Button>
<Button appearance="primary-action-button" hint="danger">
Remove
</Button>
</EditGridButtonGroup>
),
},
Expand Down

0 comments on commit bc9d4bc

Please sign in to comment.