Debian Codegraph @

install/freeipa-webui/src/components/layouts/TitleLayout/TitleLayout.tsx

raw
1 import React from "react";
2 // PatternFly
3 import { Content, Title } from "@patternfly/react-core";
4
5 interface PropsToTitleLayout {
6 headingLevel: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
7 id: string;
8 text: string;
9 className?: string;
10 ouiaId?: number | string;
11 ouiaSafe?: boolean;
12 size?: "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl";
13 preText?: string;
14 }
15
16 const TitleLayout = (props: PropsToTitleLayout) => {
17 const titleText = props.preText ? (
18 <div className="pf-v6-u-display-flex">
19 <div className="pf-v6-u-color-400">{props.preText}</div>
20 <div className="pf-v6-u-ml-sm">{props.text}</div>
21 </div>
22 ) : (
23 <>{props.text}</>
24 );
25 return (
26 <Content key={props.id}>
27 <Title
28 headingLevel={props.headingLevel}
29 id={props.id}
30 className={props.className}
31 ouiaId={props.ouiaId}
32 ouiaSafe={props.ouiaSafe}
33 size={props.size}
34 >
35 {titleText}
36 </Title>
37 </Content>
38 );
39 };
40
41 export default TitleLayout;