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

[Feat/#133] 로그인 로그아웃 라우팅 #137

Merged
merged 5 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions src/pages/main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import FaqDropdown from './components/FaqDropdown';
import FaqTitle from './components/FaqTitle';
import GroupCarouselTitle from './components/GroupCarouselTitle';
import Introduction from './components/Introduction';
import { MainHeader } from './components/MainHeader';
import { LogInHeader, UnAuthorizationHeader } from './components/MainHeader';
import Manual from './components/Manual';
import OnBoarding from './components/OnBoarding';
import Ruler from './components/Ruler';
Expand All @@ -17,7 +17,7 @@ import Spacing from './../../components/commons/Spacing';
const Main = () => {
return (
<MainPageWrapper>
<MainHeader />
{localStorage.getItem('accessToken') === null ? <UnAuthorizationHeader /> : <LogInHeader />}
Copy link
Member

Choose a reason for hiding this comment

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

[P3] LoginHeader라는 컴포넌트명은 혼동이 있을 수 있으니 AuthorizationHeader 로 변경해주실 수 있을까요?

<OnBoarding />
<CarouselComponentLayout>
<GroupCarouselTitle />
Expand Down
45 changes: 45 additions & 0 deletions src/pages/main/components/CarouselSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import styled from '@emotion/styled/macro';
import React from 'react';
import 'react-loading-skeleton/dist/skeleton.css';

interface skeletonPropTypes {
width?: number;
height?: number;
circle?: boolean;
rounded?: boolean;
count?: number;
unit?: string; // 단위
animation?: boolean;
color?: string;
style?: React.CSSProperties;
}

const CarouselSkeleton = ({
width,
height,
circle,
rounded,
count,
unit,
animation,
color,
style,
}: skeletonPropTypes) => {
return (
<SkeletonWrapper
width={width}
height={height}
circle={circle}
rounded={rounded}
count={count}
unit={unit}
animation={animation}
color={color}
style={style}
/>
);
};

export default CarouselSkeleton;

const SkeletonWrapper = styled.div``;
10 changes: 8 additions & 2 deletions src/pages/main/components/MainHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@ import MakeGroupBtn from '../../groupFeed/components/MakeGroupBtn';
import MyGroupBtn from '../../groupFeed/components/MyGroupBtn';

// 메인 페이지 헤더
export const MainHeader = () => {
export const LogInHeader = () => {
const handleLogOut = () => {
logout();
alert('로그아웃 되었습니다');
location.reload();
};

return (
<HeaderWrapper>
<HeaderLogoIc />
<HeaderBtnLayout>
<MyGroupBtn />
<CommonBtnLayout>
<MakeGroupBtn />
<LogInOutBtn onClick={logout}>로그아웃</LogInOutBtn>
<LogInOutBtn onClick={handleLogOut}>로그아웃</LogInOutBtn>
</CommonBtnLayout>
</HeaderBtnLayout>
</HeaderWrapper>
Expand Down