generated from Exabyte-io/template-definitions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update: add DescriptionFieldTemplate
- Loading branch information
Showing
5 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from "@rjsf/utils"; | ||
import React from "react"; | ||
/** The `DescriptionField` is the template to use to render the description of a field | ||
* | ||
* @param props - The `DescriptionFieldProps` for this component | ||
*/ | ||
export default function DescriptionFieldTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: DescriptionFieldProps<T, S, F>): React.JSX.Element | null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import Typography from "@mui/material/Typography"; | ||
import React from "react"; | ||
/** The `DescriptionField` is the template to use to render the description of a field | ||
* | ||
* @param props - The `DescriptionFieldProps` for this component | ||
*/ | ||
export default function DescriptionFieldTemplate(props) { | ||
const { id, description } = props; | ||
if (description) { | ||
return (React.createElement(Typography, { id: id, variant: "subtitle2", style: { marginTop: "5px" } }, description)); | ||
} | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import Typography from "@mui/material/Typography"; | ||
import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from "@rjsf/utils"; | ||
import React from "react"; | ||
|
||
/** The `DescriptionField` is the template to use to render the description of a field | ||
* | ||
* @param props - The `DescriptionFieldProps` for this component | ||
*/ | ||
export default function DescriptionFieldTemplate< | ||
T = any, | ||
S extends StrictRJSFSchema = RJSFSchema, | ||
F extends FormContextType = any, | ||
>(props: DescriptionFieldProps<T, S, F>) { | ||
const { id, description } = props; | ||
if (description) { | ||
return ( | ||
<Typography id={id} variant="subtitle2" style={{ marginTop: "5px" }}> | ||
{description} | ||
</Typography> | ||
); | ||
} | ||
|
||
return null; | ||
} |