Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 0 additions & 135 deletions src/components/AllProductArea/AllProductArea.js

This file was deleted.

151 changes: 0 additions & 151 deletions src/components/AllProductArea/AllProductArea.module.scss

This file was deleted.

49 changes: 49 additions & 0 deletions src/components/AuthFormInput/AuthFormInput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from "react";
import { getAuthValidClassName } from "../../utils/authUtils";
import PasswordInput from "../PasswordInput/PasswordInput";
import Input from "../Input/Input";

const AuthFormInput = ({
label,
type,
name,
value,
onChange,
placeholder,
validInfo,
}) => {
const handleChangeValue = (e) => {
onChange(e.target.value);
};

const hasError = !validInfo.isValid;

return (
<div className="auth-form__item">
<label htmlFor={name} className="auth-form__label">
{label}
</label>
{type === "password" ? (
<PasswordInput
name={name}
value={value}
onChange={handleChangeValue}
placeholder={placeholder}
className={getAuthValidClassName(validInfo.isValid)}
/>
) : (
<Input
type={type}
name={name}
value={value}
onChange={handleChangeValue}
placeholder={placeholder}
className={getAuthValidClassName(validInfo.isValid)}
/>
)}
{hasError && <p className="auth-form__error-msg">{validInfo.msg}</p>}
</div>
);
};

export default AuthFormInput;
17 changes: 17 additions & 0 deletions src/components/Input/Input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import styles from "./Input.module.scss";

const Input = ({ type, name, value, onChange, placeholder, className }) => {
return (
<input
type={type}
name={name}
id={name}
placeholder={placeholder}
className={`${styles.input} ${className}`}
value={value}
onChange={onChange}
/>
);
};

export default Input;
5 changes: 5 additions & 0 deletions src/components/Input/Input.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@use "../../styles/mixin" as mixin;

.input {
@include mixin.defaultInput;
}
Loading
Loading