Skip to content

Commit afa521e

Browse files
committed
fix linting errors
1 parent 467bf25 commit afa521e

File tree

3 files changed

+40
-44
lines changed

3 files changed

+40
-44
lines changed

packages/module/src/Deck/Deck.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ describe('Deck component', () => {
239239
});
240240

241241
test('should not navigate beyond last page', async () => {
242-
const user = userEvent.setup();
243242
const onPageChange = jest.fn();
244243

245244
render(<Deck pages={mockPages} onPageChange={onPageChange} initialPage={2} />);
@@ -252,7 +251,6 @@ describe('Deck component', () => {
252251
});
253252

254253
test('should not navigate before first page', async () => {
255-
const user = userEvent.setup();
256254
const onPageChange = jest.fn();
257255

258256
render(<Deck pages={mockPages} onPageChange={onPageChange} initialPage={0} />);

packages/module/src/Deck/Deck.tsx

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const Deck: FunctionComponent<DeckProps> = ({
5959
getPageLabel = (current, total) => `Page ${current} of ${total}`,
6060
...props
6161
}: DeckProps) => {
62-
const [currentPageIndex, setCurrentPageIndex] = useState(initialPage);
62+
const [ currentPageIndex, setCurrentPageIndex ] = useState(initialPage);
6363

6464
const handlePageChange = (newIndex: number) => {
6565
if (newIndex >= 0 && newIndex < pages.length) {
@@ -143,35 +143,35 @@ export const Deck: FunctionComponent<DeckProps> = ({
143143
{currentPage?.buttons && currentPage.buttons.length > 0 && (
144144
<FlexItem>
145145
<ActionList data-ouia-component-id={`${ouiaId}-buttons`}>
146-
<ActionListGroup>
147-
{currentPage.buttons.map((buttonConfig, index) => {
148-
const { navigation, onClick, ...buttonProps } = buttonConfig;
149-
150-
// Auto-wire navigation if specified
151-
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
152-
// Call user's custom onClick first if provided
153-
onClick?.(event);
154-
155-
// Then handle navigation
156-
if (navigation === 'next') {
157-
handlePageChange(currentPageIndex + 1);
158-
} else if (navigation === 'previous') {
159-
handlePageChange(currentPageIndex - 1);
160-
} else if (navigation === 'close') {
161-
onClose?.();
162-
}
163-
};
146+
<ActionListGroup>
147+
{currentPage.buttons.map((buttonConfig, index) => {
148+
const { navigation, onClick, ...buttonProps } = buttonConfig;
149+
150+
// Auto-wire navigation if specified
151+
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
152+
// Call user's custom onClick first if provided
153+
onClick?.(event);
154+
155+
// Then handle navigation
156+
if (navigation === 'next') {
157+
handlePageChange(currentPageIndex + 1);
158+
} else if (navigation === 'previous') {
159+
handlePageChange(currentPageIndex - 1);
160+
} else if (navigation === 'close') {
161+
onClose?.();
162+
}
163+
};
164164

165-
return (
166-
<ActionListItem key={index}>
167-
<Button
168-
{...buttonProps}
169-
onClick={navigation || onClick ? handleClick : undefined}
170-
/>
171-
</ActionListItem>
172-
);
173-
})}
174-
</ActionListGroup>
165+
return (
166+
<ActionListItem key={index}>
167+
<Button
168+
{...buttonProps}
169+
onClick={navigation || onClick ? handleClick : undefined}
170+
/>
171+
</ActionListItem>
172+
);
173+
})}
174+
</ActionListGroup>
175175
</ActionList>
176176
</FlexItem>
177177
)}

packages/module/src/ModalDeck/ModalDeck.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,17 @@ export const ModalDeck: FunctionComponent<ModalDeckProps> = ({
1414
isOpen,
1515
children,
1616
modalProps
17-
}: ModalDeckProps) => {
18-
return (
19-
<Modal
20-
isOpen={isOpen}
21-
variant="small"
22-
{...modalProps}
23-
>
24-
<ModalBody>
25-
{children}
26-
</ModalBody>
27-
</Modal>
28-
);
29-
};
17+
}: ModalDeckProps) => (
18+
<Modal
19+
isOpen={isOpen}
20+
variant="small"
21+
{...modalProps}
22+
>
23+
<ModalBody>
24+
{children}
25+
</ModalBody>
26+
</Modal>
27+
);
3028

3129
export default ModalDeck;
3230

0 commit comments

Comments
 (0)