Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4ab431b
💄 style: 방 만들기 버튼에 + 아이콘 svg 추가
danggin Jan 15, 2025
21af2da
✨ feat: 게임 시작 기다리기, 상대 턴 기다리기 모달 추가
danggin Jan 16, 2025
ff2b56e
Merge branch 'develop' into feature/ui
danggin Jan 16, 2025
1987346
🍱 assets: 트로피 이미지 수정, 홈 화면 로고 이미지 추가
danggin Jan 16, 2025
1315d47
✨ feat: 홈 화면 추가
danggin Jan 16, 2025
f34d631
💄 style: height 100%로 수정
danggin Jan 16, 2025
aa5b7cd
✨ feat: 홈 화면과 에러 화면에서 쓰이는 애니메이션 배경 추가
danggin Jan 16, 2025
8e81014
➖ remove: 가입 완료 화면 한 파일로 통합
danggin Jan 16, 2025
a80b14e
✨ feat: 에러 페이지 추가
danggin Jan 16, 2025
0621dfc
✨ feat: 가입 완료 페이지 로그인 버튼 클릭 시 로그인 화면으로 이동하도록 수정
danggin Jan 16, 2025
c87d89b
✨ feat: esc 키 누르면 모달 닫기 기능 추가
danggin Jan 16, 2025
267626d
✏️ typos: console.log 코드 삭제
danggin Jan 16, 2025
b9c0851
✨ feat: 모달 외부 클릭 시 모달 닫기 기능 추가
danggin Jan 16, 2025
ca678de
✨ feat: 로딩 컴포넌트 및 관련 라이브러리 추가
danggin Jan 16, 2025
6ac8fb7
✨ feat: 게임 시작 기다리기 모달에 로딩 컴포넌트 추가
danggin Jan 16, 2025
8d77942
✨ feat: App에 suspense 및 로딩 컴포넌트 추가
danggin Jan 16, 2025
231131c
✨ feat: accessToken으로 로그인 여부 구분
danggin Jan 16, 2025
ab5ca47
✨ feat: 회원가입 완료 시 가입 완료 페이지로 이동 기능 추가
danggin Jan 16, 2025
bb9639b
✨ feat: start 버튼 클릭 시 게임 방 목록으로 이동 기능 추가
danggin Jan 16, 2025
02423e8
💄 style: 화면 높이 관련 스타일 수정
danggin Jan 16, 2025
3c57062
✨ feat: 모달 실행 시 스크롤 방지 기능 추가
danggin Jan 16, 2025
44580ad
🚧 cont: 채팅 작업중
danggin Jan 16, 2025
d582e97
Merge pull request #15 from danggin/feature/ui
danggin Jan 16, 2025
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@tanstack/react-query": "4",
"axios": "^1.7.9",
"jwt-decode": "^4.0.0",
"lottie-react": "^2.4.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.54.2",
Expand Down
6 changes: 5 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import "@styles/font.css";
import GlobalStyles from "./styles/GlobalStyle";
import Loading from "./components/ui/loading/Loading";
import { RouterProvider } from "react-router-dom";
import { router } from "./routes/router";
import { Suspense } from "react";

function App() {
return (
<>
<GlobalStyles />
<RouterProvider router={router} />
<Suspense fallback={<Loading overlay={true} />}>
<RouterProvider router={router} />
</Suspense>
</>
);
}
Expand Down
15 changes: 10 additions & 5 deletions src/assets/images/icon_trophy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/assets/images/logo_large.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions src/components/layout/footer/FooterStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,4 @@ export const StyledFooter = styled.footer<FooterProps>`
justify-content: center;
align-items: center;
color: var(--color-gray-600);
position: fixed;
bottom: 0;
`;
11 changes: 3 additions & 8 deletions src/components/layout/header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import logo from "@assets/images/logo.svg";
import Button from "@components/ui/button/Button.tsx";
import { NavLink, useNavigate } from "react-router-dom";
import { useEffect, useState } from "react";
import { StyledHeader, NavList, Logo } from "./HeaderStyle.ts";

