Skip to content

Commit

Permalink
Merge pull request #242 from boostcampwm-2022/refactor/frontend-refac…
Browse files Browse the repository at this point in the history
…toring

Refactor/frontend refactoring
  • Loading branch information
gchoi96 authored Dec 14, 2022
2 parents b973e11 + 38cfc1f commit c85db58
Show file tree
Hide file tree
Showing 17 changed files with 104 additions and 65 deletions.
10 changes: 1 addition & 9 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="apple-touch-icon" href="/logo192.png" />
<link rel="manifest" href="/manifest.json" />
<link rel="stylesheet" type="text/css" charset="UTF-8"
href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css" />
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css" />

<meta name="description" content="나만의 코스로 함께 달리는 러닝 커뮤니티, RunWithMe를 시작해보세요!" />
<title>runwithme</title>
</head>

Expand Down
27 changes: 27 additions & 0 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"react-slick": "^0.29.0",
"react-spinners": "^0.13.7",
"recoil": "^0.7.6",
"slick-carousel": "^1.8.1",
"socket.io-client": "^4.5.4",
"styled-components": "^5.3.6",
"web-vitals": "^2.1.4"
Expand Down
Binary file modified client/public/favicon.ico
Binary file not shown.
Binary file removed client/public/logo192.png
Binary file not shown.
Binary file removed client/public/logo512.png
Binary file not shown.
38 changes: 0 additions & 38 deletions client/src/App.css

This file was deleted.

3 changes: 3 additions & 0 deletions client/src/assets/icons/home_icon.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: 2 additions & 0 deletions client/src/assets/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import MY_POSITION_ICON from "./my_position_icon.svg";
import SEND_ICON from "./send_icon.svg";
import STRAIGHT_ICON from "./straight_icon.svg";
import CURVE_ICON from "./curve_icon.svg";
import HOME_ICON from "./home_icon.svg";

