-
Notifications
You must be signed in to change notification settings - Fork 57
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
[전소은]19주차 과제 업로드 #437
Open
sobokki
wants to merge
1
commit into
codeit-bootcamp-frontend:part3-전소은
Choose a base branch
from
sobokki:part3-전소은-week19
base: part3-전소은
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
The head ref may contain hidden characters: "part3-\uC804\uC18C\uC740-week19"
Open
[전소은]19주차 과제 업로드 #437
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"google", | ||
"plugin:react/recommended" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"react" | ||
], | ||
"rules": { | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,55 @@ | ||
// Input.jsx | ||
|
||
import React, { forwardRef } from "react"; | ||
import classNames from "classnames"; | ||
import styles from "./Input.module.css"; | ||
import Image from "next/image"; | ||
|
||
const Input = forwardRef( | ||
({ state, type = "text", placeholder, errorMessage, ...props }, ref) => { | ||
const combinedStyles = classNames(styles["input-base"], { | ||
[styles["input-state"]]: state === "error", | ||
}); | ||
|
||
return ( | ||
<> | ||
const Input = ({ | ||
label, | ||
type, | ||
error, | ||
placeholder, | ||
id, | ||
value, | ||
onKeyPress, | ||
onChangeType, | ||
onChange, | ||
defaultValue, | ||
registerConfig, | ||
}) => { | ||
return ( | ||
<> | ||
<label className={styles.label} htmlFor={id}> | ||
{label} | ||
</label> | ||
<div className={styles.inputBox}> | ||
<input | ||
ref={ref} | ||
className={classNames(styles.input, { [styles.error]: error })} | ||
type={type} | ||
className={combinedStyles} | ||
id={id} | ||
placeholder={placeholder} | ||
{...props} | ||
defaultValue={defaultValue} | ||
value={value} | ||
onChange={onChange} | ||
{...registerConfig} | ||
/> | ||
{errorMessage && ( | ||
<p className={styles["error-message"]}>{errorMessage}</p> | ||
{(type === "password" || type === "text") && onChangeType && ( | ||
<button | ||
className={classNames(styles.imgWrapper)} | ||
onClick={onChangeType} | ||
type="button" | ||
tabIndex={-1} | ||
> | ||
<Image | ||
src={`/eye-${type === "password" ? "off" : "on"}.svg`} | ||
alt="eye-icon" | ||
width={24} | ||
height={24} | ||
/> | ||
</button> | ||
)} | ||
</> | ||
); | ||
} | ||
); | ||
</div> | ||
{error && <p className={styles.errorMessage}>{error}</p>} | ||
</> | ||
); | ||
}; | ||
|
||
export default Input; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,37 @@ | ||
import Image from "next/image"; | ||
import styles from "./Nav.module.css"; | ||
export default function Nav() { | ||
import Link from "next/link"; | ||
|
||
export default function Nav({ userProfile }) { | ||
return ( | ||
<> | ||
<div className={styles["nav-all"]}> | ||
<div className={styles["nav-layout"]}> | ||
<div className={styles["logo-img"]}> | ||
<Image fill src="/Linkbrary.svg" alt="로고 이미지" /> | ||
</div> | ||
<div className={styles["nav-all"]}> | ||
<div className={styles["nav-layout"]}> | ||
<div className={styles["logo-img"]}> | ||
<Image | ||
src="/Linkbrary.svg" | ||
alt="로고 이미지" | ||
width={100} | ||
height={100} | ||
/> | ||
</div> | ||
{userProfile ? ( | ||
<div className={styles["profile-layout"]}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
const UserInfo = () => {
return (
<div>....</div>
)
}
const Nav = () => {
return (
{ userProfile && <UserInfo/> }
)
} |
||
<div className={styles["profile-img"]}> | ||
<Image fill src="/profile.svg" alt="프로필 이미지" /> | ||
<Image | ||
src={userProfile.image_source} | ||
alt="프로필 이미지" | ||
width={50} | ||
height={50} | ||
/> | ||
</div> | ||
<div className={styles["profile-email"]}>[email protected]</div> | ||
<div className={styles["profile-email"]}>{userProfile.email}</div> | ||
</div> | ||
</div> | ||
) : ( | ||
<Link href="/signin"> | ||
<div className={styles["login-btn"]}>로그인</div> | ||
</Link> | ||
)} | ||
</div> | ||
</> | ||
</div> | ||
); | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const BASE_URL = " https://bootcamp-api.codeit.kr/api/linkbrary/v1"; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
컴포넌트를 만들 때, 아래의 요구사항같이 외부에서 해당
Input
의 Native 이벤트를 핸들링할 수 있도록 만드는 것이 좋습니다.(ex. 회원가입 폼에서 validation(유효성 검증)을 통과하지 못한 경우, Input을 강제 포커스)
forwardRef
를 꼭 찾아보시고 적용해주세요.