Skip to content

Commit 2c9d279

Browse files
committed
fix(passage): code review improvements PD-4040
1 parent 7bc2dda commit 2c9d279

5 files changed

Lines changed: 13 additions & 20 deletions

File tree

packages/passage/configure/src/__tests__/main.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { shallow } from 'enzyme';
3-
import { Main } from '../design'; // Adjust path if needed
3+
import { Main } from '../design';
44

55
jest.mock('@pie-lib/pie-toolbox/config-ui', () => ({
66
layout: {

packages/passage/configure/src/__tests__/passage.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { shallow } from 'enzyme';
3-
import { PassageComponent } from '../passage'; // adjust the import path as needed
3+
import { PassageComponent } from '../passage';
44
import { InputContainer } from '@pie-lib/pie-toolbox/config-ui';
55
import defaults from '../defaults';
66

packages/passage/configure/src/common.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import DialogContent from '@material-ui/core/DialogContent';
1010
import DialogContentText from '@material-ui/core/DialogContentText';
1111
import DialogActions from '@material-ui/core/DialogActions';
1212

13-
function RemoveAddButton({ classes, label, type = 'add', onClick }) {
13+
export const RemoveAddButton = ({ classes, label, type = 'add', onClick }) => {
1414
const Tag = type === 'add' ? AddCircleIcon : RemoveCircleIcon;
1515
return (
1616
<Button color="primary" size="small" className={classes.root} onClick={onClick}>
@@ -61,11 +61,11 @@ export const ConfimationDialog = ({ content, cancel, title, ok, open, onOk, onCa
6161
);
6262

6363
ConfimationDialog.propTypes = {
64-
content: PropTypes.string,
65-
title: PropTypes.string,
66-
cancel: PropTypes.string,
67-
ok: PropTypes.string,
68-
open: PropTypes.bool,
69-
onCancel: PropTypes.func,
70-
onOk: PropTypes.func,
64+
content: PropTypes.string.isRequired,
65+
title: PropTypes.string.isRequired,
66+
cancel: PropTypes.string.isRequired,
67+
ok: PropTypes.string.isRequired,
68+
open: PropTypes.bool.isRequired,
69+
onCancel: PropTypes.func.isRequired,
70+
onOk: PropTypes.func.isRequired,
7171
};

packages/passage/configure/src/design.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ export class Main extends React.Component {
132132
/>
133133
}
134134
>
135-
{passages.map((passage, passageIndex) => {
136-
return (
135+
{passages.map((passage, passageIndex) =>
137136
<React.Fragment key={passageIndex}>
138137
{passageIndex > 0 && (
139138
<Typography variant="h5" className={classes.additionalPassageHeading}>
@@ -159,8 +158,7 @@ export class Main extends React.Component {
159158
<PassageButton label={`Add ${additionalPassage.label}`} onClick={this.addAdditionalPassage} />
160159
)}
161160
</React.Fragment>
162-
);
163-
})}
161+
)}
164162
<ConfimationDialog
165163
open={showConfirmationDialog}
166164
title={'Warning'}

packages/passage/configure/src/passage.jsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,7 @@ export class PassageComponent extends React.Component {
7171
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
7272
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
7373

74-
const getPluginProps = (customConfiguration) => {
75-
return {
76-
...baseInputConfiguration,
77-
...customConfiguration,
78-
};
79-
};
74+
const getPluginProps = (customConfiguration) => ({...baseInputConfiguration,...customConfiguration});
8075

8176
return (
8277
<React.Fragment>

0 commit comments

Comments
 (0)