Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…4-touroot into feature/fe/#419
  • Loading branch information
simorimi committed Sep 26, 2024
2 parents 6d5f1dc + e4eb2fb commit 8598d2d
Show file tree
Hide file tree
Showing 30 changed files with 543 additions and 369 deletions.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"typescript": "^5.5.3",
"undici": "^6.19.2",
"webpack": "^5.92.1",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4",
"webpack-merge": "^6.0.1"
Expand Down
7 changes: 7 additions & 0 deletions frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="chrome" content="nointentdetection" />

<link rel="preconnect" href="https://maps.googleapis.com" />
<link rel="preconnect" href="https://maps.gstatic.com" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="dns-prefetch" href="https://maps.googleapis.com" />
<link rel="dns-prefetch" href="https://maps.gstatic.com" />
<link rel="dns-prefetch" href="https://fonts.googleapis.com" />

<title>to your route, 투룻</title>
</head>
<body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import styled from "@emotion/styled";
export const Layout = styled.div`
display: flex;
flex-direction: column;
gap: 2rem;
gap: ${({ theme }) => theme.spacing.m};
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Libraries } from "@react-google-maps/api";

export const LIBRARIES: Libraries = ["maps", "places", "marker"];
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
import { Libraries, LoadScript } from "@react-google-maps/api";
import { useJsApiLoader } from "@react-google-maps/api";

interface GoogleMapLoadScriptProps {
libraries: Libraries;
loadingElement?: React.ReactNode;
import { LIBRARIES } from "@components/common/GoogleMapLoadScript/GoogleMapLoadScript.constants";

interface GoogleMapLoadScriptProps extends React.PropsWithChildren {
loadingElement: React.ReactNode;
}

const GoogleMapLoadScript = ({
children,
libraries,
loadingElement,
}: React.PropsWithChildren<GoogleMapLoadScriptProps>) => {
return (
<LoadScript
googleMapsApiKey={process.env.REACT_APP_GOOGLE_MAP_API_KEY ?? ""}
libraries={libraries}
loadingElement={loadingElement}
>
{children}
</LoadScript>
);
const GoogleMapLoadScript = ({ children, loadingElement }: GoogleMapLoadScriptProps) => {
const { isLoaded } = useJsApiLoader({
googleMapsApiKey: process.env.REACT_APP_GOOGLE_MAP_API_KEY ?? "",
libraries: LIBRARIES,
});

return isLoaded ? <>{children}</> : loadingElement;
};

export default GoogleMapLoadScript;
2 changes: 0 additions & 2 deletions frontend/src/components/common/Input/Input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
placeholder: "제목을 입력해 주세요.",
count: 0,
maxCount: 20,
},
};

Expand Down
9 changes: 1 addition & 8 deletions frontend/src/components/common/Input/Input.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ import theme from "@styles/theme";

import type { InputVariants } from "./Input.type";

export const InputContainer = styled.div`
display: flex;
flex-direction: column;
gap: 0.8rem;
width: 100%;
`;

export const Label = styled.label`
${({ theme }) => theme.typography.mobile.bodyBold};
color: ${(props) => props.theme.colors.text.primary};
Expand Down Expand Up @@ -43,6 +35,7 @@ export const Input = styled.input<{ variant: InputVariants }>`
if (variant === "none") return noneStyle;
}}
`;

export const roundStyle = css`
border: 0.1rem solid ${theme.colors.border};
Expand Down
16 changes: 3 additions & 13 deletions frontend/src/components/common/Input/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
import { forwardRef } from "react";

import CharacterCount from "../CharacterCount/CharacterCount";
import * as S from "./Input.styled";
import type { InputVariants } from "./Input.type";

interface InputProps extends React.ComponentPropsWithRef<"input"> {
count?: number;
maxCount?: number;
variants?: InputVariants;
}

const Input = forwardRef<HTMLInputElement, InputProps>(
({ count, maxCount, variants = "round", ...props }, ref) => {
return (
<S.InputContainer>
<S.Input variant={variants} {...props} ref={ref} />
{count && maxCount ? <CharacterCount count={count} maxCount={maxCount} /> : null}
</S.InputContainer>
);
},
);
const Input = forwardRef<HTMLInputElement, InputProps>(({ variants = "round", ...props }, ref) => {
return <S.Input variant={variants} {...props} ref={ref} />;
});

Input.displayName = "Input";

Expand Down
8 changes: 5 additions & 3 deletions frontend/src/components/common/Spinner/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import React from "react";

import type { SpinnerVariants } from "@components/common/Spinner/Spinner.type";

import { Tturi } from "@assets/svg";

import * as S from "./Spinner.styled";

interface SpinnerProps {
interface SpinnerProps extends React.ComponentPropsWithoutRef<"div"> {
variants?: SpinnerVariants;
size?: number;
}

const Spinner = ({ variants = "tturi", size = 100 }: SpinnerProps) => {
const Spinner = ({ variants = "tturi", size = 100, ...props }: SpinnerProps) => {
return (
<S.LoadingSpinner $size={size} $variants={variants}>
<S.LoadingSpinner $size={size} $variants={variants} {...props}>
{variants === "tturi" && <Tturi />}
</S.LoadingSpinner>
);
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/components/pages/my/MyPage.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ export const NicknameWrapper = styled.div`
height: 3rem;
`;

export const InputContainer = styled.div`
display: flex;
flex-direction: column;
gap: ${({ theme }) => theme.spacing.s};
width: 100%;
`;

export const inputStyle = css`
${theme.typography.mobile.bodyBold};
width: 12rem;
Expand Down
42 changes: 23 additions & 19 deletions frontend/src/components/pages/my/MyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FormEvent, MouseEvent, useEffect, useState } from "react";
import usePatchNickname from "@queries/usePatchNickname";
import { useUserProfile } from "@queries/useUserProfile";

