Skip to content

Commit

Permalink
Merge pull request #7 from kimkee/DEV
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
kimkee authored Jan 12, 2024
2 parents c43be68 + afdd098 commit ad6336b
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 18 deletions.
14 changes: 13 additions & 1 deletion public/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ a, button{-webkit-tap-highlight-color: rgb(0 0 0 / 30%);}
.btn.xl{height: 60rem;min-width: 80rem;padding: 0 10rem;font-size: 16rem;font-weight: 400;}

.btn.disabled,
.btn[disabled]:not(.a){color: rgb(221 221 221 / 40%);}
.btn[disabled]:not(.a){color: rgb(221 221 221 / 20%);}

.btn.a{border-color: #41b883;background-color: #41b883;color:#ffffff;}
.btn.a:disabled,
Expand Down Expand Up @@ -430,6 +430,18 @@ html.is-lock {height: 100%;width: 100%;overflow: hidden;position: fixed;}
.sign-form .link a{color: #d5d5d5;}
.sign-form .join.form{margin: 10rem 0rem 20rem 0rem;}


.ut-avata{display: flex;gap: 5rem 0rem;flex-wrap: wrap;justify-content: center;}
.ut-avata label{display: inline-flex;position: relative;width: calc(100% / 7);}
.ut-avata label input{position: absolute;width: 34rem;height: 34rem;}
.ut-avata label input:checked + .txt{border-color: #61dafb;}
.ut-avata label .txt{display: inline-flex;width: 36rem;height: 36rem;border: solid 3rem transparent;border-radius: 20rem;overflow: hidden;}
.ut-avata label .txt .img{width: 31rem;height: 31rem;}

.msg-valid{color: #838383;font-size: 12rem;margin: 3rem 2rem 0rem 14rem;text-align: right;}



@keyframes loading-rotate {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
Expand Down
7 changes: 3 additions & 4 deletions src/app/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
'use client'
import Image from 'next/image'
import React, { useEffect,useState } from 'react'; //useState, useEffect
import { useRouter } from 'next/navigation';
import React, { useEffect, useState } from 'react';
// import {NavLink , useLocation } from 'react-router-dom'; // Link , useLocation, useSearchParams,useParams, useSearchParams



export default function Nav() {

// const location = useLocation();

const router = useRouter();

const isActive = els => location.pathname.includes(`${els}`) ? "active" : "";

Expand Down Expand Up @@ -40,8 +41,6 @@ export default function Nav() {

</div>
<div className="rdt">


<button type="button" className="bt gnb"><i className="fa-sharp fa-solid fa-bars"></i><b>메뉴</b></button>
</div>
</div>
Expand Down
5 changes: 2 additions & 3 deletions src/app/components/Nav.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client'
import React, { useEffect,useState } from 'react'; //useState, useEffect
// import {NavLink , useLocation } from 'react-router-dom'; // Link , useLocation, useSearchParams,useParams, useSearchParams
import { usePathname } from 'next/navigation';
import clsx from 'clsx';
import ui from '../ui.js';
Expand Down Expand Up @@ -48,8 +47,8 @@ export default function Nav() {
<a href={`/search`} className={"bt"}><i className="fa-regular fa-search"></i><em>Search</em></a>
</li>
<li className={ clsx(`li`,{ 'active': pathname.includes('/user')}) }>
<a href={`/user/${userInfo.uid}`} className={"bt"}> <i className="fa-regular fa-user"></i><em>Mypage</em></a>
{/* <a href={`/user/signin`} className={"bt"}><i className="fa-regular fa-user"></i><em>Login</em></a> */}
{/* <a href={`/user/${userInfo.uid}`} className={"bt"}> <i className="fa-regular fa-user"></i><em>Mypage</em></a> */}
<a href={`/user/login`} className={"bt"}><i className="fa-regular fa-user"></i><em>Login</em></a>
</li>
</ul>
</div>
Expand Down
6 changes: 5 additions & 1 deletion src/app/products/List.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export default function List() {
<Link href={"/products/item/"+data.id} className="unit-pd">
<div className="thum">
<div className="pic"><img className="img" src={image} alt="이미지" onError={ ui.error.poster } /></div>
<span className="btzzim on"><i className="fa-regular fa-heart"></i><b>찜하기</b></span>

{ idx % 5 === 1 &&
<span className="btzzim on"><i className="fa-regular fa-bookmark"></i><b>찜하기</b></span>
}

{ data.status == '판매중' ? null
:<em className="flg"><i className="fg">{data.status}</i></em>
}
Expand Down
16 changes: 16 additions & 0 deletions src/app/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ const ui = {
aaa:function(){
console.log("dsfafsafdsffsafasfdfas");
},
avatar: [
"https://cdn-icons-png.flaticon.com/128/3899/3899618.png",
"https://cdn-icons-png.flaticon.com/128/805/805370.png ",
"https://cdn-icons-png.flaticon.com/128/1154/1154448.png",
"https://cdn-icons-png.flaticon.com/128/1211/1211015.png",
"https://cdn-icons-png.flaticon.com/128/949/949635.png",
"https://cdn-icons-png.flaticon.com/128/4322/4322992.png",
"https://cdn-icons-png.flaticon.com/128/547/547413.png",
"https://cdn-icons-png.flaticon.com/128/4322/4322991.png",
"https://cdn-icons-png.flaticon.com/128/4202/4202843.png",
"https://cdn-icons-png.flaticon.com/128/2589/2589136.png",
"https://cdn-icons-png.flaticon.com/128/1785/1785918.png",
"https://cdn-icons-png.flaticon.com/128/4139/4139993.png",
"https://cdn-icons-png.flaticon.com/128/1154/1154473.png",
"https://cdn-icons-png.flaticon.com/128/4532/4532510.png",
],
error:{
poster: e => e.target.src=`/img/common/noimage.png`,
user: e => e.target.src=`/img/common/user.png`
Expand Down
11 changes: 11 additions & 0 deletions src/app/user/join/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Nav from '@/app/components/Nav.jsx';
import Header from '@/app/components/Header.jsx';
export default function Layout({ children }) {
return (
<>
<Header />
{children}
<Nav />
</>
)
}
124 changes: 124 additions & 0 deletions src/app/user/join/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
"use client"
import Image from 'next/image'
import { useRouter } from 'next/navigation';
import React, { useState, useEffect, useRef } from 'react';
import ui from '@/app/ui.js';

export default function Login() {
const router = useRouter();
const [emailRef, passwordRef, nicknameRef, avatarRef] = [useRef(), useRef(), useRef(), useRef()];

const erMsg = {
"auth/user-not-found": "존재하지 않는 사용자 정보로 로그인을 시도한 경우 발생",
"auth/wrong-password": "비밀번호가 잘못된 경우 발생",
"auth/too-many-requests": "연속된 로그인 요청이 여러 번 감지되어 로그인 요청이 금지됨",
"auth/weak-password": "비밀번호가 6자리 미만인 경우 발생",
"auth/invalid-email": "잘못된 포맷의 이메일을 입력한 경우 발생",
"auth/email-already-in-use": "이미 사용 중인 이메일 계정 ID로 회원 가입을 시도하는 경우 발생",
"auth/invalid-phone-number": "잘못된 포맷의 핸드폰 번호를 입력한 경우 발생",
"auth/internal-error": "비밀번호를 입력하세요.",
}
const [inpVal, setInpVal] = useState({
isMail: false,
isPwds: false,
isNick: false,
});
console.log(inpVal);
const validate = (input) => {

const pattern = {
mail : /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/, // 이메일 형식
pass : /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,15}$/, // 문자,숫자 포함6자리 이상 15자 이하
nick : /^[a-zA-Z0-9가-힣]{1,15}$/ // 특수문자 제외하고 , 문자 또는 숫자 1자리 이상 15자 이하
}
switch (input.name) {
case 'email': setInpVal( inpVal => ({ ...inpVal, isMail: pattern.mail.test(input.value) })); break;
case 'password': setInpVal( inpVal => ({ ...inpVal, isPwds: pattern.pass.test(input.value) })); break;
case 'nickname': setInpVal( inpVal => ({ ...inpVal, isNick: pattern.nick.test(input.value) })); break;
// case 'nickname': setIsNickValid( pattern.nick.test(input.value) ); break;
default: break;
}
};

const member = {
joinReq : async ()=> {

console.log( document.querySelector( `[name="avatar"]:checked` ).value );
console.log(emailRef.current.value);
console.log(passwordRef.current.value);
console.log(nicknameRef.current.value);

ui.loading.show('glx');
const email = emailRef.current.value;
const password = passwordRef.current.value;


},
addMember : async (user, gourl)=> {

}
}


return (
<div className="container page sign in">
<main className={`contents`}>

<div className="sign-form">
{/* <div className="hdt">회원가입</div> */}
<div className="join form">
<div className="tit"><em className="t">회원가입</em></div>
<ul className="list">
<li>
<label className="dt">아바타</label>
<div className="dd">
<div className="ut-avata">
{ ui.avatar.map( (icon,index) => {
return (
<label key={index}>
<input type="radio" name="avatar" ref={avatarRef} value={index} defaultChecked={index == 0 } />
<span className="txt"><img className="img" src={icon} alt="" /></span>
</label>
)
}) }
</div>
</div>
</li>
<li>
<label className="dt">이메일</label>
<div className="dd">
<span className="input"><input ref={emailRef} name="email" type="email" placeholder="예) [email protected]" onInput={(e)=>validate(e.currentTarget)} data-webkit-autofill /></span>
{!inpVal.isMail ? <p className={`msg-valid`}>이메일 형식에 맞게 입력해주세요.</p> : <i className="chk fa-solid fa-check"></i>}
</div>
</li>
<li>
<label className="dt">비밀번호</label>
<div className="dd">
<span className="input"><input ref={passwordRef} name="password" type="password" placeholder="예) abc123" onInput={(e)=>validate(e.currentTarget)} maxLength={15} /></span>
{!inpVal.isPwds ? <p className={`msg-valid`}>문자,숫자 포함 6자리 이상 입력해주세요.</p> : <i className="chk fa-solid fa-check"></i>}
</div>
</li>
<li>
<label className="dt">닉네임</label>
<div className="dd">
<span className="input"><input ref={nicknameRef} name="nickname" type="text" placeholder="입력하세요" onInput={(e)=>validate(e.currentTarget)} maxLength={15} /></span>
{!inpVal.isNick ? <p className={`msg-valid`}>특수문자 제외하고 입력해주세요.</p> : <i className="chk fa-solid fa-check"></i>}
</div>
</li>
</ul>
</div>
<div className="btsbox btn-set">
<button type="button" className="btn"
disabled={!(inpVal.isMail && inpVal.isPwds && inpVal.isNick)}
onClick={member.joinReq}><i className="fa-solid fa-right-to-bracket"></i><em>회원가입</em></button>
</div>
<div className="link">
이미 회원이신가요? <button type="button" className="bt" onClick={ ()=> router.push(`/user/login`) }>로그인 하러가기 <i className="fa-solid fa-chevron-right"></i></button>
</div>

</div>

</main>
</div>
)
};
19 changes: 10 additions & 9 deletions src/app/user/login/page.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"use client"
import Image from 'next/image'
import { useRouter } from 'next/navigation';
import React, { useRef } from 'react';
import ui from '@/app/ui.js';

export default function Login() {

const router = useRouter();
const userEmail = useRef(null);
const userPassword = useRef(null);
const autoLogin = useRef(null);
Expand Down Expand Up @@ -48,26 +49,26 @@ export default function Login() {
<div className="sns form">
<div className="tit"><em className="t">SNS 로그인</em></div>
<div className="bts">
<button type="button" className="btn" /* onClick={''} */><i className="fa-brands fa-google"></i><em>Google </em></button>
<button type="button" className="btn" onClick={loginGithub }><i className="fa-brands fa-github"></i><em>Github </em></button>
<button type="button" className="btn" /* onClick={''} */><i className="fa-brands fa-facebook"></i><em>Facebook </em></button>
<button type="button" className="btn" /* onClick={''} */><i className="fa-brands fa-twitter"></i><em>Twitter </em></button>
<button type="button" className="btn" onClick={loginGithub }><i className="fa-brands fa-github" /><em>Github </em></button>
<button type="button" className="btn" disabled><i className="fa-brands fa-google" /><em>Google </em></button>
<button type="button" className="btn" disabled><i className="fa-brands fa-kickstarter-k" /><em>Kakao </em></button>
<button type="button" className="btn" disabled><i className="fa-brands fa-twitter" /><em>Twitter </em></button>
</div>
</div>
<div className="eml form">
<div className="tit"><em className="t">Email 계정 로그인</em></div>
<ul className="list">
<li>
<div className="dd"><span className="input"><input type="email" ref={userEmail} placeholder="이메일 ([email protected])" /></span></div>
<div className="dd"><span className="input"><input type="email" ref={userEmail} placeholder="이메일" /></span></div>
</li>
<li>
<div className="dd"><span className="input"><input type="password" ref={userPassword} placeholder="비밀번호 (123456)" /></span></div>
<div className="dd"><span className="input"><input type="password" ref={userPassword} placeholder="비밀번호" /></span></div>
</li>
</ul>
<div className="savelogin">
<a className={`bt`} to={"/user/signup"}>
<button type="button" className={`bt`} onClick={ ()=> router.push(`/user/join`) }>
회원가입하러 가기 <i className="fa-solid fa-chevron-right"></i>
</a>
</button>
<label className="checkbox"><input type="checkbox" ref={autoLogin} onChange={saveSheck} /><span className="txt">자동 로그인</span></label>
</div>
<div className="btsbox btn-set"><button type="button" className="btn" onClick={login}><i className="fa-solid fa-right-to-bracket"></i><em>로그인</em></button></div>
Expand Down

0 comments on commit ad6336b

Please sign in to comment.