mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-27 21:55:15 -05:00
Add required to textarea label when relevantx
This commit is contained in:
@@ -299,7 +299,10 @@ export function numberFieldOptional(
|
||||
|
||||
export function textAreaOptional(
|
||||
args: WithTypedTranslationKeys<
|
||||
Omit<Extract<FormField, { type: "text-area" }>, "type" | "initialValue">
|
||||
Omit<
|
||||
Extract<FormField, { type: "text-area" }>,
|
||||
"type" | "initialValue" | "required"
|
||||
>
|
||||
>,
|
||||
) {
|
||||
return safeNullableStringSchema({ max: args.maxLength }).register(
|
||||
@@ -308,6 +311,7 @@ export function textAreaOptional(
|
||||
...args,
|
||||
label: prefixKey(args.label),
|
||||
bottomText: prefixKey(args.bottomText),
|
||||
required: false,
|
||||
type: "text-area",
|
||||
initialValue: "",
|
||||
},
|
||||
@@ -316,13 +320,17 @@ export function textAreaOptional(
|
||||
|
||||
export function textAreaRequired(
|
||||
args: WithTypedTranslationKeys<
|
||||
Omit<Extract<FormField, { type: "text-area" }>, "type" | "initialValue">
|
||||
Omit<
|
||||
Extract<FormField, { type: "text-area" }>,
|
||||
"type" | "initialValue" | "required"
|
||||
>
|
||||
>,
|
||||
) {
|
||||
return safeStringSchema({ max: args.maxLength }).register(formRegistry, {
|
||||
...args,
|
||||
label: prefixKey(args.label),
|
||||
bottomText: prefixKey(args.bottomText),
|
||||
required: true,
|
||||
type: "text-area",
|
||||
initialValue: "",
|
||||
});
|
||||
|
||||
@@ -16,6 +16,7 @@ export function TextareaFormField({
|
||||
maxLength,
|
||||
error,
|
||||
onBlur,
|
||||
required,
|
||||
disabled,
|
||||
value,
|
||||
onChange,
|
||||
@@ -27,6 +28,7 @@ export function TextareaFormField({
|
||||
id={id}
|
||||
name={name}
|
||||
label={label}
|
||||
required={required}
|
||||
error={error}
|
||||
bottomText={bottomText}
|
||||
valueLimits={
|
||||
@@ -43,6 +45,7 @@ export function TextareaFormField({
|
||||
id,
|
||||
bottomText,
|
||||
error,
|
||||
required,
|
||||
})}
|
||||
/>
|
||||
</FormFieldWrapper>
|
||||
|
||||
@@ -43,6 +43,7 @@ interface FormFieldText<T extends string> extends FormFieldBase<T> {
|
||||
|
||||
interface FormFieldTextarea<T extends string> extends FormFieldBase<T> {
|
||||
maxLength: number;
|
||||
required: boolean;
|
||||
}
|
||||
|
||||
interface FormFieldInGameName<T extends string> extends FormFieldBase<T> {
|
||||
|
||||
Reference in New Issue
Block a user