update docs

This commit is contained in:
Matthias Nannt
2022-11-23 14:50:09 +01:00
parent d8d2ac115d
commit 3444f5b828
12 changed files with 33 additions and 63 deletions
+2 -10
View File
@@ -2,9 +2,7 @@ import { useEffectUpdateSchema } from "../../lib/schema";
import { NameRequired, UniversalInputProps } from "../../types";
import { Input, InputProps } from "../shared/Input";
interface EmailUniqueProps {
placeholder?: string;
}
interface EmailUniqueProps {}
type Props = EmailUniqueProps & InputProps & UniversalInputProps & NameRequired;
@@ -13,11 +11,5 @@ const inputType = "email";
export function Email(props: Props) {
useEffectUpdateSchema(props, inputType);
return (
<Input
type={{ html: inputType, formbricks: inputType }}
additionalProps={{ placeholder: props.placeholder }}
{...props}
/>
);
return <Input type={{ html: inputType, formbricks: inputType }} {...props} />;
}
@@ -5,7 +5,6 @@ import { Input, InputProps } from "../shared/Input";
interface PasswordUniqueProps {
minLength?: number;
maxLength?: number;
placeholder?: string;
}
type Props = PasswordUniqueProps & InputProps & UniversalInputProps & NameRequired;
@@ -28,7 +27,6 @@ export function Password(props: Props) {
message: `Your answer musn't be longer than ${props.maxLength} characters`,
},
}}
additionalProps={{ placeholder: props.placeholder }}
{...props}
/>
);
@@ -5,7 +5,6 @@ import { Input, InputProps } from "../shared/Input";
interface PhoneUniqueProps {
minLength?: number;
maxLength?: number;
placeholder?: string;
}
type Props = PhoneUniqueProps & InputProps & UniversalInputProps & NameRequired;
@@ -29,7 +28,6 @@ export function Phone(props: Props) {
message: `Your answer musn't be longer than ${props.maxLength} characters`,
},
}}
additionalProps={{ placeholder: props.placeholder }}
{...props}
/>
);
@@ -5,7 +5,6 @@ import { Input, InputProps } from "../shared/Input";
interface SearchUniqueProps {
minLength?: number;
maxLength?: number;
placeholder?: string;
}
type Props = SearchUniqueProps & InputProps & UniversalInputProps & NameRequired;
@@ -28,7 +27,6 @@ export function Search(props: Props) {
message: `Your answer musn't be longer than ${props.maxLength} characters`,
},
}}
additionalProps={{ placeholder: props.placeholder }}
{...props}
/>
);
@@ -5,7 +5,6 @@ import { Input, InputProps } from "../shared/Input";
interface TextUniqueProps {
minLength?: number;
maxLength?: number;
placeholder?: string;
}
type Props = TextUniqueProps & InputProps & UniversalInputProps & NameRequired;
@@ -28,7 +27,6 @@ export function Text(props: Props) {
message: `Your answer musn't be longer than ${props.maxLength} characters`,
},
}}
additionalProps={{ placeholder: props.placeholder }}
{...props}
/>
);
@@ -5,7 +5,6 @@ import { Input, InputProps } from "../shared/Input";
interface UrlUniqueProps {
minLength?: number;
maxLength?: number;
placeholder?: string;
}
type Props = UrlUniqueProps & InputProps & UniversalInputProps & NameRequired;
@@ -28,7 +27,6 @@ export function Url(props: Props) {
message: `Your answer musn't be longer than ${props.maxLength} characters`,
},
}}
additionalProps={{ placeholder: props.placeholder }}
{...props}
/>
);
@@ -12,11 +12,12 @@ import { Outer } from "./Outer";
import { Wrapper } from "./Wrapper";
export interface InputProps {
additionalValidation?: any;
additionalProps?: any;
placeholder?: string;
}
interface UniqueProps {
additionalValidation?: any;
additionalProps?: any;
type: {
formbricks: string;
html: string;
@@ -44,6 +45,7 @@ export function Input(props: FormbricksProps) {
type={props.type.html}
id={elemId}
aria-invalid={errors[props.name] ? "true" : "false"}
placeholder={props.placeholder}
{...props.additionalProps}
{...register(props.name, {
required: { value: "required" in validationRules, message: "This field is required" },