mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 23:27:14 +00:00
improvement: add example paste value formats
This commit is contained in:
@@ -83,6 +83,7 @@ export type FormControlProps = {
|
|||||||
className?: string;
|
className?: string;
|
||||||
icon?: ReactNode;
|
icon?: ReactNode;
|
||||||
tooltipText?: ReactElement | string;
|
tooltipText?: ReactElement | string;
|
||||||
|
tooltipClassName?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const FormControl = ({
|
export const FormControl = ({
|
||||||
@@ -96,7 +97,8 @@ export const FormControl = ({
|
|||||||
isError,
|
isError,
|
||||||
icon,
|
icon,
|
||||||
className,
|
className,
|
||||||
tooltipText
|
tooltipText,
|
||||||
|
tooltipClassName
|
||||||
}: FormControlProps): JSX.Element => {
|
}: FormControlProps): JSX.Element => {
|
||||||
return (
|
return (
|
||||||
<div className={twMerge("mb-4", className)}>
|
<div className={twMerge("mb-4", className)}>
|
||||||
@@ -108,6 +110,7 @@ export const FormControl = ({
|
|||||||
id={id}
|
id={id}
|
||||||
icon={icon}
|
icon={icon}
|
||||||
tooltipText={tooltipText}
|
tooltipText={tooltipText}
|
||||||
|
tooltipClassName={tooltipClassName}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
label
|
label
|
||||||
|
|||||||
+33
-1
@@ -1,6 +1,6 @@
|
|||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { subject } from "@casl/ability";
|
import { subject } from "@casl/ability";
|
||||||
import { faPaste } from "@fortawesome/free-solid-svg-icons";
|
import { faInfoCircle, faPaste } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
@@ -67,6 +67,38 @@ const PasteEnvForm = ({ onParsedEnv }: Pick<Props, "onParsedEnv">) => {
|
|||||||
label="Secret Values"
|
label="Secret Values"
|
||||||
isError={Boolean(errors.value)}
|
isError={Boolean(errors.value)}
|
||||||
errorText={errors.value?.message}
|
errorText={errors.value?.message}
|
||||||
|
icon={<FontAwesomeIcon size="sm" className="text-mineshaft-400" icon={faInfoCircle} />}
|
||||||
|
tooltipClassName="max-w-lg px-2 whitespace-pre-line"
|
||||||
|
tooltipText={
|
||||||
|
<div className="flex flex-col gap-2">
|
||||||
|
<p>Example Formats:</p>
|
||||||
|
<pre className="rounded-md bg-mineshaft-900 p-3 text-xs">
|
||||||
|
{/* eslint-disable-next-line react/jsx-no-comment-textnodes */}
|
||||||
|
<p className="text-mineshaft-400">// .json</p>
|
||||||
|
{JSON.stringify(
|
||||||
|
{
|
||||||
|
APP_NAME: "example-service",
|
||||||
|
APP_VERSION: "1.2.3",
|
||||||
|
NODE_ENV: "production"
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)}
|
||||||
|
</pre>
|
||||||
|
<pre className="rounded-md bg-mineshaft-900 p-3 text-xs">
|
||||||
|
<p className="text-mineshaft-400"># .env</p>
|
||||||
|
<p>APP_NAME="example-service"</p>
|
||||||
|
<p>APP_VERSION="1.2.3"</p>
|
||||||
|
<p>NODE_ENV="production"</p>
|
||||||
|
</pre>
|
||||||
|
<pre className="rounded-md bg-mineshaft-900 p-3 text-xs">
|
||||||
|
<p className="text-mineshaft-400"># .yml</p>
|
||||||
|
<p>APP_NAME: example-service</p>
|
||||||
|
<p>APP_VERSION: 1.2.3</p>
|
||||||
|
<p>NODE_ENV: production</p>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<TextArea
|
<TextArea
|
||||||
{...register("value")}
|
{...register("value")}
|
||||||
|
|||||||
Reference in New Issue
Block a user