Skip to content

Commit

Permalink
STSMACOM-544 Config Manager keyboard shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiShumski2 committed Oct 12, 2021
1 parent 0135af8 commit d104eb4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [7.0.1] (IN PROGRESS)

* Add disabled prop for `<LocationLookup>` component.
* Config Manager | Apply baseline keyboard shortcuts. Refs STSMACOM-544.

## [7.0.0](https://github.com/folio-org/stripes-smart-components/tree/v7.0.0) (2021-09-27)
[Full Changelog](https://github.com/folio-org/stripes-smart-components/compare/v6.1.0...v7.0.0)
Expand Down
43 changes: 32 additions & 11 deletions lib/ConfigManager/ConfigForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import {
Button,
checkScope,
HasCommand,
Pane,
PaneFooter,
} from '@folio/stripes-components';
Expand All @@ -18,6 +20,19 @@ const ConfigForm = (props) => {
children,
} = props;

const shortcuts = [
{
name: 'save',
handler: e => {
e.preventDefault();

if (!(pristine || submitting)) {
handleSubmit();
}
},
},
];

const footer = (
<PaneFooter
renderEnd={(
Expand All @@ -35,19 +50,25 @@ const ConfigForm = (props) => {
);

return (
<form
id="config-form"
onSubmit={handleSubmit}
className={styles.configForm}
<HasCommand
commands={shortcuts}
isWithinScope={checkScope}
scope={document.body}
>
<Pane
defaultWidth="fill"
paneTitle={label}
footer={footer}
<form
id="config-form"
onSubmit={handleSubmit}
className={styles.configForm}
>
{children}
</Pane>
</form>
<Pane
defaultWidth="fill"
paneTitle={label}
footer={footer}
>
{children}
</Pane>
</form>
</HasCommand>
);
};

Expand Down

0 comments on commit d104eb4

Please sign in to comment.