Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds regex for number text answers #67

Merged
merged 4 commits into from
Mar 12, 2023

Conversation

l7ana
Copy link
Contributor

@l7ana l7ana commented Mar 4, 2023

No description provided.

@vercel
Copy link

vercel bot commented Mar 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
hierr ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 12, 2023 at 9:51PM (UTC)

@l7ana l7ana requested a review from avenmia March 4, 2023 23:11
Comment on lines 8 to 15
if (number) {
return (
<>
<input className="border-2 border-rose-500" type="text" id="textQuestion" name="textQuestion"
pattern="^1?[0-9]{1,2}$1[0-9][0-9]" title="Please enter a number." onChange={(e) => updateCurrentAnswer(e.target.value)} />
</>
)
} return (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having a conditional to check for number and render a different input component. Try doing the conditional in the pattern property. pattern would look something like the following:

pattern={number ? "^1?[0-9]{1,2}$1[0-9][0-9]" : ""}

Copy link
Collaborator

@avenmia avenmia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants