Skip to content
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

[week15] 배의진 #486

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions pages/signup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Form } from "@/src/components-sign/feature-form/Form";
import { Header } from "@/src/components-sign/ui-header/Header";
import { Sns } from "@/src/components-sign/ui-sns/Sns";
import { SignLayout } from "@/src/page-layout/SignLayout/SignLayout";

export default function SignUpPage() {
return <SignLayout header={<Header />} form={<Form />} sns={<Sns />} />;
}
4 changes: 4 additions & 0 deletions public/images/eye-off.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/images/eye-on.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/google.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions public/images/kakao.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 19 additions & 29 deletions src/components-common/ui-footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import styles from "./Footer.module.scss";
import classNames from "classnames/bind";
import { route } from "@/src/components-common/util";
import {
facebook,
instagram,
route,
twitter,
youtube,
} from "@/src/components-common/util";
import { footerText } from "./constant";
import React from "react";
import Image from "next/image";
Expand All @@ -23,51 +29,35 @@ export const Footer: React.FC<FooterProps> = () => {
</a>
</div>
<div className={cx("sns")}>
<a
href="https://www.facebook.com/"
target="_blank"
rel="noopener noreferrer"
>
<a href={facebook.url} target="_blank" rel="noopener noreferrer">
<Image
fill
src="images/facebook.svg"
alt="facebook 홈페이지로 연결된 facebook 로고"
src={facebook.src}
alt={facebook.alt}
style={{ objectFit: "contain" }}
/>
</a>
<a
href="https://twitter.com/"
target="_blank"
rel="noopener noreferrer"
>
<a href={twitter.url} target="_blank" rel="noopener noreferrer">
<Image
fill
src="images/twitter.svg"
alt="twitter 홈페이지로 연결된 twitter 로고"
src={twitter.src}
alt={twitter.alt}
style={{ objectFit: "contain" }}
/>
</a>
<a
href="https://www.youtube.com/"
target="_blank"
rel="noopener noreferrer"
>
<a href={youtube.url} target="_blank" rel="noopener noreferrer">
<Image
fill
src="images/youtube.svg"
alt="youtube 홈페이지로 연결된 youtube 로고"
src={youtube.src}
alt={youtube.alt}
style={{ objectFit: "contain" }}
/>
</a>
<a
href="https://www.instagram.com/"
target="_blank"
rel="noopener noreferrer"
>
<a href={instagram.url} target="_blank" rel="noopener noreferrer">
<Image
fill
src="images/instagram.svg"
alt="instagram 홈페이지로 연결된 instagram 로고"
src={instagram.src}
alt={instagram.alt}
style={{ objectFit: "contain" }}
/>
</a>
Expand Down
4 changes: 2 additions & 2 deletions src/components-common/ui-navigation-bar/NavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import classNames from "classnames/bind";
import { route } from "@/src/components-common/util";
import { Cta } from "@/src/components-common/ui-cta";
import { Profile } from "@/src/components-user/ui-profile";
import { logoImage, navText } from "./constant";
import { logoImage, text } from "@/src/components-common/util/constant";
import Image from "next/image";

const cx = classNames.bind(styles);
Expand Down Expand Up @@ -35,7 +35,7 @@ export const NavigationBar: React.FC<NavigationBarProps> = ({
) : (
<a href={route.로그인}>
<Cta>
<span className={cx("signin")}>{navText.login}</span>
<span className={cx("signin")}>{text.login}</span>
</Cta>
</a>
)}
Expand Down
5 changes: 0 additions & 5 deletions src/components-common/ui-navigation-bar/constant.ts

This file was deleted.

39 changes: 39 additions & 0 deletions src/components-common/util/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,45 @@ export const route = {
FAQ: "/faq",
};

export const text = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기본적으로 상수의 네이밍 컨벤션은 상수스타일이라고
모든 문자를 대문자, 문자와 문자사이는 _로 네이밍 하는 규칙이 일반적입니다!
ex) TEXT, KAKAO, CONSTANT_NAME, 이런식으로요!

login: "로그인",
signup: "회원가입",
addLink: "링크 추가하기",
};

