Skip to content

Commit

Permalink
Merge pull request #63 from YAPP-Github/feature/FE-042
Browse files Browse the repository at this point in the history
Feature/FE-042 : 회원가입 오류 수정
  • Loading branch information
jieunpark247 authored Jul 1, 2023
2 parents 349177a + ea545d8 commit 724fb64
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ globalStyle(`${inputArea} > div`, {
width: '200px',
marginRight: '12px',
});
export const input = style({
width: '100%',
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';
import { Button, Input, InputSection } from '@/components';
import { FieldValues, SubmitHandler } from 'react-hook-form';
import { requiredFields, button, buttonWrapper, inputArea } from './EmailRequestSignUp.css';
import { requiredFields, button, buttonWrapper, inputArea, input } from './EmailRequestSignUp.css';
import { useSignupContext } from '../../contexts/SignupContext';
import { postRequestEmail } from '../../api';
import { usePostApi, useCommonForm, useConsent } from '../../hooks';
Expand Down Expand Up @@ -49,8 +49,14 @@ const EmailRequestSignUp = ({ onNext }: EmailRequestSignUpProps) => {
<InputField method={method} onSubmit={onSubmit}>
<InputSection variant="label3" color="sub" label="회사이메일" direction="column" required={true}>
<div className={inputArea}>
<div>
<Input {...method.register('email')} name="email" placeholder="회사 이메일" showError={true} />
<div style={{ width: '200px' }}>
<Input
{...method.register('email')}
name="email"
placeholder="회사 이메일"
showError={true}
className={input}
/>
</div>
<span>@samsung.com</span>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/app/signup/components/InputArea/InputArea.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ export const inputWrapper = style({
globalStyle(`${inputWrapper} > div`, {
justifyContent: 'normal',
});
export const input = style({
width: '100%',
});
11 changes: 9 additions & 2 deletions src/app/signup/components/InputArea/InputArea.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';
import { Input, InputSection } from '@/components';
import { FieldValues, UseFormReturn } from 'react-hook-form';
import { inputWrapper } from './InputArea.css';
import { inputWrapper, input } from './InputArea.css';
import { HTMLAttributes } from 'react';
import cx from 'classnames';

Expand All @@ -18,7 +18,14 @@ const InputArea = ({ label, name, placeholder, required, method, type, className
return (
<div className={cx(inputWrapper, className)}>
<InputSection label={label} variant="label3" color="sub" direction="column" required={required}>
<Input {...method.register(name)} name={name} placeholder={placeholder} showError={true} type={type} />
<Input
{...method.register(name)}
name={name}
placeholder={placeholder}
showError={true}
type={type}
className={input}
/>
</InputSection>
</div>
);
Expand Down
5 changes: 3 additions & 2 deletions src/components/IconButton/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const IconButton = ({
const [iconSvgId, setIconSvgId] = useState<string>(iconType);

useEffect(() => {
if (!error) return;
setStatus(error ? ICON_STATUS.ERROR : disabled ? ICON_STATUS.DISABLE : ICON_STATUS.DEFAULT);
}, [error, disabled]);

Expand All @@ -55,8 +56,8 @@ const IconButton = ({
};

const handleOnClick = (e: MouseEvent<HTMLButtonElement>): void => {
if (error || disabled) return;
if (active) {
if (disabled) return;
if (active || error) {
setStatus(isActive ? ICON_STATUS.DEFAULT : ICON_STATUS.ACTIVE);
setIsActive(!isActive);
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type InputProps = {
} & React.ComponentPropsWithoutRef<'input'>;

const Input = forwardRef(function Input(props: InputProps, ref: ForwardedRef<HTMLInputElement>) {
const { type, name, placeholder, showError, ...rest } = props;
const { type, name, placeholder, showError, className, ...rest } = props;
const { formState, resetField } = useFormContext();
const handleReset = useCallback(() => resetField(name, { defaultValue: '', keepDirty: false }), []);
const errorMessage = formState.errors[name]?.message as string;
Expand All @@ -40,7 +40,7 @@ const Input = forwardRef(function Input(props: InputProps, ref: ForwardedRef<HTM
)}
<input
name={name}
className={clsx(inputBase({ type }), errorMessage && inputError)}
className={clsx(inputBase({ type }), errorMessage && inputError, className)}
placeholder={placeholder}
ref={ref}
type={type}
Expand Down

0 comments on commit 724fb64

Please sign in to comment.