export {
USER_CIRCLE_ICON,
Expand All @@ -42,4 +43,5 @@ export {
SEND_ICON,
STRAIGHT_ICON,
CURVE_ICON,
HOME_ICON,
};
1 change: 1 addition & 0 deletions client/src/components/Button/Button.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ export const Button = styled.button<ButtonProps>`
width: ${({ width }) => width};
${({ color }) => fontLarge(color, 500)}
background-color: ${({ backgroundColor }) => backgroundColor};
position: relative;
`;
4 changes: 3 additions & 1 deletion client/src/components/Carousel/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { ReactNode } from "react";
import Slider, { Settings } from "react-slick";
import styled from "styled-components";
import { COLOR } from "styles/color";
import "slick-carousel/slick/slick.css";
import "slick-carousel/slick/slick-theme.css";

interface CarouselProps {
children: ReactNode;
Expand All @@ -16,7 +18,7 @@ export const Container = styled.div`
.slick-active {
button {
::before {
color: ${COLOR.ORANGE} !important;
color: ${COLOR.DOT} !important;
}
}
}
Expand Down
53 changes: 39 additions & 14 deletions client/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import styled from "styled-components";
import { flexRowSpaceBetween } from "styles/flex";
import { ARROW_LEFT_ICON, USER_CIRCLE_ICON } from "#assets/icons";
import { flexRow } from "styles/flex";
import { ARROW_LEFT_ICON, HOME_ICON, USER_CIRCLE_ICON } from "#assets/icons";
import { useNavigate } from "react-router-dom";
import { COLOR } from "styles/color";
import { fontLarge } from "styles/font";
import { useRecoilValue } from "recoil";
import { userState } from "#atoms/userState";
import { ALIGN_ITEMS, JUSTIFY_CONTENT } from "#types/flexOptions";
const HeaderWrapper = styled.div`
${flexRowSpaceBetween};
${flexRow({ justifyContent: JUSTIFY_CONTENT.SPACE_BETWEEN })};
padding: 16px 8px;
border-bottom: ${`1px solid ${COLOR.BABY_BLUE}`};
p {
Expand All @@ -18,11 +19,19 @@ const HeaderWrapper = styled.div`
height: 24px;
}
div {
width: 24px;
height: 24px;
width: 56px;
${flexRow({ alignItems: ALIGN_ITEMS.CENTER, justifyContent: JUSTIFY_CONTENT.FLEX_END })};
> * {
margin: 0 2px;
}
}
`;

const Dummy = styled.div`
width: 24px;
height: 24px;
`;

interface HeaderProps {
text: string;
isMain?: boolean;
Expand All @@ -34,19 +43,35 @@ const Header = ({ text, isMain = false }: HeaderProps) => {
return (
<HeaderWrapper>
{isMain ? (
<div />
<div>
<Dummy />
</div>
) : (
<img width="14" height="14" alt="ARROW_LEFT_ICON" src={ARROW_LEFT_ICON} onClick={() => navigate(-1)} />
<div>
<img
width="14"
height="14"
alt="ARROW_LEFT_ICON"
src={ARROW_LEFT_ICON}
onClick={() => navigate(-1)}
/>
<Dummy />
</div>
)}

<p>{text}</p>
<img
width="14"
height="14"
alt="USER_CIRCLE_ICON"
src={USER_CIRCLE_ICON}
onClick={() => navigate(userInfo.accessToken ? "/me" : "/login")}
/>
<div>
{!isMain && (
<img width="14" height="14" alt="HOME_ICON" src={HOME_ICON} onClick={() => navigate("/")} />
)}
<img
width="14"
height="14"
alt="USER_CIRCLE_ICON"
src={USER_CIRCLE_ICON}
onClick={() => navigate(userInfo.accessToken ? "/me" : "/login")}
/>
</div>
</HeaderWrapper>
);
};
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/RecruitContent/RecruitContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const RecruitContent = ({ onClick, data }: RecruitContentProps) => {
</div>
<ButtonWrapper>
<Button onClick={onClick}>{getButtonText(data)}</Button>
{data.isParticipating && <ChatButton />}
{data.isParticipating && <ChatButton waiting={data.waiting} />}
</ButtonWrapper>
</Content>
</>
Expand Down
25 changes: 24 additions & 1 deletion client/src/components/commons/ChatButton/ChatButton.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
import Button from "#components/Button/Button";
import { ALIGN_ITEMS, JUSTIFY_CONTENT } from "#types/flexOptions";
import { useNavigate, useParams } from "react-router-dom";
import styled from "styled-components";
import { COLOR } from "styles/color";
import { flexRow } from "styles/flex";

const ChatButton = () => {
interface ChatButtonProps {
waiting?: number;
}

const Badge = styled.span`
${flexRow({ alignItems: ALIGN_ITEMS.CENTER, justifyContent: JUSTIFY_CONTENT.CENTER })};
border-radius: 50%;
position: absolute;
right: -0.6rem;
top: -0.6rem;
width: 2rem;
height: 2rem;
background-color: red;
color: white !important;
font-weight: 900;
font-size: 1.2rem;
`;

const ChatButton = ({ waiting }: ChatButtonProps) => {
const { id } = useParams();
const navigate = useNavigate();

return (
<Button backgroundColor={COLOR.CHAT_BUTTON} onClick={() => navigate(`/recruit/${id}/chat`)}>
채팅
{!!waiting && <Badge>{waiting > 9 ? "9+" : waiting}</Badge>}
</Button>
);
};
Expand Down
1 change: 0 additions & 1 deletion client/src/react-app-env.d.ts

This file was deleted.

1 change: 1 addition & 0 deletions client/src/styles/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export enum COLOR {
ORANGE = "#FFB800",
F1F4F7 = "#F1F4F7",
CHAT_BUTTON = "#4A668B",
DOT = "#007aff",
}
1 change: 1 addition & 0 deletions client/src/types/RecruitDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ export interface RecruitDetail {
userId: string;
isParticipating: boolean;
isAuthor: boolean;
waiting?: number;
}

0 comments on commit c85db58

Please sign in to comment.