export const kakao = {
url: "https://www.kakaocorp.com/page/",
src: "/images/kakao.svg",
alt: "카카오 홈페이지로 연결된 카카오 로고",
};
export const google = {
url: "https://www.google.com/",
src: "/images/google.png",
alt: "구글 홈페이지로 연결된 구글 로고",
};
export const twitter = {
url: "https://twitter.com/",
src: "/images/twitter.svg",
alt: "트위터 홈페이지로 연결된 트위터 로고",
};
export const youtube = {
url: "'https://www.youtube.com/",
src: "/images/youtube.svg",
alt: "유투브 홈페이지로 연결된 유투브 로고",
};
export const facebook = {
url: "https://www.facebook.com/",
src: "/images/facebook.svg",
alt: "페이스북 홈페이지로 연결된 페이스북 로고",
};
export const instagram = {
url: "https://www.instagram.com/",
src: "/images/instagram.svg",
alt: "인스타그램 홈페이지로 연결된 인스타그램 로고",
};

export const logoImage = "images/linkbrary.svg";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이....건 굳이 상수 폴더에 있을 필요는 없을 것 같고 그냥 사용하는곳에서 import해오는게 좋아보입니다!


const second = 1000;
const minute = second * 60;
const hour = minute * 60;
Expand Down
17 changes: 0 additions & 17 deletions src/components-common/util/copyToClipboard.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/components-common/util/useAsync.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from "react";
import { useEffectOnce } from "./useEffectOnce";
import { Types } from "../../../types/data-access-types";
import { AxiosResponse } from "axios";
import type { AxiosResponse } from "axios";

export interface asyncFunctionType {
(): Promise<AxiosResponse<Types>>;
Expand Down
45 changes: 0 additions & 45 deletions src/components-common/util/useKakaoSdk.ts

This file was deleted.

3 changes: 2 additions & 1 deletion src/components-index/ui-header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import styles from "./Header.module.scss";
import classNames from "classnames/bind";
import React from "react";
import { Cta } from "@/src/components-common/ui-cta";
import { text } from "@/src/components-common/util";

const cx = classNames.bind(styles);

Expand All @@ -18,7 +19,7 @@ export const Header: React.FC<{}> = () => {
</div>
{/* TODO: 일단 Ui 만 구현. 추후 링크 추가하기 기능 추가 */}
<Cta>
<span className={cx("add-link")}>링크 추가하기</span>
<span className={cx("add-link")}>{text.addLink}</span>
</Cta>
<img
src={"/images/header.png"}
Expand Down
2 changes: 1 addition & 1 deletion src/components-shared/ui-link-form/LinkForm.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
}

.icon {
width: 1.6rem;
height: 1.6rem;
width: 1.6rem;

@include tablet {
width: 2rem;
Expand Down
2 changes: 1 addition & 1 deletion src/components-shared/ui-link-form/LinkForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const LinkForm: React.FC<LinkFormProps> = ({ onSubmit }) => {
<div className={cx("input-box")}>
<Image
className={cx("icon")}
src="images/link.svg"
src="/images/link.svg"
alt="링크 아이콘"
/>
<input
Expand Down
29 changes: 29 additions & 0 deletions src/components-sign/data-access-sign/useCheckAccount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { axiosInstance } from "@/src/components-common/util";

export const checkAccountAlreadyExist = async (
id: string
): Promise<boolean> => {
const address = "check-email";
try {
const response = await axiosInstance.post(address, { email: id });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이건 그냥

 const response = await axiosInstance.post('/check-email', { email: id });

이렇게 해주시면 될 것 같습니다 ㅎ

너무 변수를 남발하는 것도 ......굳이..라는 생각이 좀 드네요 😅

return response.status === 200;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오잉..? 통신이 성공했는지 안했는지를 반환하나요?
옳은 방향...은 아닌것 같습니다 😅
response.data에 다른 정보는 혹시 오지 않는건가요?

} catch (error) {
alert("계정이 이미 존재합니다.");
return false;
}
};

export const checkAccountValid = async (
id: string,
pwd: string
): Promise<boolean> => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promise<boolean> 같이 Promise 타입은 꽤나 많이 사용합니다 👍👍👍👍

const address = "sign-up";
const account = { email: id, password: pwd };
try {
const response = await axiosInstance.post(address, account);
return response.status === 200;
} catch (error) {
alert("계정 정보가 잘못되었습니다.");
return false;
}
};
13 changes: 13 additions & 0 deletions src/components-sign/feature-form/Form.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@import "@/styles/global.scss";

.container {
display: flex;
flex-direction: column;
align-items: flex-start;
row-gap: 2.4rem;
width: 100%;

& > :last-child {
margin-top: 0.6rem;
}
}
Loading
Loading