export default function Header() {
const [isLoggedIn, setIsLoggedIn] = useState(false); // 임시 login 상태
const navigate = useNavigate();

useEffect(() => {
setIsLoggedIn(false);
}, []);
const accessToken = localStorage.getItem("accessToken");

const onClickMove = () => {
navigate("./user/signup");
Expand All @@ -22,15 +17,15 @@ export default function Header() {
<>
<StyledHeader>
<Logo>
<NavLink to="/">
<NavLink to="/game">
<img src={logo} />
</NavLink>
</Logo>
<NavList>
<li>
<NavLink to="/rank">랭킹</NavLink>
</li>
{isLoggedIn ? (
{accessToken ? (
<>
<li>
<NavLink to="/user/mypage">마이페이지</NavLink>
Expand Down
16 changes: 12 additions & 4 deletions src/components/layout/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,30 @@ import { Outlet, useLocation } from "react-router-dom";
import { Wrapper, Container } from "./LayoutStyle";
import { useModalStore } from "@store/useModalStore";

const HIDDEN_HEADERS = "/game/room/";
const GAME_ROOM = "/game/room/";
const HIDDEN_HEADER_FOOTER = "/home";

export default function Layout() {
const { showModal } = useModalStore();
const location = useLocation();
const pathname = location.pathname;
const isHiddenHeader = pathname.includes(HIDDEN_HEADERS);
const isGameRoom = pathname.includes(GAME_ROOM);
const isHiddenHeaderFooter = pathname.includes(HIDDEN_HEADER_FOOTER);

return (
<>
<Wrapper>
{!isHiddenHeader ? <Header /> : <GameRoomHeader />}
{isHiddenHeaderFooter ? (
""
) : !isGameRoom ? (
<Header />
) : (
<GameRoomHeader />
)}
<Container>
<Outlet />
</Container>
<Footer />
{!isHiddenHeaderFooter && <Footer />}
</Wrapper>

<Toast />
Expand Down
3 changes: 2 additions & 1 deletion src/components/layout/layout/LayoutStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import styled from "styled-components";

export const Wrapper = styled.div`
width: 100%;
/* height: 100%; */
height: 100%;
`;

export const Container = styled.main`
width: 100%;
height: 100%;
padding: 50px 150px;
min-height: 800px;
`;
2 changes: 2 additions & 0 deletions src/components/ui/button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function Button({
disabled,
width,
playerNumber,
...props
}: IButtonProps) {
return (
<S.Button
Expand All @@ -22,6 +23,7 @@ export default function Button({
textcolor={textcolor}
width={width}
playerNumber={playerNumber}
{...props}
>
{children}
</S.Button>
Expand Down
6 changes: 6 additions & 0 deletions src/components/ui/card/chatting/Chatting.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import ChatInputBox from "../../chatInput/ChatInputBox";
import * as S from "./ChattingStyle";
// import { Socket } from "socket.io-client";

// export interface IChattingProps {
// socket: Socket | null;
// }

export default function ChattingBox() {
return (
<S.chat>
Expand Down
32 changes: 31 additions & 1 deletion src/components/ui/chatInput/ChatInputBox.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,45 @@
import Button from "../button/Button";
import * as S from "./chatInputStyle";
// import { IChattingProps } from "../card/chatting/Chatting";
// import { useEffect, useState } from "react";
// import { useParams } from "react-router-dom";

export default function ChatInputBox() {
// const [message, setMessage] = useState("");
// const params = useParams();
// const roomId = Number(params.id);

// useEffect(() => {
// setMessage("");
// }, []);

// console.log(socket);

// const onClickSendMessage = () => {
// if (!socket) {
// console.log("방에 연결할 수 없습니다.");
// return;
// }
// socket.emit("message", { roomId: roomId, message }, (res: any) => {
// console.log(`Message sent: ${JSON.stringify(res)}`);
// });
// };

return (
<S.chatInputBox>
<S.chatInput
type="text"
placeholder="상대방과 채팅을 나눌 수 있습니다."
// value={message}
></S.chatInput>
<S.buttonBox>
<Button size="xs" bgcolor="green" textcolor="black" type="button">
<Button
size="xs"
bgcolor="green"
textcolor="black"
type="button"
// onClick={onClickSendMessage}
>
전송
</Button>
</S.buttonBox>
Expand Down
27 changes: 27 additions & 0 deletions src/components/ui/circleBackground/CircleBackground.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import {
Circle,
CircleBlue,
CircleGreen,
CircleRose,
CircleYellow,
Wrapper,
} from "./circleBackgroundStyle";

export default function CircleBackground() {
return (
<Wrapper>
<CircleGreen>
<Circle />
</CircleGreen>
<CircleBlue>
<Circle />
</CircleBlue>
<CircleRose>
<Circle />
</CircleRose>
<CircleYellow>
<Circle />
</CircleYellow>
</Wrapper>
);
}
99 changes: 99 additions & 0 deletions src/components/ui/circleBackground/circleBackgroundStyle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import styled, { keyframes } from "styled-components";

const MovingGreen = keyframes`
0% {
transform: translate(100%, 0);
}
65% {
transform: translate(260%, 35%);
}
100% {
transform: translate(0%, 150%);
}
`;

const MovingBlue = keyframes`
0% {
transform: translate(300%, 20%);
}
30% {
transform: translate(0%, 240%);
}
100% {
transform: translate(-180%, -10%);
}
`;

const MovingRose = keyframes`
0% {
transform: translate(-10%, 200%);
}
50% {
transform: translate(140%, 80%);
}
100% {
transform: translate(50%, 0%);
}
`;

const MovingYellow = keyframes`
0% {
transform: translate(10%, -20%);
}
40% {
transform: translate(-30%, 150%);
}
100% {
transform: translate(260%, 320%);
}
`;
export const Wrapper = styled.div``;

export const CircleGreen = styled.div`
position: absolute;
animation: ${MovingGreen} ease-in-out alternate infinite 10s both;

> div {
background-color: var(--color-primary);
width: 400px;
height: 400px;
}
`;

export const CircleBlue = styled.div`
position: absolute;
animation: ${MovingBlue} ease-in-out alternate infinite 10s both;

> div {
background-color: var(--color-secondary);
width: 350px;
height: 350px;
}
`;

export const CircleRose = styled.div`
position: absolute;
animation: ${MovingRose} ease-in-out alternate infinite 10s both;

> div {
width: 500px;
height: 500px;
background-color: var(--color-rose);
}
`;

export const CircleYellow = styled.div`
position: absolute;
animation: ${MovingYellow} ease-in-out alternate infinite 10s both;

> div {
background-color: var(--color-yellow-100);
}
`;

export const Circle = styled.div`
width: 300px;
height: 300px;
border-radius: 50%;
filter: blur(50px);
`;
27 changes: 27 additions & 0 deletions src/components/ui/loading/Loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Lottie from "lottie-react";
import animationData from "./loading.json";
import { LoadingWrapper, LoadingBox, LoadingMessage } from "./loadingStyle";

export interface LoadingProps {
overlay?: boolean;
}

function Loading({ overlay = false }: { overlay: boolean }) {
console.log(overlay);

return (
<LoadingWrapper overlay={overlay}>
<LoadingBox overlay={overlay}>
<Lottie
style={{ width: "150px", height: "150px" }}
loop={true}
animationData={animationData}
autoPlay={true}
/>
{overlay && <LoadingMessage>로딩중입니다 ... 🏃🏻‍♀️</LoadingMessage>}
</LoadingBox>
</LoadingWrapper>
);
}

export default Loading;
1 change: 1 addition & 0 deletions src/components/ui/loading/loading.json

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions src/components/ui/loading/loadingStyle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import styled from "styled-components";
import { LoadingProps } from "./Loading";

export const LoadingWrapper = styled.div<LoadingProps>`
${(props) =>
props.overlay &&
`
position: fixed;
inset: 0;
background-color: rgba(208, 255, 207, 0.5);
display: flex;
justify-content: center;
align-items: center;
`}
`;

export const LoadingBox = styled.div<LoadingProps>`
${(props) =>
props.overlay &&
`
width: 250px;
height: 250px;
background-color: var(--color-gray-0);
border-radius: 25px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 20px;
`}
`;

export const LoadingMessage = styled.p``;
Loading