Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
ousmaneo committed Nov 15, 2024
1 parent 6ba2ea2 commit b31ecc3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('Section', () => {
});

it('should execute onCollapse', async () => {
const onCollapse = jest.fn()
const onCollapse = jest.fn();

render(
<Section title="The Title" collapsible onCollapse={onCollapse}>
Expand Down
13 changes: 8 additions & 5 deletions graylog2-web-interface/src/components/common/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,22 @@ type Props = React.PropsWithChildren<{
*/
const Section = ({
title,
header,
actions,
headerLeftSection,
header = null,
actions = null,
headerLeftSection = null,
collapsible = false,
defaultClosed = false,
onCollapse = () => {},
disableCollapseButton = false,
children,
children = null,
}: Props) => {
const [opened, { toggle }] = useDisclosure(!defaultClosed);

const onToggle = () => {
toggle();
onCollapse(opened);
}
};

const onHeaderClick = () => (!disableCollapseButton && onToggle());

return (
Expand All @@ -92,6 +94,7 @@ const Section = ({
{headerLeftSection && <FlexWrapper onClick={(e) => { e.stopPropagation(); }}>{headerLeftSection}</FlexWrapper>}
</FlexWrapper>
<FlexWrapper>
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}
{actions && <div onClick={(e) => { e.stopPropagation(); }}>{actions}</div>}
{collapsible && (
<Button bsSize="sm"
Expand Down

0 comments on commit b31ecc3

Please sign in to comment.