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

AppBar Component 개발 #24

Merged
merged 42 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
250d861
feat: #11 Add AppBar Component
sean2337 Jul 9, 2024
9fee9fa
fix: React Icon size bug fix
sean2337 Jul 9, 2024
2ad7b5e
chore: React-icon Dependency 생성
sean2337 Jul 9, 2024
be6cf7b
feat: list item card 컴포넌트
leeminhee119 Jul 6, 2024
d78da3c
feat: #2 라디오 버튼 컴포넌트
leeminhee119 Jul 6, 2024
d51e007
chore: #11 로그 제거
leeminhee119 Jul 7, 2024
7a1cd15
chore: #11 공백 추가
leeminhee119 Jul 7, 2024
51e2f1f
fix: 외부에서 선택 값 읽을 수 있도록 수정
leeminhee119 Jul 7, 2024
2d2c7d5
Update src/component/common/Card/ListItemCard.tsx
leeminhee119 Jul 7, 2024
86e5a84
fix: #11 ListItemCard children 타입 필수로 변경
leeminhee119 Jul 7, 2024
f9cbe1b
chore: #11 variant props 옵셔널로 변경
leeminhee119 Jul 7, 2024
4d00683
feat: #2 useModal hook 정의
donghunee Jul 6, 2024
338b4c0
feat: Modal Componet 추가
donghunee Jul 6, 2024
276743f
chore: #11 modal-root 추가
donghunee Jul 6, 2024
85b791a
fix: #11 document로 수정, 필요없는 기능 삭제
donghunee Jul 7, 2024
5f53ff5
fix: #11 width, height 단위 변경, memo 제거
donghunee Jul 7, 2024
9084960
refactor: #11 px에서 rem으로 수정
donghunee Jul 7, 2024
f4afe03
refactor: #11 interface에서 type으로 수정
donghunee Jul 7, 2024
2cce83a
refactor: #11 PropsWithChildren type 적용
donghunee Jul 7, 2024
79560ac
feat: #11 modal atom, type 추가
donghunee Jul 7, 2024
f22dad8
refactor: #11 modal component 로직 변경
donghunee Jul 7, 2024
a9d1698
refactor: callback type 수정
donghunee Jul 8, 2024
4764797
refactor: #11 useEffect 의존성 배열 수정
donghunee Jul 8, 2024
e7bb49f
fix: fix prettier format
sean2337 Jul 9, 2024
956fbc8
feat: #11 Add Button Component
klmhyeonwoo Jul 8, 2024
257cf77
feat: #12 Redefine Layout Style
klmhyeonwoo Jul 8, 2024
194fb4f
chore: React-icon Dependency 생성
sean2337 Jul 9, 2024
987f681
feat: #11 Default Layout에 AppBar 적용
sean2337 Jul 9, 2024
b78e4d2
refactor: Refactor Login Logic
sean2337 Jul 9, 2024
c643cba
feat #11: Add Router to Login Page
sean2337 Jul 9, 2024
3cbbb57
Merge branch 'develop' into feat/#11/AppBar
sean2337 Jul 9, 2024
37750a9
fix:#11 Rename import URL
sean2337 Jul 9, 2024
2b36a4d
chore: Modify AppBar title type
sean2337 Jul 10, 2024
3c4f7d2
feat: Add Login Page Default Layout
sean2337 Jul 10, 2024
9dfe35f
Merge remote-tracking branch 'origin/develop' into feat/#11/AppBar
sean2337 Jul 10, 2024
4208cc3
remove: #11 Remove React-icon dependency
sean2337 Jul 10, 2024
240e123
chore: Modify SocialLoginButton URL
sean2337 Jul 10, 2024
e600b88
design: Modify Icon Default Size
sean2337 Jul 10, 2024
81f7ca1
chore: Apply Icon Component to AppBar
sean2337 Jul 10, 2024
cdae553
chore #11: Social Login Import URL 변경
sean2337 Jul 12, 2024
79e63eb
chore: #11 PropsWithChildren Generic 추가를 통한 타입 명시
sean2337 Jul 13, 2024
5228362
chore: #11 Props 구조 변경 및 AppBar 컨벤션 정리
sean2337 Jul 14, 2024
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
5,412 changes: 2,984 additions & 2,428 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions src/app/login/Login.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { DefaultLayout } from "@/layout/DefaultLayout";
import SocialLoginButton from "@/component/button/SocialLoginButton";
import { kakaoLogin } from "./kakao/kakaoLogin";
import { googleLogin } from "./google/googleLogin";