import { AvatarCircle, Input, Tab, Text } from "@components/common";
import { AvatarCircle, CharacterCount, Input, Tab, Text } from "@components/common";
import MyPageSkeleton from "@components/pages/my/MyPageSkeleton/MyPageSkeleton";

import { ERROR_MESSAGE_MAP } from "@constants/errorMessage";
Expand Down Expand Up @@ -85,24 +85,28 @@ const MyPage = () => {
{nickname}
</Text>
) : (
<Input
placeholder={data?.nickname}
value={nickname}
autoFocus
maxCount={20}
maxLength={20}
count={nickname?.length}
spellCheck={false}
css={S.inputStyle}
onChange={(e) =>
setNickname(
e.target.value.slice(
FORM_VALIDATIONS_MAP.title.minLength,
FORM_VALIDATIONS_MAP.title.maxLength,
),
)
}
/>
<S.InputContainer>
<Input
placeholder={data?.nickname}
value={nickname}
autoFocus
maxLength={20}
spellCheck={false}
css={S.inputStyle}
onChange={(e) =>
setNickname(
e.target.value.slice(
FORM_VALIDATIONS_MAP.title.minLength,
FORM_VALIDATIONS_MAP.title.maxLength,
),
)
}
/>
<CharacterCount
count={nickname?.length}
maxCount={FORM_VALIDATIONS_MAP.title.maxLength}
/>
</S.InputContainer>
)}
</S.NicknameWrapper>
</S.FormWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ const TravelPlansTabContent = ({ places }: { places: TravelPlanPlace[] }) => {

return (
<div>
<GoogleMapLoadScript
loadingElement={<Skeleton width="100%" height="23rem" />}
libraries={["places", "maps"]}
>
<GoogleMapLoadScript loadingElement={<Skeleton width="100%" height="23rem" />}>
<GoogleMapView places={positions} />
</GoogleMapLoadScript>
<S.BoxContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,29 @@ import { SPACING } from "@styles/tokens";
export const Layout = styled.div`
display: flex;
flex-direction: column;
gap: ${SPACING.xl};
gap: ${({ theme }) => theme.spacing.xl};
padding: ${SPACING.m};
& > :last-child {
margin-top: -${SPACING.xl};
}
padding: ${({ theme }) => theme.spacing.m};
`;

export const AccordionRootContainer = styled.div`
margin-top: ${SPACING.m};
export const InputContainer = styled.div`
display: flex;
flex-direction: column;
gap: ${({ theme }) => theme.spacing.s};
width: 100%;
`;

export const PageInfoContainer = styled.div`
display: flex;
flex-direction: column;
gap: ${SPACING.s};
gap: ${({ theme }) => theme.spacing.s};
`;

export const StartDateContainer = styled.div`
display: flex;
flex-direction: column;
gap: ${SPACING.s};
`;

export const LoadingWrapper = styled.div`
width: 100%;
height: 5.6rem;
gap: ${({ theme }) => theme.spacing.s};
`;

export const addDayButtonStyle = css`
Expand All @@ -47,26 +42,7 @@ export const addButtonStyle = css`
width: 100%;
height: 4rem;
margin-bottom: ${SPACING.xl};
padding: 1.2rem 1.6rem;
border: 0.1rem solid ${theme.colors.border};
border: 1px solid ${theme.colors.border};
border-radius: ${SPACING.s};
`;

export const loadingButtonStyle = css`
margin-top: ${SPACING.xl};
`;

export const startDateInputStyle = css`
margin: 0 0 ${SPACING.xl};
`;

export const calendarStyle = css`
margin-bottom: ${SPACING.xl};
`;

export const accordionRootStyle = css`
& > :last-child {
margin-bottom: ${SPACING.xl};
}
`;
Loading

0 comments on commit 8598d2d

Please sign in to comment.