CAS-187 - add helper text to Community Links#132
Merged
Conversation
Contributor
germanurrus
commented
Jul 12, 2022

germanurrus
commented
Jul 12, 2022
| wrapperMarginMobile = 'mb-4', | ||
| }) => { | ||
| const { register, formState } = useFormContext(); | ||
|
|
Contributor
Author
There was a problem hiding this comment.
using context to plug react-hook
7b4f1e7 to
5901998
Compare
fa9e99b to
5901998
Compare
germanurrus
commented
Jul 12, 2022
Comment on lines
+19
to
+41
| const regex = new RegExp('(https://)(www\\.)twitter\\.com/(\\w+)', 'i'); | ||
| return url === '' || !!regex.test(url); | ||
| }; | ||
| const instagramValidator = (url) => { | ||
| return ( | ||
| url === '' || | ||
| /(?:(?:http|https):\/\/)?(?:www.)?(?:instagram.com|instagr.am|instagr.com)\/(\w+)/gim.test( | ||
| /(https:\/\/)(www\.)(?:instagram.com|instagr.am|instagr.com)\/(\w+)/gim.test( | ||
| url | ||
| ) | ||
| ); | ||
| }; | ||
| const discordValidator = (url) => { | ||
| return ( | ||
| url === '' || | ||
| /(https?:\/\/)?(www\.)?(discord\.(gg|io|me|li|com)|discordapp\.com\/invite)\/.+[a-zA-Z0-9]/gim.test( | ||
| /(https:\/\/)(www\.)(discord\.(gg|io|me|li|com)|discordapp\.com\/invite)\/.+[a-zA-Z0-9]/gim.test( | ||
| url | ||
| ) | ||
| ); | ||
| }; | ||
| const githubValidator = (url) => { | ||
| return url === '' || /https?:\/\/github\.com\/(?:[^/\s]+)/gim.test(url); | ||
| return ( | ||
| url === '' || /(https:\/\/)(www\.)(github\.com)\/(?:[^/\s]+)/gim.test(url) | ||
| ); |
Contributor
Author
There was a problem hiding this comment.
changes done to enforce patter https://www. to be consistent with place holders
Contributor
There was a problem hiding this comment.
The www. should still be optional in the regex
Contributor
Author
|
@dbslone updates done |
dbslone
approved these changes
Jul 14, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.