From a7c4cc1af17de91c6cf55da8de3c4a3d63013a77 Mon Sep 17 00:00:00 2001 From: Asha Padmashetti Date: Mon, 14 Oct 2024 15:25:09 -0700 Subject: [PATCH] adding gap between form elements skill and knowledge Signed-off-by: ashapadmashetti --- .../AttributionInformation.tsx | 22 ++- .../AuthorInformation/AuthorInformation.tsx | 12 +- .../DocumentInformation.tsx | 143 +++++++++--------- .../KnowledgeInformation.tsx | 14 +- .../KnowledgeQuestionAnswerPairs.tsx | 6 +- src/components/Contribute/Knowledge/index.tsx | 6 +- .../AttributionInformation.tsx | 13 +- .../AuthorInformation/AuthorInformation.tsx | 12 +- .../SkillsInformation/SkillsInformation.tsx | 9 +- .../SkillsSeedExample/SkillsSeedExample.tsx | 11 +- src/components/PathService/PathService.tsx | 2 +- 11 files changed, 142 insertions(+), 108 deletions(-) diff --git a/src/components/Contribute/Knowledge/AttributionInformation/AttributionInformation.tsx b/src/components/Contribute/Knowledge/AttributionInformation/AttributionInformation.tsx index 0e37bf9..7a3fc30 100644 --- a/src/components/Contribute/Knowledge/AttributionInformation/AttributionInformation.tsx +++ b/src/components/Contribute/Knowledge/AttributionInformation/AttributionInformation.tsx @@ -145,7 +145,7 @@ const AttributionInformation: React.FC = ({ /> } > - + = ({ } variant={validLink}> - Link to title is required. + Required field @@ -169,11 +169,13 @@ const AttributionInformation: React.FC = ({ } variant={validLink}> - Please enter a valid URL. + Required field )} + + = ({ } variant={validTitle}> - Title is required. + Required field )} + + = ({ } variant={validRevision}> - Revision is required. + Required field )} + + = ({ } variant={validLicense}> - License is required. + Required field )} + + = ({ } variant={validCreators}> - Creators is required. + Required field diff --git a/src/components/Contribute/Knowledge/AuthorInformation/AuthorInformation.tsx b/src/components/Contribute/Knowledge/AuthorInformation/AuthorInformation.tsx index 2b98a34..a3787cf 100644 --- a/src/components/Contribute/Knowledge/AuthorInformation/AuthorInformation.tsx +++ b/src/components/Contribute/Knowledge/AuthorInformation/AuthorInformation.tsx @@ -20,16 +20,20 @@ interface Props { const AuthorInformation: React.FC = ({ reset, knowledgeFormData, setDisableAction, email, setEmail, name, setName }) => { const [validEmail, setValidEmail] = useState(); const [validName, setValidName] = useState(); + const [validEmailError, setValidEmailError] = useState('Required Field'); const validateEmail = (email: string) => { const re = /\S+@\S+\.\S+/; if (re.test(email)) { setValidEmail(ValidatedOptions.success); setDisableAction(!checkKnowledgeFormCompletion(knowledgeFormData)); + setValidEmailError(''); return; } + const errMsg = email ? 'Please enter a valid email address.' : 'Required field'; setDisableAction(true); setValidEmail(ValidatedOptions.error); + setValidEmailError(errMsg); return; }; @@ -67,7 +71,7 @@ const AuthorInformation: React.FC = ({ reset, knowledgeFormData, setDisab /> } > - + = ({ reset, knowledgeFormData, setDisab } variant={validEmail}> - Please enter a valid email address. + {validEmailError} )} + + = ({ reset, knowledgeFormData, setDisab } variant={validName}> - Name is required. + Required field diff --git a/src/components/Contribute/Knowledge/DocumentInformation/DocumentInformation.tsx b/src/components/Contribute/Knowledge/DocumentInformation/DocumentInformation.tsx index 5068647..ec0cb4c 100644 --- a/src/components/Contribute/Knowledge/DocumentInformation/DocumentInformation.tsx +++ b/src/components/Contribute/Knowledge/DocumentInformation/DocumentInformation.tsx @@ -257,75 +257,80 @@ const DocumentInformation: React.FC = ({

{modalText}

{!useFileUpload ? ( - - setKnowledgeDocumentRepositoryUrl(value)} - onBlur={() => validateRepo(knowledgeDocumentRepositoryUrl)} - /> - {validRepo === ValidatedOptions.error && ( - - - } variant={validRepo}> - Repo URL is required. - - - - )} - {validRepo === ValidatedOptions.warning && ( - - - } variant="error"> - Please enter a valid URL. - - - - )} - - setKnowledgeDocumentCommit(value)} - onBlur={() => validateCommit(knowledgeDocumentCommit)} - /> - {validCommit === ValidatedOptions.error && ( - - - } variant={validCommit}> - Valid commit SHA is required. - - - - )} - setDocumentName(value)} - onBlur={() => validateDocumentName(documentName)} - /> - {validDocumentName === ValidatedOptions.error && ( - - - } variant={validDocumentName}> - Document name is required. - - - - )} - + <> + + setKnowledgeDocumentRepositoryUrl(value)} + onBlur={() => validateRepo(knowledgeDocumentRepositoryUrl)} + /> + {validRepo === ValidatedOptions.error && ( + + + } variant={validRepo}> + Required field + + + + )} + {validRepo === ValidatedOptions.warning && ( + + + } variant="error"> + Please enter a valid URL. + + + + )} + + + setKnowledgeDocumentCommit(value)} + onBlur={() => validateCommit(knowledgeDocumentCommit)} + /> + {validCommit === ValidatedOptions.error && ( + + + } variant={validCommit}> + Valid commit SHA is required. + + + + )} + + + setDocumentName(value)} + onBlur={() => validateDocumentName(documentName)} + /> + {validDocumentName === ValidatedOptions.error && ( + + + } variant={validDocumentName}> + Required field + + + + )} + + ) : ( <> diff --git a/src/components/Contribute/Knowledge/KnowledgeInformation/KnowledgeInformation.tsx b/src/components/Contribute/Knowledge/KnowledgeInformation/KnowledgeInformation.tsx index b86e669..6a3b09f 100644 --- a/src/components/Contribute/Knowledge/KnowledgeInformation/KnowledgeInformation.tsx +++ b/src/components/Contribute/Knowledge/KnowledgeInformation/KnowledgeInformation.tsx @@ -103,7 +103,7 @@ const KnowledgeInformation: React.FC = ({ /> } > - + = ({ {validDescription === ValidatedOptions.error && ( } variant={validDescription}> - Description is required and must be less than 60 characters + Required field )} - + + = ({ {validDomain === ValidatedOptions.error && ( } variant={validDomain}> - Domain is required + Required field )} - + +