From e4d02fb27522bcabcfa1e78563bcef3c308ba7bb Mon Sep 17 00:00:00 2001
From: Aakansha Doshi <aakansha1216@gmail.com>
Date: Thu, 18 Nov 2021 15:54:26 +0530
Subject: [PATCH] feat: Add validation for website and remove validation for
 library item name (#4269)

* Github->GitHub

* allow numbers

* remove validation for lib/item name
---
 src/components/PublishLibrary.tsx | 5 ++---
 src/locales/en.json               | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/components/PublishLibrary.tsx b/src/components/PublishLibrary.tsx
index feea54df..f88e06ff 100644
--- a/src/components/PublishLibrary.tsx
+++ b/src/components/PublishLibrary.tsx
@@ -120,9 +120,6 @@ const PublishLibrary = ({
       if (!libItem.name) {
         error = t("publishDialog.errors.required");
         isError = true;
-      } else if (!/^[a-zA-Z\s]+$/i.test(libItem.name)) {
-        error = t("publishDialog.errors.letter&Spaces");
-        isError = true;
       }
       erroredLibItems.push({ ...libItem, error });
     });
@@ -381,6 +378,8 @@ const PublishLibrary = ({
               <input
                 type="text"
                 name="website"
+                pattern="https?://.+"
+                title={t("publishDialog.errors.website")}
                 value={libraryData.website}
                 onChange={onInputChange}
                 placeholder={t("publishDialog.placeholder.website")}
diff --git a/src/locales/en.json b/src/locales/en.json
index a46ed818..a06f3f4f 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -290,13 +290,13 @@
       "authorName": "Your name or username",
       "libraryName": "Name of your library",
       "libraryDesc": "Description of your library to help people understand its usage",
-      "githubHandle": "Github handle (optional), so you can edit the library once submitted for review",
+      "githubHandle": "GitHub handle (optional), so you can edit the library once submitted for review",
       "twitterHandle": "Twitter username (optional), so we know who to credit when promoting over Twitter",
       "website": "Link to your personal website or elsewhere (optional)"
     },
     "errors": {
       "required": "Required",
-      "letter&Spaces": "Only letters and spaces allowed"
+      "website": "Enter a valid Url"
     },
     "noteDescription": {
       "pre": "Submit your library to be included in the ",