add url regex to community link
Signed-off-by: Lykke Axlin <lykkeaxlin@hotmail.com> Co-authored-by: klaraab <klarabroman@live.se>
This commit is contained in:
@@ -25,7 +25,7 @@ type Props = {
|
||||
control: Control<FormValues, object>;
|
||||
helperText?: string;
|
||||
placeholder?: string;
|
||||
required: boolean;
|
||||
rules?: Object;
|
||||
};
|
||||
|
||||
export const InputField = ({
|
||||
@@ -34,7 +34,7 @@ export const InputField = ({
|
||||
control,
|
||||
helperText,
|
||||
placeholder,
|
||||
required,
|
||||
rules,
|
||||
}: Props) => {
|
||||
const label =
|
||||
inputType.charAt(0).toLocaleUpperCase('en-US') + inputType.slice(1);
|
||||
@@ -43,9 +43,7 @@ export const InputField = ({
|
||||
<Controller
|
||||
name={inputType}
|
||||
control={control}
|
||||
rules={{
|
||||
required: required,
|
||||
}}
|
||||
rules={rules}
|
||||
render={({ field }) => (
|
||||
<TextField
|
||||
{...field}
|
||||
|
||||
@@ -144,16 +144,23 @@ export const ProjectDialog = ({
|
||||
<InputField
|
||||
error={errors.announcement}
|
||||
control={control}
|
||||
required
|
||||
rules={{
|
||||
required: true,
|
||||
}}
|
||||
inputType="announcement"
|
||||
helperText="please enter an announcement"
|
||||
placeholder="Describe who you are and what skills you are looking for"
|
||||
/>
|
||||
|
||||
<InputField
|
||||
error={errors.community}
|
||||
control={control}
|
||||
required={false}
|
||||
rules={{
|
||||
required: false,
|
||||
pattern: RegExp('^(https?)://[^s$.?#].[^s]*$'),
|
||||
}}
|
||||
inputType="community"
|
||||
helperText="please enter a link starting with http/https"
|
||||
placeholder="Community link to e.g. Teams or Discord"
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user