Skip to content

Commit

Permalink
feat: add formik and yup validation
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielCarames committed Oct 28, 2022
1 parent 5494746 commit 939aca0
Show file tree
Hide file tree
Showing 10 changed files with 308 additions and 86 deletions.
167 changes: 166 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
"@apollo/client": "^3.6.9",
"@reduxjs/toolkit": "^1.8.5",
"emoji-picker-react": "^3.6.1",
"formik": "^2.2.9",
"graphql": "^16.6.0",
"graphql-ws": "^5.11.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-infinite-scroll-component": "^6.1.0",
"react-loader-spinner": "^5.3.4",
"react-redux": "^8.0.2",
"react-router-dom": "^6.3.0"
"react-router-dom": "^6.3.0",
"yup": "^0.32.11"
},
"devDependencies": {
"@types/node": "^18.8.3",
Expand Down
8 changes: 4 additions & 4 deletions src/components/FormGroupInput/FormGroupInput.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { ErrorMessage, Field } from "formik"
import { FormGroupProps } from "../../ts/interfaces"

export default function FormGroupInput({
type,
label,
placeholder,
minLength,
maxLength,
required
maxLength
}: FormGroupProps) {
return (
<div className="form-group">
<label className="form__label" htmlFor={type}>
{label}
</label>
<input
<Field
className="form__input"
type={type}
name={type}
id={type}
placeholder={placeholder}
required={required}
minLength={minLength}
maxLength={maxLength}
/>
<ErrorMessage name={type} />
</div>
)
}
2 changes: 2 additions & 0 deletions src/components/FormGroupInput/_formGroupInput.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
gap: 5px;
width: 100%;
max-width: 300px;
color: $pinkColor;
.form__label {
@include fluid-type(font-size, 600px, 1200px, 12px, 14px);
color: $whiteColor;
}
.form__input {
height: 4vmin;
Expand Down
Loading

0 comments on commit 939aca0

Please sign in to comment.