const Login = () => {
return (
<DefaultLayout appBarVisible={false}>
<SocialLoginButton type="kakao" handler={kakaoLogin} />
<SocialLoginButton type="google" handler={googleLogin} />
</DefaultLayout>
);
};
export default Login;
3 changes: 3 additions & 0 deletions src/app/login/google/googleLogin.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function googleLogin() {
console.log("구글 로그인 시도");
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
const Login = () => {
export function kakaoLogin() {
const REST_API_KEY: string = import.meta.env.VITE_REST_API_KEY;
Copy link
Member

Choose a reason for hiding this comment

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

어랏 카멜로 작성돼있어요 (파일명도) ! 확인 부탁드려용

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

요거는 페이지는 아니구, 카카오 로그인에 필요한 로직 함수인데 이는 카멜이 맞지 않나요??

Copy link
Member

Choose a reason for hiding this comment

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

아앗 컴포넌트가 아니군요! app 폴더 안에 있어서 컴포넌트라고 제가 착각했네요 하핫 😂

Copy link
Collaborator

Choose a reason for hiding this comment

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

그렇다면 app폴더가 아닌 util 폴더로 빼는 게 좋아보입니다~!!
그리고 로직함수라면 arrow function으로 작성해야할 것 같습니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

네넵 맞습니다. 기존에 만든것 또한 현재 컨벤션이랑 다른게 너무 많아 따로 이슈로 파두고 수정할 예정입니다!!
언급해주셔서 감사합니다 ☺️☺️

Copy link
Member

Choose a reason for hiding this comment

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

저두 너무 많아서 브랜치 새로 파서 수정하려구요.. ㅎㅎ 좋습니다

const REDIRECT_URI: string = import.meta.env.VITE_REDIRECT_URI;
const link = `https://kauth.kakao.com/oauth/authorize?client_id=${REST_API_KEY}&redirect_uri=${REDIRECT_URI}&response_type=code`;

const loginHandler = () => {
window.location.href = link;
};

return (
<div>
<button type="button" onClick={loginHandler}>
Hello Kakao Login
</button>
</div>
);
};
export default Login;
window.location.href = link;
}
2 changes: 1 addition & 1 deletion src/component/common/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Props = {

const DEFAULT_ICON_COLOR = "#000000";

function Icon({ icon, color = DEFAULT_ICON_COLOR, size = "0.2rem", onClick }: Props) {
function Icon({ icon, color = DEFAULT_ICON_COLOR, size = "2rem", onClick }: Props) {
const SVGIcon = icons[icon];
const widthRem = typeof size === "number" ? `${size}rem` : size;

Expand Down
68 changes: 68 additions & 0 deletions src/component/common/appBar/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { css } from "@emotion/react";
import { useNavigate } from "react-router-dom";
import Icon from "../Icon/Icon";

export type AppBarProps = {
title?: string;
LeftComp?: React.ReactNode;
RightComp?: React.ReactNode;
};

//FIXME: 색깔 디자인 토큰에 따라 변경
const Back = () => {
const navigate = useNavigate();

return (
<Icon
icon="ic_back"
onClick={() => {
navigate(-1);
}}
/>
);
};

//FIXME : 디자인 토큰에 따라 색깔 변경, 폰트 수정
const AppBar = ({ title, LeftComp = <Back />, RightComp = <div></div> }: AppBarProps) => {
return (
<>
<div
css={css`
width: 100%;
max-width: 48rem;
height: 4.8rem;
padding: 0 2rem;
background-color: transparent;
display: flex;
justify-content: space-between;
align-items: center;
position: fixed;
left: 50%;
transform: translateX(-50%);
box-sizing: border-box;
`}
>
{LeftComp}
<div
css={css`
position: absolute;
left: 50%;
transform: translateX(-50%);
font-size: 1.8rem;
`}
>
{title}
</div>
{RightComp}
</div>
<div
css={css`
width: 100%;
height: 4.8rem;
`}
/>
</>
);
};

export default AppBar;
15 changes: 8 additions & 7 deletions src/layout/DefaultLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { css } from "@emotion/react";
import { Fragment, PropsWithChildren } from "react";
import AppBar from "@/component/common/appBar";
import { AppBarProps } from "@/component/common/appBar";

export function DefaultLayout({ children }: PropsWithChildren) {
type DefaultLayoutProps = PropsWithChildren<AppBarProps> & {
appBarVisible?: boolean;
};

export function DefaultLayout({ children, title, appBarVisible = true, LeftComp, RightComp }: DefaultLayoutProps) {
return (
<Fragment>
{/* FIXME: 헤더 컴포넌트 작업 시, 해당 헤더 엘리먼트 제거 */}
<header
css={css`
height: 4.6rem;
`}
/>
{appBarVisible && <AppBar title={title} LeftComp={LeftComp} RightComp={RightComp} />}
<main
css={css`
flex: 1 1 0;
Expand Down
7 changes: 6 additions & 1 deletion src/router/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Fragment } from "react";
import { createBrowserRouter, RouterProvider } from "react-router-dom";

import MainPage from "@/app/MainPage.tsx"; /* FIXME - 실제 메인 페이지 작성 후 대체해주세요. */
import Login from "@/app/login/Login";
import Staging from "@/app/test/Staging.tsx";
import GlobalLayout from "@/layout/GlobalLayout.tsx";

Expand All @@ -14,6 +15,10 @@ const routerChildren = [
path: "/staging",
element: <Staging />,
},
{
path: "/login",
element: <Login />,
},
];

const router = createBrowserRouter([
Expand All @@ -26,4 +31,4 @@ const router = createBrowserRouter([
]);
export const Routers = () => {
return <RouterProvider router={router} />;
};
};
Loading