2021-03-17 13:40:19 +00:00
|
|
|
import {
|
|
|
|
Card,
|
|
|
|
CardBody,
|
|
|
|
CardHeader,
|
|
|
|
CardTitle,
|
|
|
|
Title,
|
|
|
|
} from "@patternfly/react-core";
|
2023-07-25 11:32:01 +00:00
|
|
|
import { PropsWithChildren, useId } from "react";
|
2020-08-28 05:23:39 +00:00
|
|
|
|
2020-12-11 17:34:18 +00:00
|
|
|
import "./form-panel.css";
|
2020-08-28 05:23:39 +00:00
|
|
|
|
2021-03-17 13:40:19 +00:00
|
|
|
type FormPanelProps = {
|
2020-08-28 05:23:39 +00:00
|
|
|
title: string;
|
2021-04-19 11:41:07 +00:00
|
|
|
scrollId?: string;
|
2021-05-03 20:00:12 +00:00
|
|
|
className?: string;
|
2021-03-17 13:40:19 +00:00
|
|
|
};
|
2020-08-28 05:23:39 +00:00
|
|
|
|
2023-01-20 14:28:32 +00:00
|
|
|
export const FormPanel = ({
|
2021-05-03 20:00:12 +00:00
|
|
|
title,
|
|
|
|
children,
|
|
|
|
scrollId,
|
|
|
|
className,
|
2023-01-20 14:28:32 +00:00
|
|
|
}: PropsWithChildren<FormPanelProps>) => {
|
2023-07-25 11:32:01 +00:00
|
|
|
const id = useId();
|
|
|
|
|
2020-08-28 05:23:39 +00:00
|
|
|
return (
|
2023-07-25 11:32:01 +00:00
|
|
|
<Card id={id} className={className} isFlat>
|
2021-05-03 20:00:12 +00:00
|
|
|
<CardHeader className="kc-form-panel__header">
|
2021-03-17 13:40:19 +00:00
|
|
|
<CardTitle tabIndex={0}>
|
|
|
|
<Title
|
2021-07-12 14:09:14 +00:00
|
|
|
headingLevel="h1"
|
2021-03-17 13:40:19 +00:00
|
|
|
size="xl"
|
|
|
|
className="kc-form-panel__title"
|
|
|
|
id={scrollId}
|
|
|
|
tabIndex={0} // so that jumpLink sends focus to the section for a11y
|
|
|
|
>
|
|
|
|
{title}
|
|
|
|
</Title>
|
|
|
|
</CardTitle>
|
|
|
|
</CardHeader>
|
2021-05-03 20:00:12 +00:00
|
|
|
<CardBody className="kc-form-panel__body">{children}</CardBody>
|
2021-03-17 13:40:19 +00:00
|
|
|
</Card>
|
2020-08-28 05:23:39 +00:00
|
|
|
);
|
|
|
|
};
|